agent-instructions
Use when writing project instructions for a coding agent (CLAUDE.md, AGENTS.md, or equivalent). Covers what belongs in them, what does not, structure, and…
Use when writing or optimizing SQL. Covers query planning, indexing strategy, window functions, CTEs, transaction isolation, and reading EXPLAIN output.
$ npx -y skills add nimadorostkar/Claude-Skills-collection --skill sql --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/sqlContext preview
The summary Claude sees to decide when to auto-load this skill.
Use when writing or optimizing SQL. Covers query planning, indexing strategy, window functions, CTEs, transaction isolation, and reading EXPLAIN output.
name: sql description: Use when writing or optimizing SQL. Covers query planning, indexing strategy, window functions, CTEs, transaction isolation, and reading EXPLAIN output. metadata: category: languages version: 1.0.0 tags: [sql, query-optimization, indexing, explain, transactions]
Write SQL that the planner can execute efficiently, and read execution plans well enough to know why it did not.
1. **Get the plan** — `EXPLAIN (ANALYZE, BUFFERS)`. Never optimize a query you have not profiled. 2. **Find the expensive node** — Look for sequential scans on large tables, nested loops with high row counts, and estimates that diverge from actuals by an order of magnitude. 3. **Fix the cause** — Bad estimate means stale statistics. Sequential scan on a selective filter means a missing index. High row counts through a join means the filter is applied too late. 4. **Index deliberately** — Column order in a composite index is equality columns first, then the range or sort column. 5. **Re-measure** — Confirm with a fresh plan, and check that write throughput did not regress.
**Window function instead of a correlated subquery:**
-- Latest order per customer, one pass.
SELECT customer_id, order_id, placed_at, total_cents
FROM (
SELECT
o.customer_id,
o.id AS order_id,
o.placed_at,
o.total_cents,
ROW_NUMBER() OVER (
PARTITION BY o.customer_id
ORDER BY o.placed_at DESC
) AS rn
FROM orders o
WHERE o.placed_at >= now() - interval '90 days'
) ranked
WHERE rn = 1;**Index matching the access pattern:**
-- Query: WHERE tenant_id = $1 AND status = 'open' ORDER BY created_at DESC LIMIT 50 CREATE INDEX CONCURRENTLY idx_tickets_tenant_open_recent ON tickets (tenant_id, status, created_at DESC) WHERE deleted_at IS NULL;
A curated library of 137 production-grade skills for Claude and other AI coding agents. Every skill follows one structure, speaks with one voice, and earns its place by changing what the agent does.
Repo: nimadorostkar/Claude-Skills-collection
Use when writing project instructions for a coding agent (CLAUDE.md, AGENTS.md, or equivalent). Covers what belongs in them, what does not, structure, and…
Use when an agent needs state that survives a session or a context compaction. Covers what to persist, file-based memory, structuring notes for retrieval, and…
Use when automating agent behavior with lifecycle hooks. Covers hook events, deterministic enforcement of rules the model should not be trusted to remember,…
Use when packaging skills, commands, hooks, and MCP servers into a distributable plugin. Covers manifest structure, bundling, versioning, testing, and…
Use when writing a new skill for an AI agent. Covers scoping, description writing for reliable triggering, progressive disclosure, and the difference between a…
Use when reviewing or improving an existing agent skill. Covers triggering accuracy, content quality, redundancy with the base model, and measuring whether the…