agentleFS
DataArtDataArt/artisyn-log-hub/.claude/skills/post-impl-check-indexes/SKILL.md

post-impl-check-indexes

Skill12 starsChanged 8 days agoMITView on GitHub

Post-implementation check: database index audit — missing indexes on foreign keys and frequently filtered columns.

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Default sort columns on list endpoints that always sort by the same field

    line 37

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

You are performing a database index audit of the schema changes introduced by a task.

Task: $ARGUMENTS

Locate the changed files (skip if the caller already provided them): read the task's impl-plan.md — glob docs/tasks/todo/$ARGUMENTS/impl-plan.md, fallback docs/tasks/done/$ARGUMENTS/impl-plan.md. Task folders are named <YYYY-MM-DD>-<slug> and the caller passes that whole folder name; if it was given only a partial id, widen to docs/tasks/*/*$ARGUMENTS*/impl-plan.md. (Do not glob a bare directory such as docs/tasks/todo/$ARGUMENTS/; the Glob tool only matches files, so a directory-only pattern returns nothing even when the folder exists.) Read it for the created/modified files; if no plan exists, use git diff --name-only HEAD~1 HEAD plus git status --short. Focus on:

  • Migration files — in this repo, server/drizzle/migrations/. Look for CREATE TABLE, ALTER TABLE, ADD COLUMN, existing CREATE INDEX statements.
  • Entity/model/schema files — column definitions, relation decorators, foreign key fields.
  • Repository/service files — WHERE, ORDER BY, JOIN ON conditions referencing specific columns.

Audit categories

Foreign Key Columns Without Indexes

  • Any foreign-key column (e.g., userId, repositoryId, sessionId) with no corresponding index in a migration
  • Note: PostgreSQL does NOT auto-create indexes on foreign keys (MySQL does)

Columns Used in WHERE Clauses Without Indexes

  • Columns referenced in WHERE conditions in repository queries that lack an index
  • Frequently queried filter columns (status, type, date ranges)

Columns Used in ORDER BY Without Indexes

  • ORDER BY columns lacking an index, especially combined with filtering (composite index may be needed)
  • Default sort columns on list endpoints that always sort by the same field

Composite Index Opportunities

  • Columns always queried together in the same WHERE clause — a composite index beats two separate ones
  • Columns appearing together in both WHERE and ORDER BY (covering index opportunity)

Redundant Indexes

  • Indexes that are a prefix subset of an existing composite index; duplicate indexes on the same column

Severity and reporting

  • HIGH: missing index on a foreign key or high-traffic filter column that will cause full table scans at scale
  • MEDIUM: missing index on a frequent ORDER BY or secondary filter column; suboptimal separate indexes where a composite fits
  • LOW: redundant/duplicate index adding write overhead; minor optimization on a low-traffic path

Report each finding as [SEVERITY] <file>:<line> — <description>, including the suggested index DDL or decorator (e.g. CREATE INDEX idx_logs_session_id ON logs(session_id);), then a one-line count summary. If none: No index issues found.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.