index-advisor
Skill7 starsChanged 43 days agoMITView on GitHub
Recommend database indexes from real queries and schema: missing, composite, covering, partial, and unused indexes, with column order rationale and write-cost trade-offs. Use when the user has slow queries, sequential scans, high database CPU, or asks which indexes to add or drop.
2 other projects use a version of this.
Adopted by
Most recently taken up by
- SkillMedev/database-performancetheir own version, first seen Oct 5, 2026
- srikanth-manivannan/claude-agent-factorytheir own version, first seen Jun 26, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- srikanth-manivannan/claude-agent-factory★ 1same name
- SkillMedev/database-performance★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository83 other files it gives its agents.
- AGENTS.mdAGENTS.md
- accessibility-enforcerSkill
- access-policy-designerSkill
- adaptive-guardSkill
- agent-reviewerSkill
- anti-ai-slop-designSkill
- api-mock-designerSkill
- api-observability-plannerSkill
- app-store-reviewerSkill
- ask-first-act-laterSkill
- assumption-checkerSkill
- auth-flow-designerSkill
- b2b-founder-roadmapSkill
- brand-name-labSkill
- breaking-change-detectorSkill
- changelog-generatorSkill
- checkpoint-guardianSkill
- claude-style-codingSkill
- claw-integration-designSkill
- context-compressorSkill
- contract-first-designerSkill
- coolify-orchestratorSkill
- crash-analystSkill
- data-lineage-tracerSkill
- data-maskerSkill
- deep-link-architectSkill
- design-intelligenceSkill
- design-md-enforcerSkill
- ecosystem-apiSkill
- ecosystem-databaseSkill
- ecosystem-mobileSkill
- ecosystem-orchestrationSkill
- ecosystem-productSkill
- ecosystem-reasoningSkill
- ecosystem-securitySkill
- ecosystem-webSkill
- error-recoverySkill
- fth-design-crafterSkill
- geo-auditorSkill
- geo-optimizerSkill
- jev-orchestratorSkill
- mastermind-loggerSkill
- memory-ledgerSkill
- migration-strategistSkill
- mobile-perf-auditorSkill
- mobile-security-auditorSkill
- multi-brain-debateSkill
- multi-brain-expertsSkill
- multi-brain-scoreSkill
- multi-brainSkill
- offline-sync-designerSkill
- onboarding-designerSkill
- output-criticSkill
- parallel-plannerSkill
- pgbouncer-architectSkill
- plan-hardenerSkill
- plan-implement-verify-recoverSkill
- proje-analizcisiSkill
- project-analyzerSkill
- project-focus-firstSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 3 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 16
Before designing, make sure you have the inputs below.
- Very specific: line 24
Dynamic (On-Demand): Only connect to a live database to run EXPLAIN or read actual index usage statistics if the user explicitly requests …
- Distinctive: line 40
B-Tree: Default for standard lookups, strings, and integers.
- Distinctive: line 63
CREATE INDEX CONCURRENTLY idx_orders_tenant_status_date ON orders (tenant_id, status, created_at DESC).
- Very specific: line 93
Zero-Downtime: ALWAYS recommend CREATE INDEX CONCURRENTLY in PostgreSQL to avoid locking the table taking down production operations.
- Very specific: line 94
High Cardinality Check: Only index where selectivity is high.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Index Advisor Protocol
This skill focuses on making database reads remarkably fast while minimizing write amplification and storage bloat. It recommends standard, composite, partial, and covering indexes based on actual or predicted query workload.
Core principle: Indexes are not free. Every index accelerates reads but slows down writes, inserts, and consumes disk space.
0. Context Intake
Before designing, make sure you have the inputs below. Read the previous workflow step's artifact first if it exists. Ask only for what is missing, in a single message, and state any assumption you make instead of blocking.
- The slow queries (text plus frequency) and ideally their
EXPLAIN ANALYZEoutput orquery-explainer-output.json. - Table sizes and write volume for the affected tables.
- Existing indexes (schema dump or
\d table).
1. Analysis Phase (Static vs. Dynamic)
- Default (Static): Analyze based on provided SQL queries, schema files, or output from
schema-architect. - Dynamic (On-Demand): Only connect to a live database to run
EXPLAINor read actual index usage statistics if the user explicitly requests it.
2. Optimization Methodology
The B-Tree Ordering Rule for Composites
For Composite Indexes, always apply the rule of Equality, Sort, Range:
- Equality: Fields used in
=orIN. - Sort: Fields used in
ORDER BY. - Range: Fields used in
>,<, orBETWEEN.
Example Query:
SELECT * FROM orders WHERE tenant_id = 5 AND status = 'active' ORDER BY created_at DESC LIMIT 10
Recommended Optimal Index: (tenant_id, status, created_at DESC)
Index Type Selection
Select the correct index type according to the target database engine:
- B-Tree: Default for standard lookups, strings, and integers.
- Partial/Filtered Indexes: Highly recommended for sparse data or booleans (e.g.,
WHERE status = 'pending'). - GIN / GiST: For full-text search, arrays, and geospatial data in PostgreSQL.
- BRIN: For large sequential time-series data chunks.
3. The "Drop" Recommendation
Optimization isn't just about adding new indexes. Identify candidates for removal:
- Redundant Indexes: An index on
(A)is entirely redundant and should be dropped if you just created an index on(A, B). - Unused Indexes: Flag non-system indexes with low usage rates.
4. Expected Output Structure
Outputs. In file mode — the user wants artifacts, or this skill runs as a step of an ecosystem workflow — write both files below to docs/database-report/. In inline mode — a quick question — answer in the chat and end with the JSON below as a Handoff block instead of creating files.
- Human-Readable Markdown (
docs/database-report/index-advisor-report.md)
### 🚀 Index Optimization Report
- **Query Addressed:** [Identify specific SQL query]
- **Applied Rule:** Equality, Sort, Range match.
- **Expected Impact:** Prevention of sequential scan of 1M rows.
#### 🌟 REQUIRED FIX
```sql
CREATE INDEX CONCURRENTLY idx_orders_tenant_status_date
ON orders (tenant_id, status, created_at DESC);
```
#### 🗑️ CLEANUP
```sql
DROP INDEX CONCURRENTLY idx_orders_tenant;
```- Machine-Readable JSON (
docs/database-report/index-advisor-output.json)
{
"skill": "index-advisor",
"recommended_indexes": [
{"table": "orders", "columns": ["tenant_id", "status", "created_at"], "type": "B-Tree", "action": "CREATE"}
],
"redundant_indexes": [
{"table": "orders", "index_name": "idx_orders_tenant", "action": "DROP"}
]
}When to Skip
- The table is tiny, the bottleneck is outside the database (network, N+1 in application), or no query is identified yet (run
@query-explainerfirst).
Guardrails
- Don't Over-Index: Warn the user if a single table acquires more than 5-7 indexes or if indexes combined overlap the table size.
- Zero-Downtime: ALWAYS recommend
CREATE INDEX CONCURRENTLYin PostgreSQL to avoid locking the table taking down production operations. - High Cardinality Check: Only index where selectivity is high; indexing a boolean col
(is_active)without a partial clause is an anti-pattern.
🔗 Next Steps & Handoffs
<!-- BEGIN GENERATED: handoffs (generated from the ecosystem workflow map by build_ecosystems.py — do not edit by hand) -->Ecosystem: @ecosystem-database — Database Domain.
Workflows:
- Performance Optimization Flow (
db-performance, step 2 of 3): next →@query-budget-enforcer(optional).
Direct handoffs:
@migration-strategist— Index creation needs a non-locking rollout on a large table.
Handoff contract: pass results to the next skill through docs/database-report/index-advisor-output.json with the fields skill, workflow, created_at, inputs, summary, and next (the handoff contract of @ecosystem-database). If a next skill is not installed, continue with its step from the ecosystem map, or install it with npx skills add fatih-developer/fth-skills --skill <name> after the user agrees.
<!-- END GENERATED: handoffs -->Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

