CtrlK
BlogDocsLog inGet started
Tessl Logo
SkillPublic

sql-optimization-patterns

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.

Quality

75%

Does it follow best practices?

Run evals on this skill

Adds up to 20 points to the overall score

View guide
SecuritybySnyk

Passed

No findings from the security scan

Fix and improve this skill with Tessl

tessl review fix ./plugins/developer-essentials/skills/sql-optimization-patterns/SKILL.md
SKILL.md
Quality
Evals
Security

Quality

Content

55%Weight 40%Scale 1-5

Reviews the quality of instructions and guidance provided to agents. Good implementation is clear, handles edge cases, and produces reliable results.

A well-structured, highly executable reference of SQL optimization commands, undermined by verbosity and the absence of a stated workflow. Most of the inline content re-teaches knowledge Claude already has, while the genuinely valuable material (pg_stat monitoring queries, PG index syntax variants) is diluted among padded sections, and no find→diagnose→fix→verify sequence with validation checkpoints is ever given.

Suggestions

Add an explicit optimization workflow with a validation loop, e.g.: 1. Find slow queries via pg_stat_statements, 2. Run EXPLAIN ANALYZE on each, 3. Apply the matching pattern or index, 4. Re-run EXPLAIN ANALYZE to verify improvement before moving on.

Cut sections that restate knowledge Claude already has (the EXPLAIN metrics glossary, index-type primer, "Avoid SELECT *", and the implicit-vs-explicit JOIN example) and keep the body focused on non-obvious content like the pg_stat catalog queries and partial/expression/covering index syntax.

Fix or remove the misleading JOIN example — the planner treats the implicit "FROM users u, orders o WHERE u.id = o.user_id" join identically to an explicit JOIN, so labeling it "Cartesian product then filter" is incorrect; likewise flag that the subquery-pre-filter "Better" form is usually unnecessary on modern planners.

DimensionReasoningScore

Conciseness

Several sections restate standard SQL knowledge Claude already has — a glossary explaining "Seq Scan: Full table scan (usually slow for large tables)" and "Index Only Scan: Using index without touching table (best)", filler like "Indexes are the most powerful optimization tool", and a basic "Avoid SELECT *" example. Only the pg_stat catalog queries and PG-specific index syntax variants (partial, expression, covering) add non-obvious value, so the padding spans multiple sections rather than being occasional.

2 / 5

Actionability

The guidance is fully executable copy-paste SQL covering the common cases: "EXPLAIN (ANALYZE, BUFFERS, VERBOSE) SELECT ...", "CREATE INDEX idx_active_users ON users(email) WHERE status = 'active'", and monitoring queries like "SELECT query, calls, total_time, mean_time FROM pg_stat_statements ORDER BY mean_time DESC LIMIT 10". Examples are complete and runnable with no gaps.

5 / 5

Workflow Clarity

The skill hints at a process ("Understanding EXPLAIN output is fundamental to optimization") and ends with discovery queries, but never sequences an actual workflow (find slow query → EXPLAIN ANALYZE → apply pattern → re-verify) and includes no validation checkpoints such as re-running EXPLAIN ANALYZE after adding an index. Database operations without feedback loops cap this at 3 per the rubric, but the actual level is lower: a rough topical sequence exists while steps are poorly defined and validation is absent.

2 / 5

Progressive Disclosure

The body clearly signals a real, one-level-deep reference — "Detailed pattern documentation lives in `references/details.md`. Read that file when the navigation tier above is insufficient" — and details.md exists with substantial content and no nested references. Minor gaps keep it from a 5: the ~215-line body inlines a heavy catalog (seven index variants, three monitoring queries, best-practices and pitfalls lists) that could be split further, and the single pointer doesn't break the reference into navigable topics.

4 / 5

Total

13

/

20

Passed

Description

83%Weight 40%Scale 1-5

Based on the skill's description, can an agent find and select it at the right time? Clear, specific descriptions lead to better discovery.

A strong description: it states concrete capabilities, includes an explicit and natural "Use when..." trigger clause, and occupies a clear SQL-performance niche. The only weaknesses are minor — a few missing synonyms in the triggers and slight over-breadth from the schema-design and application-performance trigger phrases.

DimensionReasoningScore

Specificity

Names several concrete, distinct actions — "SQL query optimization, indexing strategies, and EXPLAIN analysis" plus the outcome "eliminate slow queries" — which goes beyond the 1-2 actions of a 3. It falls short of 5 only for minor coverage gaps: capabilities the body actually delivers (monitoring via pg_stat_statements, maintenance/VACUUM, N+1 resolution) are absent from the description.

4 / 5

Completeness

Clearly answers both questions: the what is concrete ("Master SQL query optimization, indexing strategies, and EXPLAIN analysis to... eliminate slow queries") and the when is an explicit trigger clause ("Use when debugging slow queries, designing database schemas, or optimizing application performance"). This matches the 5 anchor's structure of what + explicit when with concrete trigger phrases; the 4 anchor's "when could be more explicit" does not apply.

5 / 5

Trigger Term Quality

Good natural keyword coverage: "debugging slow queries", "designing database schemas", "optimizing application performance", "indexing", and "EXPLAIN" are phrases users would genuinely say. A few natural terms are missing ("query tuning", "why is my query slow", "add an index", "N+1"), keeping it below the comprehensive synonym coverage of a 5.

4 / 5

Distinctiveness Conflict Risk

The SQL-optimization niche is clear with distinct triggers ("slow queries", "EXPLAIN", "indexing"), but "designing database schemas" and "optimizing application performance" broaden it into overlap with schema-design and general performance-tuning skills. That is minor overlap risk with closely related skills — the 4 anchor — rather than the minimal conflict risk of a 5.

4 / 5

Total

17

/

20

Passed

Validation

100%

Checks the skill against the spec for correct structure and formatting. All validation checks must pass before discovery and implementation can be scored.

Validation — 16 / 16 Passed

Validation for skill structure

No warnings or errors.

Repository

wshobson/agents

Path

plugins/developer-essentials/skills/sql-optimization-patterns/SKILL.md

Reviewed

Table of Contents

Is this your skill?

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.