db-auditor

db-auditor is an agent for Claude Code from undeadlist/claude-code-agents. It costs 21 tokens per session (1,078 once invoked), scanned A, original, MIT.

A database review that checks how your application stores and retrieves data, including table structure, queries, indexes, connections, migrations, and ORM usage.

In plain words
What is it for?
Use it to inspect database code and produce an audit of query patterns, schema design, connection pooling, migrations, and model definitions.
Why use it?
It helps find slow queries, unsafe schema changes, connection problems, and correctness issues before they affect users or production data.

Agent for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: model in frontmatter.

Part of the claude-code-agents plugin — 6 skills, 24 agents shipped together

Good fit Use it to inspect database code and produce an audit of query patterns, schema design, connection pooling, migrations, and model definitions.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/undeadlist/claude-code-agents/db-auditor
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.

Clone the repo
git clone --depth 1 https://github.com/undeadlist/claude-code-agents

Made for: Claude Code.

Or install claude-code-agents, the plugin that ships this one along with the rest of its 6 skills, 24 agents.

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

README.md
[![agentmods](https://agentmods.dev/badge/agents/undeadlist/claude-code-agents/db-auditor/github.svg)](https://agentmods.dev/agents/undeadlist/claude-code-agents/db-auditor)
Your own site
<a href="https://agentmods.dev/agents/undeadlist/claude-code-agents/db-auditor"><img src="https://agentmods.dev/badge/agents/undeadlist/claude-code-agents/db-auditor/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 db-auditor

Your own site · 80×15
<a href="https://agentmods.dev/agents/undeadlist/claude-code-agents/db-auditor"><img src="https://agentmods.dev/badge/agents/undeadlist/claude-code-agents/db-auditor.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 21 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,078 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.
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.00021 $0.01078
Opus 5.5 $0.00008 $0.00431
Sonnet 5.5 $0.00004 $0.00216
Haiku 4.5 $0.00002 $0.00108

Measured 1mo ago against content hash c61d0932391f, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

db-auditor 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 1mo 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.

agents/db-auditor.md · 162 lines

How it starts

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

Database Audit

Analyze database layer for performance and correctness issues. Output to .claude/audits/AUDIT_DB.md.

Check

Query Patterns

  • N+1 queries (loops with individual fetches)
  • Unbounded fetches (no LIMIT, no pagination)
  • SELECT * instead of specific columns
  • Missing WHERE clauses on large tables
  • Queries inside loops

Schema Issues

  • Missing indexes on frequently queried columns
  • Missing foreign key constraints
  • No cascade rules defined
  • Inconsistent naming conventions
  • Missing timestamps (created_at, updated_at)

Connection & Pooling

  • Connection pool configuration
  • Connection leaks (connections not released)
  • Missing connection timeouts
  • No retry logic for transient failures

Migrations

  • Unsafe migrations (data loss potential)
  • Missing down migrations
  • Schema drift between environments
  • Large table alterations without planning

ORM Usage

  • Eager loading not configured (N+1 source)
  • Raw queries with string interpolation (SQL injection)
  • Missing transaction boundaries
  • Inconsistent model definitions

Grep

# N+1 patterns - queries in loops
grep -rn "for.*await.*find\|forEach.*await.*query" src --include="*.ts"

# Unbounded fetches
grep -rn "findMany()\|find({})\|SELECT \*" src --include="*.ts"

# Raw queries (potential injection)
grep -rn "\$queryRaw\|\$executeRaw\|\.query(" src --include="*.ts"

# Missing indexes - check schema
grep -rn "@index\|@@index\|createIndex" prisma --include="*.prisma"

# Connection pool settings
grep -rn "pool\|connectionLimit\|max_connections" . --include="*.ts" --include="*.env*"

Output

# Database Audit

## Summary
| Category | Critical | High | Medium | Low |
|----------|----------|------|--------|-----|
| Queries | X | X | X | X |
| Schema | X | X | X | X |
| Connections | X | X | X | X |
| Migrations | X | X | X | X |

**Database:** [Detected DB type]
**ORM:** [Prisma/Drizzle/TypeORM/etc.]

## Critical

### DB-001: N+1 Query in User Loading
**File:** `src/api/users.ts:45`
**Issue:** Fetching related data inside loop
```typescript
// Current - N+1 problem
for (const user of users) {
  const posts = await prisma.post.findMany({ where: { userId: user.id } });
}

Impact: O(n) queries instead of O(1). 100 users = 101 queries. Fix:

// Use include for eager loading
const users = await prisma.user.findMany({
  include: { posts: true }
});

DB-002: Unbounded Query on Large Table

File: src/api/products.ts:23 Issue: No LIMIT on product listing

const products = await prisma.product.findMany();

Impact: Memory exhaustion with large datasets Fix:

const products = await prisma.product.findMany({
  take: 100,
  skip: page * 100
});

High

DB-003: Missing Index on Frequently Queried Column

File: prisma/schema.prisma Issue: email column queried often but not indexed Impact: Full table scan on every login Fix:

model User {
  email String @unique
  @@index([email])
}

DB-004: Raw Query with String Interpolation

File: src/lib/search.ts:67 Issue: SQL injection vulnerability

const results = await prisma.$queryRaw`SELECT * FROM users WHERE name LIKE '%${search}%'`;

Fix: Use parameterized queries

Medium

DB-005: No Connection Pool Configuration

File: prisma/schema.prisma Issue: Using default pool settings Impact: Connection exhaustion under load Fix: Configure connection_limit in DATABASE_URL

DB-006: Missing Transaction on Related Writes

File: src/api/orders.ts:89 Issue: Order and OrderItems created without transaction Impact: Partial writes on failure Fix: Wrap in prisma.$transaction()

Recommendations

  1. Add indexes for all columns used in WHERE clauses
  2. Enable query logging in development to catch N+1
  3. Set connection pool limits appropriate for your hosting
  4. Add pagination to all list endpoints
  5. Use transactions for multi-table writes

Read the full file on GitHub · 162 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. 1mo ago First seen · 162 lines · 21 tokens per session scan A c61d0932391f

Subscribe to this mod's changes

db-auditor is an agent published in the GitHub repository undeadlist/claude-code-agents (149 stars, last pushed 4mo ago), licensed MIT. It adds 21 tokens to every session and 1,078 once invoked, about $0.0001 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-08-30.

Related

Other agents, from other repositories

review-triager

Triage GitHub PR review threads into an action plan and administer threads (reply/react/resolve) with an implementer’s pragmatism. Use when a PR has review comments that need deciding: address now, defer, out-of-scope, or already fixed.

prisma/orm · 0 tokens

review-implementer

Implements a PR’s review action list, commits in small logical steps, and resolves GitHub review threads with “Done” replies when finished. Use when review-actions.md exists for a PR.

prisma/orm · 44 tokens

core-data-auditor

Use this agent when the user mentions Core Data review, schema migration, production crashes, or data safety checking.

CharlesWiltgen/Axiom · 28 tokens

database-reviewer

Use when reviewing schema changes, migrations, indexes, or query patterns — verifies reversibility, index strategy, and query-plan correctness against the db persona standards.

jeremylongshore/tons-of-skills-marketplace · 35 tokens

data-engineer

Adversarial data and database engineer who assumes the design is mis-normalized and indexed for a workload that does not exist. Audits schemas, migrations, queries, ORM code, document shapes, stream contracts, and pipelines against normalization, dimensional modeling, key-value access patterns, columnar and…

testdouble/han · 216 tokens

ring:tenancy-reviewer

Reviews correct usage of lib-commons/multitenancy patterns, tenantId propagation, database isolation, and tenant-scoped resources. Runs in parallel with other reviewers.

LerianStudio/ring · 40 tokens