SQL Schema Audit

Index coverage and N+1 review aids for SQLite/D1 schemas with a sqlc catalog. Surfaces unused indexes (with FK CASCADE awareness so cascade-load-bearing indexes are not flagged), queries that scan tables without index help, and `for`-loops calling generated SQL fns.

423 stars 6 forksDatabases

Install

skills CLI (Claude Code, Cursor, Codex and more)
npx skills add mizchi/skills --skill sql-schema-audit
Manual install
git clone --depth 1 https://github.com/mizchi/skills.git /tmp/skills
mkdir -p ~/.claude/skills
cp -r /tmp/skills/sql-schema-audit ~/.claude/skills/sql-schema-audit

Personal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.

From the SKILL.md

# SQL Schema Audit

Use this for two recurring DBA review tasks:

1. **Where is index work missing?** Walk every query plan and attribute each `SCAN <table>` to either a known intentional case (no covering index possible) or a gap (table has no indexes at all).
2. **Where might code N+1?** Find `for`-loops that call sqlc-generated functions — review aid, not a hard fail, because batch inserts are legitimate.

## index-coverage.mjs

```bash
# `scripts/` is relative to THIS skill's directory; from elsewhere use the
# absolute path. `--out` is OPTIONAL — omit it and the report prints to stdout.
# The printed report IS the deliverable; the file is just a persisted copy.
node scripts/index-coverage.mjs \
  --schema your-project/db/schema.sql \
  --queries your-project/db/queries.sql \
  [--out your-project/.linters/index-coverage.txt]
```

Output sections:

- **Per-query SCAN attribution**: each query that produces a `SCAN` step is listed with the SCAN's rationale. `FIX` marker means the table has no indexes at all (immediate work). No marker means the table has indexes but the planner chose to scan anyway — usually fine (small table, unusual WHERE shape).
- **Drop candidates**: indexes that no catalog query referenced via `SEARCH USING INDEX` *and* don't cover any FK CASCADE source column.
Read the full skill on GitHub

Details

Skill name
sql-schema-audit
Repository
mizchi/skills
Path
sql-schema-audit/SKILL.md
Repo updated
18 November 2026

FAQ

What does the SQL Schema Audit skill do?

Index coverage and N+1 review aids for SQLite/D1 schemas with a sqlc catalog. Surfaces unused indexes (with FK CASCADE awareness so cascade-load-bearing indexes are not flagged), queries that scan tables without index help, and `for`-loops calling generated SQL fns.

How do I install the SQL Schema Audit skill?

skills CLI (Claude Code, Cursor, Codex and more): npx skills add mizchi/skills --skill sql-schema-audit. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.

Is SQL Schema Audit popular?

It lives in mizchi/skills, which has 423 GitHub stars and 6 forks.

Related skills

Actions CI Tuning

423

mizchi/skills

Use when auditing or improving GitHub Actions workflows for a project. Covers cache setup (npm/pnpm/yarn), job parallelism, shard-based test splitting, artifact handling pitfalls, and Playwright-specific patterns. Trigger on: slow CI, cache miss, flaky shard jobs, merge-reports failures, or an explicit 'tune CI' request.

Testing & QA

AI Index

423

mizchi/skills

Method and tooling for measuring how AI-generated a piece of prose reads, in Japanese or English. Two layers — a deterministic lint for removable surface tells (scripts/slopscore.py, no API) and a judgment layer of typed probabilistic questions (Jev noul/score) for the tells that survive editing. Includes measured human/AI baselines, a gap-first calibration procedure, and labeled fixtures. Use when building or calibrating an AI-likeness score, or when a draft needs a defensible number rather than a vibe. For writing guidance use natural-writing-ja / natural-writing-en instead.

AI, LLMs & Agents

Apm Usage

423

mizchi/skills

Reference for APM manifests, installation, targeted updates, deployment paths and lockfiles. Invoke when the user explicitly asks about APM or apm.yml, or an unfamiliar APM command/error needs exact CLI details. Do not automatically invoke for every project that happens to have installed skills.

DevOps & Cloud

SQL Security

423

mizchi/skills

SQL injection screening for host code (MoonBit / TS / Rust) plus secretlint setup notes. Flags single-line template-literal or string-concat SQL builders, regardless of value source — the scanner is line-based and does NOT trace data flow, so a clean scan is not proof of safety (multi-line template literals are missed) and every hit needs a manual review or an explicit `// sql-security: ok` opt-out.

Databases

SQL Plan Audit

423

mizchi/skills

Run EXPLAIN QUERY PLAN against every query in a sqlc-style catalog and diff the plans against a baseline. Detects new full-table SCANs and TEMP B-TREE sort scans introduced by PRs. SQLite/D1-only today; engine extension noted below.

Databases

Sqlc Gen Moonbit Safety

423

mizchi/skills

Post-generation safety checks for sqlc-gen-moonbit + Cloudflare D1. Use when a MoonBit Worker uses sqlc-gen-moonbit and you need to gate against BigInt-bind hangs (D1 1101) and SQL placeholder mix.

Databases

Browse the most popular Claude skills, all databases skills, or write your own with the skills generator.