Skip to content
Back to skills

Add Index

ASecurity

Proposes an index for one slow query with plan evidence and the write cost, then creates it safely only when you approve.

  • 3 stars
  • 0 votes
  • 0 copies
  • 4 views
  • Added November 15, 2026
ai-agentssqldatabase

Security analysis

A100/100

Scanned November 15, 2026

npx -y skills add workspace-templates/ai-agent-templates --skill add-index --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Add Index?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Add Index
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/workspace-templates-add-index/badge)](https://www.skillsdirectory.com/skills/workspace-templates-add-index)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: add-index
description: Proposes an index for one slow query with plan evidence and the write cost, then creates it safely only when you approve.
argument-hint: "[slow query or file:line]"
user-invocable: true
disable-model-invocation: true
---

Propose an index for this slow query: $ARGUMENTS (SQL, or a file and line).

1. Read the query, the table definition and every existing index on the table. Note row counts if known.
2. Get the plan with `EXPLAIN` (read-only connection, never `EXPLAIN ANALYZE` on a write). If no database is reachable, reason from the schema and say the plan is predicted.
3. Choose the index: equality columns first, then range or sort columns; add INCLUDE or a partial WHERE only when it clearly pays. Check whether an existing index can be extended instead of adding a new one.
4. State the evidence (scan type, rows, cost) and the price: extra disk, write overhead on INSERT and UPDATE, and which other queries it also helps.
5. Write the migration in the project's tool with a non-blocking build (`CREATE INDEX CONCURRENTLY` on Postgres) and a drop in the down step.
6. Do not create anything yet.

Show the proposal and ask: "Add this migration?" After a yes, create the file and give the command to verify the new plan.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.