db-audit

db-audit is a skill for Claude Code, Codex from greglas75/zuvo. It costs 115 tokens per session (16,373 once invoked), scanned A, original, MIT.

A database safety and performance audit that examines application code, database structure, and—when available—live query plans across common database tools and ORMs.

In plain words
What is it for?
Use it before releases, after adding models or queries, when response times increase, after scaling problems, or during regular database health checks.
Why use it?
It finds slow queries, missing indexes, unsafe transactions or migrations, connection problems, ORM mistakes, security issues, and data-lifecycle risks before they become incidents.

Skill for Claude CodeCodex

Part of the zuvo plugin — 34 skills, 21 agents, 5 hooks shipped together

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.

agentmods
npx agentmods add skills/greglas75/zuvo/db-audit
Any agent
npx skills add greglas75/zuvo --skill db-audit
Clone the repo
git clone --depth 1 https://github.com/greglas75/zuvo

Made for: Claude Code, Codex.

Or install zuvo, the plugin that ships this one along with the rest of its 34 skills, 21 agents, 5 hooks.

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 db-audit

README.md
[![agentmods](https://agentmods.dev/badge/skills/greglas75/zuvo/db-audit.svg)](https://agentmods.dev/skills/greglas75/zuvo/db-audit)
Your own site
<a href="https://agentmods.dev/skills/greglas75/zuvo/db-audit"><img src="https://agentmods.dev/badge/skills/greglas75/zuvo/db-audit.svg" alt="Measured on agentmods" height="20"></a>
Per session 115 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 16,373 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
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 $0.00115 $0.16373
Opus 5 $0.00057 $0.08186
Sonnet 5 $0.00023 $0.03275
Haiku 4.5 $0.00012 $0.01637

Measured 4d ago against content hash b7a0bd4435f7, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

db-audit scanned grade A with 1 finding 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 4d 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.

Reads agent configuration directorieslowAgent snooping

.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.

**Worktree de-pollution (do this before ANY file/table/migration count).** If the repo has git worktrees checked out under the tree (`.worktrees/`, `.claude/worktrees/`, `worktrees/`), every `.sql`/migration/model file i

Downgraded: this mod is about security review, or the phrase is quoted, so it is likely naming the pattern rather than instructing it.

skills/db-audit/SKILL.md · 1,160 lines

How it starts

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

zuvo:db-audit

Audit database interactions from code patterns through schema design to live query plans. Produces a scored report with specific, actionable fixes ranked by impact and effort.

When to use: Before releases, after adding models or queries, when latency increases, after scaling incidents, periodic health check. When NOT to use: Code quality (zuvo:review), full-stack performance (zuvo:performance-audit), security-only (/security-audit).

Mandatory File Loading

Read every file below before starting. Print the checklist.

CORE FILES LOADED:
  1. ../../shared/includes/codesift-setup.md      -- [READ | MISSING -> STOP]
  2. ../../shared/includes/env-compat.md           -- [READ | MISSING -> STOP]
  3. ../../shared/includes/run-logger.md           -- [READ | MISSING -> STOP]

Deferred (lazy load):

DEFERRED FILES (read only when needed):
  - ../../shared/includes/retrospective.md  -- read right before Phase 6 (saves ~3K tokens during audit)

Note: cq-patterns.md is NOT loaded — this is a read-only audit, not a code quality review. Loading it wastes ~7K tokens per turn.

If any CORE file is MISSING, STOP. Do not proceed from memory.


MANDATORY TOOL CALLS — Audit Validity Gate

This audit is INVALID if any of the tools below are skipped when their trigger condition holds. "DEFERRED", "N/A", "no diff vs prior audit" are NOT valid reasons. The presence of trigger artifacts (migrations directory, .sql files, ORM schema, etc.) is what dictates the call — not whether they changed since the last audit.

Required tool list

Tool Trigger Reason Skip allowed?
sql_audit Project has any .sql file (migrations, schema, dumps) anywhere under TARGET_ROOT DB6/DB12/DB13 — bundles 5 gates (drift, orphan, lint, dml, complexity) that no manual scan reproduces NO — audit FAILS if skipped while trigger holds
analyze_schema Same as sql_audit (.sql files exist) DB3 schema design — extracts tables/columns/FKs/relationships, generates ERD for executive summary NO when .sql exists
diff_migrations migrations/ dir exists (any ORM/framework) DB6/DB13 deployment safety — classifies every op as additive/modifying/destructive with risk ranking; surfaces destructive ops missed by sql_audit lint gate NO when migrations exist
trace_query At least one HIGH/MEDIUM finding mentions a table OR sql_audit orphan gate flags any orphan DB3/DB13 verification — confirms zero references for "orphan" claim and traces every cited table across DDL/DML/FK/ORM (Prisma + Drizzle) NO when condition holds
search_columns Always DB12 PII discovery — find every email/password/ssn/token column across all tables NO — always required
migration_lint Postgres detected (any of: pg, psycopg2, @prisma/adapter-pg, postgres-js in deps) AND migrations/ dir exists DB13 migration deployment safety (squawk: 30+ PG-specific patterns including NOT NULL without default, CREATE INDEX without CONCURRENTLY, etc.) NO when both conditions hold
analyze_prisma_schema prisma/schema.prisma exists DB2/DB3/DB6 Prisma-specific schema gates (FK index coverage %, unindexed FKs, soft-delete detection, status: String smell) NO when schema exists
explain_query Prisma project AND any HIGH/MEDIUM finding cites a prisma.<model>.<call> query DB1/DB2 Prisma-specific N+1 + missing-index detection via simulated EXPLAIN ANALYZE; finds risks sql_audit dml cannot see NO when condition holds
python_audit Language detected as Python DB1 N+1 detection (n-plus-one-django pattern), DB9 ORM anti-patterns NO when Python project
nest_audit Framework detected as NestJS (@nestjs/* in deps) DB1/DB4 NestJS DI + repository scoping issues NO when NestJS project
analyze_django_settings + get_model_graph django in pyproject/requirements DB6 Django migration safety, DB3 model graph NO when Django
scan_secrets Always DB12 hardcoded credentials in code or .env NO — always required
search_patterns(pattern="unbounded-findmany") + search_patterns(pattern="await-in-loop") + search_patterns(pattern="toctou") Always DB1/DB5 — these are the ONLY tool-verified gates for those patterns NO — always required

Read the full file on GitHub · 1,160 lines

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. 4d ago First seen · 1,160 lines · 115 tokens per session scan A b7a0bd4435f7

Subscribe to this mod's changes

db-audit is a skill published in the GitHub repository greglas75/zuvo (6 stars, last pushed today), licensed MIT. It adds 115 tokens to every session and 16,373 once invoked, about $0.0006 per session on Opus 5. A static security scan graded it A with 1 finding (reads agent configuration directories). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

postgres-database-migration

Use this skill for planning, testing, and safely executing PostgreSQL schema migrations — especially when working with production data or shared databases. Trigger when user asks to: Test a schema migration before applying it to production Add, remove, or rename columns safely on a live table Change a column's data…

timescale/pg-aiguide · 222 tokens

setup-timescaledb-hypertables

Use this skill when creating database schemas or tables for Timescale, TimescaleDB, TigerData, or Tiger Cloud, especially for time-series, IoT, metrics, events, or log data. Use this to improve the performance of any insert-heavy table. Trigger when user asks to: Create or design SQL schemas/tables AND…

timescale/pg-aiguide · 219 tokens

migrate-postgres-tables-to-hypertables

Use this skill to migrate identified PostgreSQL tables to Timescale/TimescaleDB hypertables with optimal configuration and validation. Trigger when user asks to: Migrate or convert PostgreSQL tables to hypertables Execute hypertable migration with minimal downtime Plan blue-green migration for large tables Validate…

timescale/pg-aiguide · 181 tokens

pgvector-semantic-search

Use this skill for setting up vector similarity search with pgvector for AI/ML embeddings, RAG applications, or semantic search. Trigger when user asks to: Store or search vector embeddings in PostgreSQL Set up semantic search, similarity search, or nearest neighbor search Create HNSW or IVFFlat indexes for vectors…

timescale/pg-aiguide · 190 tokens

find-hypertable-candidates

Use this skill to analyze an existing PostgreSQL database and identify which tables should be converted to Timescale/TimescaleDB hypertables. Trigger when user asks to: Analyze database tables for hypertable conversion potential Identify time-series or event tables in an existing schema Evaluate if a table would…

timescale/pg-aiguide · 184 tokens

postgres-hybrid-text-search

Use this skill to implement hybrid search combining BM25 keyword search with semantic vector search using Reciprocal Rank Fusion (RRF). Trigger when user asks to: Combine keyword and semantic search Implement hybrid search or multi-modal retrieval Use BM25/pgtextsearch with pgvector together Implement RRF (Reciprocal…

timescale/pg-aiguide · 162 tokens