greglas75/zuvo/db-audit

Claude Code and agent skill by greglas75/zuvo

Trust tier 2
  • community
LLM review pending
Source check pending

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

SKILL.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.

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
ToolTriggerReasonSkip allowed?
sql_auditProject has any .sql file (migrations, schema, dumps) anywhere under TARGET_ROOTDB6/DB12/DB13 — bundles 5 gates (drift, orphan, lint, dml, complexity) that no manual scan reproducesNO — audit FAILS if skipped while trigger holds
analyze_schemaSame as sql_audit (.sql files exist)DB3 schema design — extracts tables/columns/FKs/relationships, generates ERD for executive summaryNO when .sql exists
diff_migrationsmigrations/ 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 gateNO when migrations exist
trace_queryAt least one HIGH/MEDIUM finding mentions a table OR sql_audit orphan gate flags any orphanDB3/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_columnsAlwaysDB12 PII discovery — find every email/password/ssn/token column across all tablesNO — always required
migration_lintPostgres detected (any of: pg, psycopg2, @prisma/adapter-pg, postgres-js in deps) AND migrations/ dir existsDB13 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_schemaprisma/schema.prisma existsDB2/DB3/DB6 Prisma-specific schema gates (FK index coverage %, unindexed FKs, soft-delete detection, status: String smell)NO when schema exists
explain_queryPrisma project AND any HIGH/MEDIUM finding cites a prisma.<model>.<call> queryDB1/DB2 Prisma-specific N+1 + missing-index detection via simulated EXPLAIN ANALYZE; finds risks sql_audit dml cannot seeNO when condition holds
python_auditLanguage detected as PythonDB1 N+1 detection (n-plus-one-django pattern), DB9 ORM anti-patternsNO when Python project
nest_auditFramework detected as NestJS (@nestjs/* in deps)DB1/DB4 NestJS DI + repository scoping issuesNO when NestJS project
analyze_django_settings + get_model_graphdjango in pyproject/requirementsDB6 Django migration safety, DB3 model graphNO when Django
scan_secretsAlwaysDB12 hardcoded credentials in code or .envNO — always required
search_patterns(pattern="unbounded-findmany") + search_patterns(pattern="await-in-loop") + search_patterns(pattern="toctou")AlwaysDB1/DB5 — these are the ONLY tool-verified gates for those patternsNO — always required
Pre-flight check (run BEFORE any phase)

Before Phase 0, verify the required tools are reachable:

# Detect triggers
sql_files=$(find TARGET_ROOT -name "*.sql" -not -path "*/node_modules/*" -not -path "*/.git/*" | head -1)
migrations_dir=$(find TARGET_ROOT -type d -name "migrations" -not -path "*/node_modules/*" | head -1)
prisma_schema=$([ -f TARGET_ROOT/prisma/schema.prisma ] && echo "yes" || echo "no")

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:

  1. In preloaded list already? (from codesift-setup.md Step 2.5 ToolSearch — the sql group is auto-included when .sql files exist.) → use it.
  2. 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).
  1. Reveal succeeded? (schema returned / tool now in list) → use it. This is the expected path for a CodeSift-backed session.
  2. Reveal genuinely failed — and only then ABORT. Genuine failure means ONE of:
  • the reveal mechanism itself is unavailable (ToolSearch/describe_tools not 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 INCOMPLETE and record the blocker Process 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", with T the fixed title db-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" in backlog-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:

  1. Write zuvo/audits/db-audit-<date>.md.
  2. Print Validity Gate block.
  3. Print Run line + append to runs.log.
  4. Load `../../shared/includes/retrospective.md` if not already loaded.
  5. Fill all 9 retrospective fields per protocol.
  6. Execute the bash append commands that write RETRO: line to ~/.zuvo/retros.log and the long-form entry to ~/.zuvo/retros.md.
  7. 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:

ValueForbidden whenRequired value instead
sql_audit: DEFERRED.sql files existsql_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: DEFERREDPostgres + migrations existmigration_lint: <findings>
scan_secrets: DEFERREDEVERscan_secrets: <count>
codesift: unavailablemcp__codesift__* was in deferred-tools session-start bannercodesift: deferred-not-preloaded (FAILURE: skill required preload)
retrospective: skippedEVERretrospective: appended (retros.log=N entries, retros.md=N bytes added) — see Required POSTAMBLE above
Stopping after Run line without retrospectiveEVERNot 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:

  1. Re-check each trigger condition.
  2. 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).
  3. If ANY required tool is missing for a held trigger:
  • Override the verdict to INCOMPLETE regardless of finding count.
  • Print: [VALIDITY GATE FAIL] <tool> required by <trigger>, not called. Audit cannot be trusted.
  • Record the incomplete Process 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", with T the fixed title db-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" in backlog-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's Backlog writes: line is printed, so its wrote= paths are on that line. The final Validity Gate files it only if this step did not (a postamble field that fails after the report is saved), and otherwise cites this call's F-id; that block carries the F-id on a line incomplete-item: <F-id> and, for a late call, its paths on a line Backlog 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

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
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/greglas75/zuvo/db-audit/badge)](https://verified-skill.com/skills/greglas75/zuvo/db-audit)

Something wrong with this skill or its page? Tell us.