Introduction¶
Writing SQL, tuning slow queries, adding indexes, and designing data warehouse layers often involves digging through documentation, pasting EXPLAIN outputs, and running local verifications. While general conversational models can generate statements, they often gloss over dialect differences, execution plans, and reproducible test data. Here, we introduce SQL Master on SkillHub: it uses a standard SKILL.md to weave generation, optimization, modeling, principle explanation, and (optional) data execution into a single workflow, allowing the Agent to load reference documents based on the scenario and adhere to a unified output specification.
What is this¶
SQL Master (package name sql-master) is a data analysis Skill on SkillHub, maintained under the identifier @indiv-yaoyao/sql-master. Official entry: https://api.skillhub.cn/user_64e5b706/sql-master; Community page: https://skillhub.cn/skills/sql-master.
It positions itself as a “SQL query and data retrieval intelligent agent”: converting natural language into production-grade SQL, analyzing slow queries and execution plans, designing indexes and data warehouse models, explaining SQL principles, and visualizing query results. It supports multiple dialects, including MySQL, PostgreSQL, Hive, Spark SQL, ClickHouse, and BigQuery. The SkillHub page categorizes it under Data Analysis, with the currently displayed version being v1.0.0.
Core Features¶
The following capabilities are derived from the public Skill descriptions on SkillHub / 360 Security Skill Center.
Intent and Reference Documentation¶
Upon receiving a request, the Skill requires first determining the scenario: generation, optimization, design (table structure/indexes/data warehouse), education, error diagnosis, visualization, etc. It then reads topic-specific files under references/ as needed, such as:
| Scenario | Reference File |
|---|---|
| Natural Language → SQL | references/sql-generation.md |
| Slow Queries & Execution Plans | references/query-optimization.md |
| Index Design | references/index-design.md |
| Data Warehouse Modeling | references/data-warehouse.md |
| SQL Principles (Transactions/Locks/MVCC/Joins, etc.) | references/sql-internals.md |
| Multi-dialect Differences | references/dialect-guide.md |
| DDL & Security (Injection防护, etc.) | references/ddl-design.md, references/sql-security.md |
Output and Engineering Constraints¶
The Skill incorporates “production-grade” output requirements: SQL must include business context, database dialect and version, performance expectations, and boundary explanations. Optimization questions are answered using a structure of Diagnosis → Multiple Solutions (including trade-offs) → Expected Benefits → Reproducible DDL/Data. It also lists MUST DO / MUST NOT rules (e.g., check EXPLAIN before optimizing, prohibit string concatenation for SQL, avoid large offset OFFSET pagination, etc.).
Python Scripts (Dependencies Required)¶
After installing Python dependencies, you can use the included connectors and pipelines (module names in the documentation are as follows):
scripts/database_connector.py: Connects to SQLite, MySQL, PostgreSQL, SQL Server, ClickHouse, Oracle to execute queries and export results.scripts/file_connector.py: Reads CSV, Excel, JSON, Parquet, etc., runs SQL on in-memory tables, or performs format conversions.scripts/pipeline.py:SQLPipelinefor chained queries and exports starting from files, databases, or DataFrames.scripts/unified_pipeline.py: End-to-end analysis chained withsql-datavizandsql-report-generator(optional combination).
If dependencies are not installed, it enters “Restricted Mode”: it can still generate SQL, provide optimization and index suggestions based on text, and interpret user-provided EXPLAINs; however, it cannot connect to databases for execution, run local CSV/Excel pipelines, or link with visualization/reporting Skills.
Installation and Activation¶
The Skill is based on the general Agent Skill format (SKILL.md). The installation methods provided by SkillHub and the 360 Skill Center differ slightly; choose the one corresponding to the entry point you are using.
Via secure-skills-cli (Recommended by 360 Skill Center)¶
Copy to your Agent or execute on your local machine:
npx secure-skills-cli add sql-master
Via SkillHub Installation Guide¶
Follow the SkillHub installation documentation (https://skillhub.cn/install/skillhub.md) and instruct the Agent to install:
@indiv-yaoyao/sql-master
The prompt provided by the community page is: “Please install @indiv-yaoyao/sql-master according to https://skillhub.cn/install/skillhub.md.”
Python Dependencies (Full Capabilities)¶
Python 3 and pip are required for first-time use. One-click installation is recommended:
skillhub_install install_skill sql-master
You can also manually execute within the Skill directory:
pip install -r requirements.txt
The specific mounting paths for clients like Cursor, Codex CLI, and Claude Code depend on their respective conventions for Skill directories; public materials do not separately distinguish differences between clients. The unified approach is to trigger the Skill via conversation descriptions (writing SQL, optimization, EXPLAIN, index creation, etc.) after installing the Skill package.
Typical Usage¶
1. Generate or Optimize SQL Only (No DB Connection Needed)¶
Describe the business requirement in the conversation or paste the slow SQL / EXPLAIN output. The Agent will output annotated SQL or an optimization report according to the Skill template. This path does not rely on Python dependencies.
2. Connect to Database to Execute Queries¶
After installing dependencies, the documentation example imports from database_connector and connects according to the dialect:
from scripts.database_connector import connect_sqlite, connect_mysql, connect_postgresql
conn = connect_sqlite("data/sales.db")
result = conn.execute("SELECT region, SUM(amount) FROM sales GROUP BY region")
print(result.df)
For MySQL, PostgreSQL, etc., parameters such as host, database, username, and password must be passed. Usage can be found in similar examples within the publicly available Skill documentation.
3. Local Files + SQL¶
Load files like CSV and query them on in-memory tables:
from scripts.file_connector import load_file
fc = load_file("data/sales.csv")
result = fc.query(
"SELECT region, SUM(amount) as total FROM data GROUP BY region ORDER BY total DESC"
)
4. Pipeline and Three-Skill Chaining (Optional)¶
When charts or HTML reports are needed, sql-dataviz and sql-report-generator can be combined. Documentation example:
from scripts.unified_pipeline import UnifiedPipeline
result = (
UnifiedPipeline("Sales Analysis")
.from_file("sales.csv")
.query("SELECT region, SUM(sales) as total FROM data GROUP BY region")
.interactive_chart("bar", x_col="region", y_col="total")
.insights(value_cols=["total"])
.report(title="Sales Report", output="report.html")
)
print(result.log())
Applicable Scenarios and Notes¶
Who it is for
- Developers or data analysts who need to hand over “writing queries, viewing plans, modifying indexes, explaining principles” to an Agent for unified processing.
- Teams already using the SkillHub ecosystem who wish to interface with visualization/reporting Skills.
Usage Notes
- Full execution and file processing capabilities rely on the Python environment; capabilities are significantly reduced in Restricted Mode. Read the “Must Read Before Use” section within the Skill before installation.
- Before generating or optimizing SQL, the Skill requires confirming the database type and version, table structure, data volume magnitude, and performance goals as much as possible; conclusions will be conservative if information is insufficient.
- When involving production databases, the documentation emphasizes EXPLAIN verification, parameterized queries, and prohibits direct deployment of unaudited complex queries; execution permissions and data masking must be controlled by yourself.
- The SkillHub page shows security scans by Cohen Lab, Yunding Lab, etc., as “Safe, No Risk”; specific reports are subject to the platform links. For sensitive environments, it is recommended to review the Skill scripts on an internal network before enabling.
Conclusion¶
SQL Master writes the full-chain SQL tasks into reusable Agent instructions and reference documents, providing database connection and local file execution under optional dependencies. If you primarily focus on query generation and tuning, you can enable it alone; if you need charts and HTML reports, chain the dataviz / report Skills in the same series according to the documentation.
Official Entry: https://api.skillhub.cn/user_64e5b706/sql-master
Community & Installation Instructions: https://skillhub.cn/skills/sql-master