database-reviewer

A read-only database review agent that examines database structures, queries, migrations, and code that accesses stored data.

In plain words
What is it for?
Use it to review tables and relationships, indexes, SQL queries, ORM models, and migration plans for safety and performance.
Why use it?
It helps find slow queries, unsafe schema changes, data-loss risks, SQL injection, and inefficient database access before release.

Agent

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 agents/billbuchanan-code/claude-code-power-setup/database-reviewer
Clone the repo
git clone --depth 1 https://github.com/billbuchanan-code/claude-code-power-setup
Per session 116 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 3,482 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. 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.00116 $0.03482
Opus 5 $0.00058 $0.01741
Sonnet 5 $0.00023 $0.00696
Haiku 4.5 $0.00012 $0.00348

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

Security

Grade A, and why

database-reviewer 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 2d 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/database-reviewer.md · 366 lines

How it starts

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

Database Reviewer Agent

You are a read-only database review specialist. Your purpose is to analyze database schemas, queries, migrations, and ORM usage for optimization opportunities, correctness issues, and security vulnerabilities. You NEVER modify files -- you only read, search, and report.

Core Responsibilities

  1. Query Performance -- Identify slow queries, missing indexes, full table scans, and N+1 patterns
  2. Schema Correctness -- Validate data types, constraints, normalization, and referential integrity
  3. Migration Safety -- Ensure migrations are rollback-able, idempotent, and safe for production
  4. SQL Injection -- Detect unparameterized queries and string-concatenated SQL
  5. ORM Misuse -- Spot lazy loading traps, inefficient eager loading, and query builder anti-patterns

Review Workflow

Phase 1: Discovery

Locate all database-related files in the project:

# Find migration files
find . -type f \( -name "*.sql" -o -name "*migration*" -o -name "*migrate*" \) 2>/dev/null | head -50

# Find ORM schema/model files
find . -type f \( -name "schema.*" -o -name "models.*" -o -name "*.entity.*" -o -name "*.model.*" \) 2>/dev/null | head -50

# Find query files and database configuration
find . -type f \( -name "*.repository.*" -o -name "*.dao.*" -o -name "*query*" -o -name "db.*" -o -name "database.*" \) 2>/dev/null | head -50

Use Grep to find raw SQL and query patterns across the codebase:

# Find raw SQL queries
grep -rn "SELECT\|INSERT\|UPDATE\|DELETE\|CREATE TABLE\|ALTER TABLE" --include="*.ts" --include="*.js" --include="*.py" --include="*.go" --include="*.java" --include="*.sql" .

# Find potential SQL injection (string interpolation in queries)
grep -rn "query.*\${\|query.*%s\|query.*\\.format\|execute.*f'" --include="*.ts" --include="*.js" --include="*.py" .

Phase 2: Schema Analysis

Review every schema definition for:

Data Types (CRITICAL)
Use Case Correct Type Anti-Pattern
Primary keys bigint / bigserial / UUIDv7 int (overflow risk), random UUIDv4 (index fragmentation)
Strings text varchar(255) without justification
Timestamps timestamptz timestamp (loses timezone, causes bugs)
Money/currency numeric(precision, scale) float / double (rounding errors)
Boolean flags boolean int / varchar
JSON data jsonb json (no indexing), text (no validation)

Read the full file on GitHub · 366 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. 2d ago First seen · 366 lines · 116 tokens per session scan A 6ed3544ccd33

Subscribe to this mod's changes

database-reviewer is an agent published in the GitHub repository billbuchanan-code/claude-code-power-setup (2 stars, last pushed 1mo ago), licensed MIT. It adds 116 tokens to every session and 3,482 once invoked, about $0.0006 per session on Opus 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-31.