Recommends database indexes by analyzing query patterns (filters, joins, ordering) and generates index definitions in the project's ORM format (EF Core, Prisma, TypeORM, Drizzle, SQLAlchemy, Django, JPA, GORM, or plain SQL).
Ships in AI for Developers Toolkit. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Find the indexes a schema is missing by looking at how it is queried, and emit the index definition (column order, includes, uniqueness, filter) in the project's own format - without over-indexing.
Works on a target: a file, folder, project/repo, or GitHub URL (clone first: git clone --depth 1 <url> /tmp/repo). Report which files you scanned and group recommendations by table.
| Manifest | Look for | Where indexes are declared |
|---|---|---|
*.csproj | Microsoft.EntityFrameworkCore.* | HasIndex(...) in OnModelCreating / IEntityTypeConfiguration<T>, or [Index] attribute |
package.json | prisma, typeorm, drizzle-orm, knex | @@index / @@unique in schema.prisma; @Index() on TypeORM entities; index() in Drizzle table config; Knex migrations |
pyproject.toml, requirements*.txt | sqlalchemy, alembic, django | Index(...) / index=True on Column; Django Meta.indexes / db_index=True |
pom.xml, build.gradle(.kts) | spring-boot-starter-data-jpa, flyway, liquibase | @Table(indexes = @Index(...)), but prefer Flyway/Liquibase SQL for production |
go.mod | gorm.io/gorm, golang-migrate, goose | GORM index / uniqueIndex struct tags, or SQL migrations |
Detect the database from the connection/provider (UseNpgsql, provider = "postgresql", postgresql+psycopg, jdbc:sqlserver, gorm.io/driver/mysql). Index features differ per engine - see the matrix below.
# .NET
grep -rn "\.Where(\|\.OrderBy\|\.Join(\|\.FirstOrDefault\|\.Single" --include=*.cs <target>
grep -rn "HasIndex\|IsUnique\|\[Index(" --include=*.cs <target>
# Node / TypeScript
grep -rn "where:\|orderBy:\|\.where(\|\.orderBy(" --include=*.ts <target> | grep -v node_modules
grep -rn "@@index\|@@unique\|@Index\|index(" <target>/prisma <target>/src
# Python
grep -rn "\.filter(\|\.filter_by(\|\.order_by(\|\.where(" --include=*.py <target>
grep -rn "Index(\|index=True\|db_index\|Meta.indexes\|indexes = \[" --include=*.py <target>
# Java / Kotlin
grep -rn "findBy\|@Query\|ORDER BY\|WHERE" <target>/src
grep -rn "@Index\|CREATE INDEX\|createIndex" <target>/src
# Go
grep -rn "\.Where(\|\.Order(\|WHERE\|ORDER BY" --include=*.go <target>
grep -rn "index:\|uniqueIndex\|CREATE INDEX" <target>
# Raw SQL migrations, any stack
grep -rni "create \(unique \)\?index" <target>
Focus on the hot paths: list endpoints, search, dashboards, background jobs, and foreign keys used in joins.
For each frequently-queried table, map predicates to an index:
AND equality filters - composite index (most common / most selective first).ORDER BY after a filter - append the sort column to the composite so the engine can skip the sort.INCLUDE on Postgres 11+ / SQL Server).WHERE deleted_at IS NULL, status = 'active') - partial / filtered index where the engine supports it.LIKE '%x%' - a B-tree won't help; suggest full-text or trigram (pg_trgm) and say so.LOWER(email)) - expression/computed index, or normalize the stored value.| Feature | PostgreSQL | SQL Server | MySQL / MariaDB | SQLite |
|---|---|---|---|---|
Covering (INCLUDE) | yes (11+) | yes | no (add columns to key) | no |
| Partial / filtered | WHERE ... | WHERE ... (filtered) | no | WHERE ... |
| Expression index | yes | via computed column | yes (8.0.13+ functional) | yes |
| Online build | CREATE INDEX CONCURRENTLY | WITH (ONLINE = ON) (edition-dependent) | InnoDB online DDL (ALGORITHM=INPLACE) | n/a |
modelBuilder.Entity<Order>()
.HasIndex(o => new { o.CustomerId, o.Status, o.CreatedAt }) // filter CustomerId+Status, sort CreatedAt
.HasDatabaseName("IX_Orders_Customer_Status_Created")
.IncludeProperties(o => o.Total); // covering (SQL Server / Npgsql)
modelBuilder.Entity<Order>()
.HasIndex(o => o.ExternalRef).IsUnique();
modelBuilder.Entity<Order>()
.HasIndex(o => o.Status).HasFilter("\"DeletedAt\" IS NULL"); // partial; SQL text is provider-specific
Verify with query.ToQueryString() plus the actual execution plan / EXPLAIN ANALYZE.
model Order {
// ...
@@index([customerId, status, createdAt])
@@unique([externalRef])
}
TypeORM: @Index(["customerId", "status", "createdAt"]) on the entity. Drizzle: index("ix_orders_cust_status_created").on(t.customerId, t.status, t.createdAt) in the table's extra config. For partial/INCLUDE/concurrent builds, hand-edit the generated SQL migration.
SQLAlchemy: Index("ix_orders_cust_status_created", Order.customer_id, Order.status, Order.created_at) in __table_args__; Postgres partial via postgresql_where=, covering via postgresql_include=. Alembic: op.create_index(..., postgresql_concurrently=True) inside an autocommit block. Django: Meta.indexes = [models.Index(fields=["customer", "status", "-created_at"], name="...", condition=Q(deleted_at__isnull=True), include=["total"])]; AddIndexConcurrently for Postgres.
@Table(indexes = @Index(name = "ix_orders_cust_status_created", columnList = "customer_id, status, created_at")) documents intent, but schema generation should not run in production - ship the index as a Flyway/Liquibase SQL migration.
GORM: gorm:"index:ix_orders_cust_status_created,priority:1" on each column (priority sets order), uniqueIndex for uniqueness. With golang-migrate/goose, write the CREATE INDEX SQL directly.
## Summary
<stack + ORM + database detected; headline recommendations>
## Recommended indexes
1. <table>(<cols>) [composite|unique|covering|partial] - serves <query at file:line> - <why this column order>
2. ...
## Index definitions
<code in the project's own format, ready to paste>
## Redundant / unused candidates
- <index> - covered by <composite> (verify usage stats before dropping)
## Verify on your side
- <EXPLAIN / execution plan to run; write-heavy tables where the cost matters>
EXPLAIN ANALYZE (Postgres), EXPLAIN (MySQL/SQLite), actual execution plan (SQL Server), and logging the generated SQL.db-migration-reviewer."What indexes does this project need?", "why is this query slow - missing index?", "design a composite index for filtering by customer+status and sorting by date", "add the Prisma indexes for these queries". Pairs with orm-query-optimizer and db-migration-reviewer.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
PostgreSQL, SQLite, MySQL, Prisma, Drizzle, SQLAlchemy, Django, TypeORM
/ai-dev-toolkit:db-index-advisorfrom AI for Developers Toolkit
npx claudepluginhub stefanthecode/ai-for-developers --plugin ai-dev-toolkit45 skills in this plugin
/api-endpoint-scaffolderScaffold HTTP API endpoints in any stack - ASP.NET Core Minimal APIs or controllers, Express, Fastify, NestJS, FastAPI, Django REST Framework, Spring Boot controllers, Go net/http, chi, Gin - one feature per endpoint (REPR style) with request validation, typed responses, route grouping, auth, and OpenAPI metadata. Use this skill whenever the user wants to add an endpoint or route, convert controllers to minimal APIs, structure routes or routers, set up endpoint groups, TypedResults, route handlers, request DTOs/schemas (zod, Pydantic, Bean Validation, binding tags), or asks "how do I add an endpoint / structure my API routes". Always use this skill for endpoint scaffolding; it generates a complete, validated endpoint that matches the project's conventions./architecture-test-generatorGenerate architecture tests / fitness functions that fail the build when architectural rules are violated - layer dependencies, module boundaries, cycles, naming, and visibility conventions - in any stack: NetArchTest or ArchUnitNET (.NET), ArchUnit or Konsist (Java/Kotlin), dependency-cruiser or eslint-plugin-boundaries (TypeScript/JavaScript), import-linter (Python), go-arch-lint or depguard (Go). Use this skill whenever the user wants architecture tests, to enforce layering or the dependency rule, dependency rules as tests, import rules, forbidden imports, no circular dependencies, naming conventions, fitness functions, or asks "how do I stop people breaking the architecture / enforce my layers / keep modules from importing each other". Always use this skill for architecture-test requests; it generates rules matching the project's real structure./async-await-auditorAudit async and concurrent code in any language for correctness and performance bugs - C#/.NET (async/await, Task), JavaScript/TypeScript (Promises, async/await), Python (asyncio), Java/Kotlin (CompletableFuture, virtual threads, coroutines), Go (goroutines, channels, context), Rust (tokio/async). Use this skill whenever the user shares async or concurrent code, or asks about deadlocks, hangs, blocking calls, .Result/.Wait(), async void, ConfigureAwait, floating or unhandled promises, await in a loop vs Promise.all, blocking the event loop, forgotten await, asyncio.gather/TaskGroup, CompletableFuture.join, virtual thread pinning, goroutine leaks, context cancellation, WaitGroup/errgroup, holding a lock across .await, fire-and-forget tasks, cancellation tokens, or "why does my async code hang". Always use this skill for async/concurrency reviews instead of answering from memory; it applies a fixed checklist and rewrites the code./authorization-setupDesign API authorization in any stack - policy-based, role-based, claims/permission-based, and resource-based (ownership) checks. Covers ASP.NET Core policies and AuthorizationHandler, NestJS guards, Express middleware and CASL, FastAPI dependencies/scopes, Django and DRF permission classes, Spring Security (@PreAuthorize, SecurityFilterChain), Go middleware, and Casbin/OPA. Use this skill whenever the user wants authorization policies, role/claim/permission checks, RBAC/ABAC, custom authorization rules, resource-based authorization, IDOR protection, "deny by default", or asks "how do I authorize this / policy vs role / restrict this endpoint to X / stop users seeing other users' data". Always use this skill for authorization requests; it generates policies, handlers, and endpoint wiring./benchmark-setupSet up correct micro-benchmarks in any stack and interpret the results - BenchmarkDotNet (.NET), JMH (Java/Kotlin), pytest-benchmark / pyperf (Python), Vitest bench / tinybench / mitata (JavaScript/TypeScript), Go testing.B + benchstat, Rust criterion. Use this skill whenever the user wants to benchmark code, measure performance, compare two implementations or functions, set up a benchmark harness, or asks "which is faster", "benchmark these two functions", "how do I benchmark this", "is this optimization worth it", or "interpret these benchmark results". Always use this skill for micro-benchmarking requests; it writes correct benchmarks, avoids the classic pitfalls, and explains the numbers./caching-strategy-setupAdd the right caching to an app in any stack - in-process, distributed (Redis/Valkey/Memcached), two-level, or HTTP/output caching - with correct keys, expiration, stampede protection, and invalidation. Covers HybridCache / IMemoryCache / IDistributedCache / output caching in .NET, lru-cache / keyv / cache-manager / ioredis in Node, functools / cachetools / redis-py / Django cache in Python, Spring Cache with Caffeine or Redis in Java/Kotlin, and ristretto / groupcache / singleflight / go-redis in Go. Use this skill whenever the user wants caching, to cache a query/response, Redis caching, @Cacheable, lru_cache, HybridCache, cache-aside, output caching, or asks "how do I cache this / add caching / avoid cache stampede / invalidate this cache". Always use this skill for caching requests; it picks the right layer and wires expiration + invalidation correctly.Other plugins' skills for the same job