skills/query-explainer/SKILL.md
Translates execution plans (EXPLAIN ANALYZE) into human-readable language. Explains why Seq Scan is bad and when Hash Join is optimal.
npx skillsauth add fatih-developer/fth-skills query-explainerInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This skill bridges the gap between raw database optimizer output and human-readable performance tuning. It reads EXPLAIN (ANALYZE, BUFFERS) and translates the nodes and costs into concrete actions.
Core assumption: A developer should not need to be a DBA to understand why their query takes 3 seconds and what to do about it.
EXPLAIN (ANALYZE, BUFFERS) directly if the user explicitly authorizes it and provides the target query.cost=0.00..10.00) and reality (actual time=0.015..0.020).rows=1000000 (estimated) and loops=1 actual rows fetched (this indicates bad statistics).Highlight the most expensive parts of the query:
work_mem and had to sort on disk. This is a critical performance killer.shared read blocks compared to shared hit (buffers).Provide an intuitive breakdown of the issue.
Required Outputs (Must write BOTH to docs/database-report/):
docs/database-report/query-explainer-report.md)### 📊 Plan Summary
- **Total Execution Time:** 2350.45 ms
- **Biggest Bottleneck:** `Seq Scan` on the `orders` table (took 2100 ms, 89% of the time).
### 🔍 What the Database Actually Did
1. It scanned **every single row** (1.5 million rows) in the `orders` table to find records where `status = 'pending'`.
2. It then joined these results with the `users` table. Because there was no index to help sort them, it had to sort them in memory (`Sort Method: external merge disk`).
### 💡 How to Fix It
**Action 1: Add a Missing Index**
The planner is begging for an index on `status`. Wait, run `index-advisor` to be sure, but here is a quick fix:
`CREATE INDEX CONCURRENTLY idx_orders_status ON orders(status) WHERE status = 'pending';`
**Action 2: Increase work_mem (Optional)**
If this is a data-warehouse query, the sort spilled to disk because it needed 45MB of memory but only had 4MB. Temporarily increasing `work_mem` for the session might help.
docs/database-report/query-explainer-output.json){
"skill": "query-explainer",
"execution_time_ms": 2350.45,
"bottlenecks": [
{"type": "Seq Scan", "table": "orders", "cost_pct": 89, "reason": "Missing index on status"}
],
"recommendations": [
{"type": "ADD_INDEX", "sql": "CREATE INDEX ..."}
]
}
ANALYZE table_name; before blindly creating an index.index-advisor skill.tools
Create, optimize, critique, and structure prompts for AI systems. Use this skill whenever the user is designing or improving a prompt, system prompt, coding prompt, image prompt, evaluation rubric, agent prompt, workflow prompt, or MCP-oriented prompt package. Also use it when the user asks to turn vague AI behavior into a precise instruction set, tool policy, agent spec, or prompt architecture.
testing
Assumption-first architecture review skill to stress-test project plans and expose hidden risks.
testing
Enforce and manage DESIGN.md specifications, extract design systems from URLs, and combine design reasoning with token roles to prevent drift.
testing
Forces the agent to act with a Claude-like product mindset, prioritizing user journey, UX states, and visual quality before coding.