greglas75/zuvo/db-audit
Claude Code and agent skill by greglas75/zuvo
- community
Checking that the SKILL.md file is still in the repository.
Database performance and safety audit. 70+ checks across 13 dimensions (DB1-DB13): query patterns, indexes, schema design, connections, transactions, migrations, caching, query optimization, ORM anti-patterns, observability, data lifecycle, DB security, and migration deployment safety. Code-level checks for all ORMs. Optional live analysis via PostgreSQL or MySQL connection. Switches: zuvo:db-audit full | [path] | [file] | --schema | --queries | --connections | --live <conn>
Install
npx vskill@latest install greglas75/zuvo/db-auditSKILL.md
The same SKILL.md was published earlier as greglas75/zuvo/db-audit.
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.
Deferred (lazy load):
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 |
Pre-flight check (run BEFORE any phase)
Before Phase 0, verify the required tools are reachable:
For each trigger that holds, the matching tool MUST be reachable before Phase 1.
Do NOT treat absence from the session-start deferred-tools banner as "unreachable." The CodeSift SQL toolchain (sql_audit, analyze_schema, diff_migrations, trace_query, search_columns, analyze_prisma_schema, migration_lint, explain_query) is non-core (is_core: false) — these tools are never in the banner, yet are reachable on demand. The banner lists only deferred-but-known schemas; CodeSift's ~95 hidden tools sit behind a reveal step and will never appear there. Aborting on "not in banner" is a false alarm and is what forced prior runs into unnecessary degraded mode.
For each held trigger, resolve the tool in this order — abort ONLY at the last step:
- In preloaded list already? (from
codesift-setup.mdStep 2.5 ToolSearch — thesqlgroup is auto-included when.sqlfiles exist.) → use it. - Not preloaded? Attempt to reveal it before concluding anything:
- Claude Code:
ToolSearch(query="select:mcp__codesift__<tool>")(or re-run Step 2.5 preload with the full union). - Codex/other CodeSift hosts:
describe_tools(names=["<tool>"], reveal=true).
- Reveal succeeded? (schema returned / tool now in list) → use it. This is the expected path for a CodeSift-backed session.
- Reveal genuinely failed — and only then ABORT. Genuine failure means ONE of:
- the reveal mechanism itself is unavailable (
ToolSearch/describe_toolsnot present — i.e. CodeSift not connected at all), or - the reveal call confirms the tool does not exist in this CodeSift version (e.g. CodeSift older than v0.4.x for
sql_audit).
On genuine failure:
- Print
[ABORT] Required tool '<name>' not reachable after reveal attempt. db-audit cannot produce a valid report without it. - Do NOT proceed with grep fallback. The audit is incomplete by definition.
- Exit with status
INCOMPLETEand record theblockerProcess item (../../shared/includes/backlog-protocol.md"Filing from a skill"):~/.zuvo/backlog-add --repo "$R" --class PROCESS --conf 90 --source db-audit --target subject:db-audit-blocker --title "$T", withTthe fixed titledb-audit INCOMPLETE: a required tool is not reachable, the same words on every run, no date and no tool name; the tool and the project go in the report, never in the title. Assign "$R" and "$T" before the call, as "Free text goes through a variable" inbacklog-protocol.md"Filing from a skill" says; an empty value is a bug, and backlog-add refuses a missing required field (REFUSED missing-field:<f>). It is kept in the findings ledger, not ticketed; name its F-id in the report.
Required POSTAMBLE — retrospective append (NOT optional)
After the audit report is written and the Run line is appended, the audit is NOT complete until the retrospective protocol has appended an entry to BOTH ~/.zuvo/retros.log AND ~/.zuvo/retros.md. Reaching the Run line is not the end of the skill — it is the midpoint between findings-output and process-feedback.
This is the failure mode the 2026-04-09 → 2026-05-04 db-audit history shows: 11 db-audit runs, 0 retrospective entries written. Every prior run reached the Run line, declared "task done", and skipped retrospective.md entirely. The skipped retros lost ~11 sessions of skill feedback that would otherwise have caught the very issues this MANDATORY section now enforces.
Hard requirement, in this order, before considering db-audit complete:
- Write
zuvo/audits/db-audit-<date>.md. - Print Validity Gate block.
- Print Run line + append to runs.log.
- Load `../../shared/includes/retrospective.md` if not already loaded.
- Fill all 9 retrospective fields per protocol.
- Execute the bash append commands that write
RETRO:line to~/.zuvo/retros.logand the long-form entry to~/.zuvo/retros.md. - Print confirmation:
RETRO_APPENDED: retros.log=YES retros.md=YES (verified).
If you reach step 3 and stop — the audit is INVALID regardless of finding count. The Validity Gate's gate_status flips to FAIL — retrospective not appended and the verdict is overridden to INCOMPLETE.
Forbidden escape hatches
The following telemetry values are forbidden when the trigger condition holds:
| Value | Forbidden when | Required value instead | |
|---|---|---|---|
sql_audit: DEFERRED | .sql files exist | sql_audit: <gates_passed>/<gates_run> | |
sql_audit: N/A | .sql files exist | (same as above) | |
sql_audit: skipped (no diff vs prior) | EVER | (same as above — trigger is presence, not delta) | |
migration_lint: DEFERRED | Postgres + migrations exist | migration_lint: <findings> | |
scan_secrets: DEFERRED | EVER | scan_secrets: <count> | |
codesift: unavailable | mcp__codesift__* was in deferred-tools session-start banner | codesift: deferred-not-preloaded (FAILURE: skill required preload) | |
retrospective: skipped | EVER | retrospective: appended (retros.log=N entries, retros.md=N bytes added) — see Required POSTAMBLE above | |
| Stopping after Run line without retrospective | EVER | Not allowed — the Validity Gate catches this and overrides to INCOMPLETE |
Audit completion verification (run BEFORE writing PASS/WARN/FAIL status)
At the end of the audit, before emitting the status block:
- Re-check each trigger condition.
- For each held trigger, verify the corresponding tool was actually called in this session (the LLM must self-report honestly — there is no automated post-execution gate yet, so use the run log as ground truth).
- If ANY required tool is missing for a held trigger:
- Override the verdict to
INCOMPLETEregardless of finding count. - Print:
[VALIDITY GATE FAIL] <tool> required by <trigger>, not called. Audit cannot be trusted. - Record the
incompleteProcess item (../../shared/includes/backlog-protocol.md"Filing from a skill"):~/.zuvo/backlog-add --repo "$R" --class PROCESS --conf 90 --source db-audit --target subject:db-audit-incomplete --title "$T", withTthe fixed titledb-audit run INCOMPLETE: validity gate failed, the same words on every run and no date; the missing tool goes in the report, never in the title. Assign "$R" and "$T" before the call, as "Free text goes through a variable" inbacklog-protocol.md"Filing from a skill" says; an empty value is a bug, and backlog-add refuses a missing required field (REFUSED missing-field:<f>). It is kept in the findings ledger, not ticketed. File it once per run, here, before the report'sBacklog writes:line is printed, so itswrote=paths are on that line. The final Validity Gate files it only if this step did not (apostamblefield that fails after the report is saved), and otherwise cites this call's F-id; that block carries the F-id on a lineincomplete-item: <F-id>and, for a late call, its paths on a lineBacklog writes (gate): <path>, … | none.
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/db-audit/SKILL.md
Popularity
- Repository stars
- 8
- 7-day trend score
- 11
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/greglas75/zuvo/db-audit)