Agent Skills
› aiming-lab/MetaClaw
› sql-best-practices
sql-best-practices
GitHub提供SQL编写最佳实践,涵盖查询优化、安全性及命名规范。指导使用CTE、参数化查询和事务处理,确保SQL的正确性、安全性和性能。
Trigger Scenarios
编写或审查SQL查询
优化数据库性能
进行数据模式修改
Install
npx skills add aiming-lab/MetaClaw --skill sql-best-practices -g -y
SKILL.md
Frontmatter
{
"name": "sql-best-practices",
"category": "data_analysis",
"description": "Use this skill when writing SQL queries — selects, joins, aggregations, window functions, or schema modifications. Apply whenever SQL is needed to ensure correctness, safety, and performance."
}
SQL Best Practices
Query quality:
- Use
SELECT col1, col2— neverSELECT *in production code. - Use CTEs (
WITH) for readability instead of deeply nested subqueries. - Filter early: apply
WHEREbeforeJOINwhen possible to reduce data scanned. - Use
EXPLAIN/EXPLAIN ANALYZEto inspect query plans for slow queries.
Safety:
- Always use parameterized queries from application code — never string interpolation.
- Wrap destructive operations (
DELETE,UPDATE,DROP) in a transaction. - Test on a staging/dev environment before running on production.
Naming: snake_case for tables/columns, descriptive names, consistent pluralization.
Version History
- 922caf3 Current 2026-07-25 11:08


