Master SQL query optimization, indexing strategies, and EXPLAIN analysis to dramatically improve database performance and eliminate slow queries. Use when debugging slow queries, designing database schemas, or optimizing application performance.
Install with Tessl CLI
npx tessl i github:wshobson/agents --skill sql-optimization-patterns80
Does it follow best practices?
If you maintain this skill, you can automatically optimize it using the tessl CLI to improve its score:
npx tessl skill review --optimize ./path/to/skillAgent success when using this skill
Validation for skill structure
Discovery
82%Based on the skill's description, can an agent find and select it at the right time? Clear, specific descriptions lead to better discovery.
This is a solid description with good trigger terms and explicit 'Use when' guidance. The main weakness is that the capabilities are described at a category level rather than listing specific concrete actions. The word 'Master' at the beginning is slightly promotional but doesn't significantly detract.
Suggestions
Replace category-level terms with specific actions: instead of 'indexing strategies', try 'analyze execution plans, recommend optimal indexes, rewrite inefficient queries, identify missing indexes'
Narrow the scope of 'designing database schemas' to reduce potential conflicts with general database design skills - perhaps 'optimizing schema design for query performance'
| Dimension | Reasoning | Score |
|---|---|---|
Specificity | Names the domain (SQL/database) and mentions actions like 'query optimization, indexing strategies, and EXPLAIN analysis', but these are more categories than concrete actions. Missing specific verbs like 'analyze execution plans', 'recommend indexes', 'rewrite queries'. | 2 / 3 |
Completeness | Clearly answers both what ('SQL query optimization, indexing strategies, EXPLAIN analysis') and when ('Use when debugging slow queries, designing database schemas, or optimizing application performance') with explicit trigger guidance. | 3 / 3 |
Trigger Term Quality | Good coverage of natural terms users would say: 'slow queries', 'database performance', 'indexing', 'EXPLAIN', 'database schemas', 'optimization'. These are terms developers naturally use when seeking help with database issues. | 3 / 3 |
Distinctiveness Conflict Risk | Reasonably specific to SQL/database optimization, but could overlap with general database skills or schema design skills. The focus on 'performance' and 'slow queries' helps distinguish it, but 'designing database schemas' is broad enough to potentially conflict. | 2 / 3 |
Total | 10 / 12 Passed |
Implementation
72%Reviews the quality of instructions and guidance provided to agents. Good implementation is clear, handles edge cases, and produces reliable results.
This is a comprehensive SQL optimization reference with excellent, executable code examples covering a wide range of patterns. Its main weaknesses are verbosity (explaining concepts Claude knows) and lack of a clear diagnostic workflow with validation steps for the optimization process itself. The content would benefit from trimming explanatory text and adding a systematic 'debug slow query' workflow.
Suggestions
Add a clear diagnostic workflow at the top: 'Run EXPLAIN ANALYZE → Identify scan type → Check for missing index → Apply optimization → Verify with EXPLAIN ANALYZE again'
Remove explanatory text Claude already knows (e.g., 'Indexes are the most powerful optimization tool', descriptions of what B-Tree/Hash indexes are)
Add validation checkpoints for index creation (e.g., 'After creating index, verify with EXPLAIN that it's being used; check pg_stat_user_indexes after some queries')
Consolidate the 'When to Use This Skill' section - it duplicates the description and adds little value
| Dimension | Reasoning | Score |
|---|---|---|
Conciseness | The skill is comprehensive but includes some unnecessary explanations Claude would already know (e.g., explaining what B-Tree indexes are, basic JOIN syntax). The 'When to Use This Skill' section is redundant given the description. Could be tightened significantly. | 2 / 3 |
Actionability | Excellent executable code examples throughout - all SQL is copy-paste ready with realistic table names and conditions. Python examples for N+1 patterns are complete and practical. Every pattern includes both bad and good examples with working code. | 3 / 3 |
Workflow Clarity | While patterns are well-organized, there's no clear workflow for actually debugging a slow query (e.g., 'run EXPLAIN → identify bottleneck → apply pattern → verify improvement'). Missing validation checkpoints - no guidance on verifying optimizations worked or rollback if indexes cause problems. | 2 / 3 |
Progressive Disclosure | Good structure with clear sections progressing from core concepts to patterns to advanced techniques. References to external files (postgres-optimization-guide.md, scripts/) are well-signaled and one level deep. Content is appropriately organized for discovery. | 3 / 3 |
Total | 10 / 12 Passed |
Validation
90%Checks the skill against the spec for correct structure and formatting. All validation checks must pass before discovery and implementation can be scored.
Validation — 10 / 11 Passed
Validation for skill structure
| Criteria | Description | Result |
|---|---|---|
skill_md_line_count | SKILL.md is long (510 lines); consider splitting into references/ and linking | Warning |
Total | 10 / 11 Passed | |
Table of Contents
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.