audit-db-schema

audit-db-schema is a skill for Claude Code from kensaurus/cursor-kenji. It costs 55 tokens per session (4,149 once invoked), scanned A, original, MIT.

A database-schema review guide for checking how tables, fields, relationships, constraints, indexes, and migrations are designed.

In plain words
What is it for?
Use it to review schema naming, data types, foreign keys, validation rules, indexes, row-level security, and migration safety.
Why use it?
It helps prevent invalid data, slow lookups, broken migrations, and unauthorised access caused by weak database structure.

Skill for Claude Code

Written for Claude Code: effort in frontmatter.

Part of the cursor-kenji plugin — 132 skills, 63 commands, 6 agents, 1 hook, 3 MCP servers shipped together

Good fit Use it to review schema naming, data types, foreign keys, validation rules, indexes, row-level security, and migration safety.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/kensaurus/cursor-kenji/audit-db-schema
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add kensaurus/cursor-kenji --skill audit-db-schema
Clone the repo
git clone --depth 1 https://github.com/kensaurus/cursor-kenji

Made for: Claude Code.

Or install cursor-kenji, the plugin that ships this one along with the rest of its 132 skills, 63 commands, 6 agents, 1 hook, 3 MCP servers.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for audit-db-schema

README.md
[![agentmods](https://agentmods.dev/badge/skills/kensaurus/cursor-kenji/audit-db-schema/github.svg)](https://agentmods.dev/skills/kensaurus/cursor-kenji/audit-db-schema)
Your own site
<a href="https://agentmods.dev/skills/kensaurus/cursor-kenji/audit-db-schema"><img src="https://agentmods.dev/badge/skills/kensaurus/cursor-kenji/audit-db-schema/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for audit-db-schema

Your own site · 80×15
<a href="https://agentmods.dev/skills/kensaurus/cursor-kenji/audit-db-schema"><img src="https://agentmods.dev/badge/skills/kensaurus/cursor-kenji/audit-db-schema.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 55 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,149 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00055 $0.04149
Opus 5.5 $0.00022 $0.01660
Sonnet 5.5 $0.00011 $0.00830
Haiku 4.5 $0.00006 $0.00415

Measured 27d ago against content hash 5457dd5e0e21, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

audit-db-schema scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 27d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/audit-db-schema/SKILL.md · 466 lines

How it starts

The opening of the file, as written. The whole thing — 466 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Database Schema Audit Skill

Degree of freedom: MIXED — Steps 0, 1, 3 [HIGH freedom]; Steps 2 and 4 MCP/SQL probes [LOW freedom — run exactly] (run the query; do not invent a schema).

How to reason

  1. Observe — quote the column, constraint, advisor row, or query result
  2. Interpret — what fails at write-time, read-time, or migrate-time?
  3. Classify — naming / type / constraint / index / RLS / migration / correct
  4. Severity — missing FK/RLS on public data = P0; type/index drift = P1; naming = P2

Worked example

Observe: orders.user_id is nullable text, no FK, no index; rowsecurity = false. Interpret: orphan rows can insert; the client can SELECT every order; lookups seq-scan. Classify: constraint + index + RLS (not a naming nit). Severity: P0 — public table, no RLS, no FK. Finding: orders | RLS+FK | P0 | enable RLS + user_id uuid references users(id) + index.

Self-critique before reporting [LOW freedom — do not skip]

  1. Evidenced — query result or advisor URL, not "Postgres usually…"
  2. Reproducible — same SQL twice; do not cite a stale list_tables
  3. Severity justified — P0 = data loss, leak, or unconstrained money type
  4. Right owner — who-can-read-what → plan-rls-audit; DELETE/TRUNCATE → plan-data-integrity; RPO → plan-backup-dr
  5. No migrations applied — findings only

Step 0: Auto-Detect Database Environment

0a. Detect Database and ORM

Signal Technology
@supabase/supabase-js in package.json Supabase (Postgres)
prisma in devDependencies, prisma/schema.prisma Prisma ORM
drizzle-orm in dependencies, drizzle/ directory Drizzle ORM
sequelize in dependencies Sequelize ORM
sqlalchemy in requirements SQLAlchemy (Python)
supabase/migrations/*.sql directory Supabase migrations
prisma/migrations/ directory Prisma migrations
drizzle/migrations/ or drizzle/*.sql Drizzle migrations

Read the full file on GitHub · 466 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 27d ago Changed · -9 lines · -11 tokens per session 5457dd5e0e21
  2. 1mo ago First seen · 475 lines · 66 tokens per session scan A b07350c2cc2d

Subscribe to this mod's changes

audit-db-schema is a skill published in the GitHub repository kensaurus/cursor-kenji (9 stars, last pushed 22d ago), licensed MIT. It adds 55 tokens to every session and 4,149 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

create-migration

Create a new database migration following project naming and safety rules. Use when the user asks to add a migration or create a migration for a schema change.

girijashankarj/cursor-handbook · 34 tokens

opensearch

Workflow for OpenSearch (or Elasticsearch) usage: indexing, search, mappings, and tuning. Use when the user asks about OpenSearch/Elasticsearch.

girijashankarj/cursor-handbook · 35 tokens

data-integrity-auditor

Detects data integrity issues including orphaned records, broken foreign key relationships, constraint violations, and provides automated fix migrations. Use for "data integrity", "orphaned records", "broken relationships", or "data quality".

patricio0312rev/skills · 52 tokens

integration-test-builder

Creates integration tests for API endpoints with database flows, including test harness setup, fixtures, setup/teardown, database seeding, and CI-friendly strategies. Use for "integration testing", "API tests", "database tests", or "test harness".

patricio0312rev/skills · 54 tokens

data-retention-archiving-planner

Plans and implements data retention policies with archival strategies, compliance requirements, automated cleanup jobs, and cold storage migration. Use for "data retention", "data archival", "GDPR compliance", or "storage optimization".

patricio0312rev/skills · 51 tokens

data-seeding-fixtures-builder

Generates deterministic seed data for development and testing with factory functions, realistic fixtures, and database reset scripts. Use for "data seeding", "test fixtures", "database seeding", or "mock data generation".

patricio0312rev/skills · 50 tokens