Agent Skills
› aiming-lab/MetaClaw
› sql-best-practices
sql-best-practices
GitHub提供SQL编写最佳实践,涵盖查询优化、安全性及命名规范。用于确保SQL查询的正确性、安全性和性能,指导开发者在编写SELECT、JOIN等操作时遵循标准。
Trigger Scenarios
编写或审查SQL查询
进行数据库模式修改
优化慢速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


