CtrlK
BlogDocsLog inGet started
Tessl Logo

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.

Install with Tessl CLI

npx tessl i github:wshobson/agents --skill sql-optimization-patterns
What are skills?

80

Does it follow best practices?

Agent success when using this skill

Validation for skill structure

SKILL.md
Review
Evals

Evaluation results

90%

Optimizing a Slow User Activity Report

N+1 elimination and subquery optimization

Criteria
Without context
With context

No loop queries

100%

100%

Single aggregate query

100%

100%

No correlated subquery

100%

100%

No SELECT *

100%

100%

JOIN-based aggregation

100%

100%

Filter before aggregation

100%

100%

Correct aggregation

100%

100%

CTE or subquery clarity

0%

0%

Notes explain N+1

100%

100%

Notes explain fix

100%

100%

Without context: $0.1719 · 38s · 8 turns · 9 in / 1,900 out tokens

With context: $0.4041 · 1m 48s · 17 turns · 1,225 in / 3,884 out tokens

91%

-1%

Designing an Index Strategy for a Content Publishing Platform

Index design and selection strategy

Criteria
Without context
With context

GIN full-text index

100%

100%

GIN JSONB index

100%

100%

Expression index for email

100%

100%

Partial index for published status

100%

100%

Composite index column order

100%

100%

Cursor pagination index

70%

70%

Cursor-based query provided

100%

100%

No leading wildcard LIKE

100%

100%

Index type rationale

100%

100%

Selective indexing awareness

50%

40%

Without context: $0.3082 · 1m 32s · 11 turns · 12 in / 4,802 out tokens

With context: $0.4473 · 1m 36s · 19 turns · 67 in / 4,482 out tokens

100%

2%

PostgreSQL Performance Audit and Remediation

Performance audit and advanced optimization

Criteria
Without context
With context

pg_stat_statements query

100%

100%

Missing index detection

80%

100%

Unused index detection

100%

100%

Materialized view creation

100%

100%

Concurrent materialized refresh

100%

100%

Batch UPDATE not loop

100%

100%

Temp table for large batch

100%

100%

pg_class approximate count

100%

100%

VACUUM ANALYZE maintenance

100%

100%

Materialized view index

100%

100%

Without context: $0.3290 · 1m 27s · 14 turns · 63 in / 4,636 out tokens

With context: $0.6473 · 2m 11s · 24 turns · 24 in / 7,133 out tokens

Evaluated
Agent
Claude Code

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.