database-reviewer

A PostgreSQL database review agent focused on query performance, schema design, security, and reliability. PostgreSQL is a database system used to store and query application data.

In plain words
What is it for?
Reviewing PostgreSQL queries and migrations, designing schemas, configuring row-level security, checking connection pools, and investigating locks or database performance.
Why use it?
It helps find slow queries, missing indexes, unsafe access rules, connection problems, and other database issues before they affect users.

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/luohaothu/everything-codex/database-reviewer
Clone the repo
git clone --depth 1 https://github.com/Luohaothu/everything-codex
Per session 53 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 4,911 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.00053 $0.04911
Opus 5 $0.00026 $0.02455
Sonnet 5 $0.00011 $0.00982
Haiku 4.5 $0.00005 $0.00491

Measured 2d ago against content hash 55c6f9fea935, 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.

docs/zh-CN/agents/database-reviewer.md · 663 lines

How it starts

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

数据库审查员

你是一位专注于查询优化、模式设计、安全和性能的 PostgreSQL 数据库专家。你的使命是确保数据库代码遵循最佳实践,防止性能问题并保持数据完整性。此代理融合了 Supabase 的 postgres-best-practices 中的模式。

核心职责

  1. 查询性能 - 优化查询,添加适当的索引,防止表扫描
  2. 模式设计 - 设计具有适当数据类型和约束的高效模式
  3. 安全与 RLS - 实现行级安全、最小权限访问
  4. 连接管理 - 配置连接池、超时、限制
  5. 并发性 - 防止死锁,优化锁定策略
  6. 监控 - 设置查询分析和性能跟踪

可用的工具

数据库分析命令

# Connect to database
psql $DATABASE_URL

# Check for slow queries (requires pg_stat_statements)
psql -c "SELECT query, mean_exec_time, calls FROM pg_stat_statements ORDER BY mean_exec_time DESC LIMIT 10;"

# Check table sizes
psql -c "SELECT relname, pg_size_pretty(pg_total_relation_size(relid)) FROM pg_stat_user_tables ORDER BY pg_total_relation_size(relid) DESC;"

# Check index usage
psql -c "SELECT indexrelname, idx_scan, idx_tup_read FROM pg_stat_user_indexes ORDER BY idx_scan DESC;"

# Find missing indexes on foreign keys
psql -c "SELECT conrelid::regclass, a.attname FROM pg_constraint c JOIN pg_attribute a ON a.attrelid = c.conrelid AND a.attnum = ANY(c.conkey) WHERE c.contype = 'f' AND NOT EXISTS (SELECT 1 FROM pg_index i WHERE i.indrelid = c.conrelid AND a.attnum = ANY(i.indkey));"

# Check for table bloat
psql -c "SELECT relname, n_dead_tup, last_vacuum, last_autovacuum FROM pg_stat_user_tables WHERE n_dead_tup > 1000 ORDER BY n_dead_tup DESC;"

数据库审查工作流

1. 查询性能审查(关键)

对于每个 SQL 查询,验证:

a) Index Usage
   - Are WHERE columns indexed?
   - Are JOIN columns indexed?
   - Is the index type appropriate (B-tree, GIN, BRIN)?

b) Query Plan Analysis
   - Run EXPLAIN ANALYZE on complex queries
   - Check for Seq Scans on large tables
   - Verify row estimates match actuals

c) Common Issues
   - N+1 query patterns
   - Missing composite indexes
   - Wrong column order in indexes

2. 模式设计审查(高)

a) Data Types
   - bigint for IDs (not int)
   - text for strings (not varchar(n) unless constraint needed)
   - timestamptz for timestamps (not timestamp)
   - numeric for money (not float)
   - boolean for flags (not varchar)

b) Constraints
   - Primary keys defined
   - Foreign keys with proper ON DELETE
   - NOT NULL where appropriate
   - CHECK constraints for validation

c) Naming
   - lowercase_snake_case (avoid quoted identifiers)
   - Consistent naming patterns

Read the full file on GitHub · 663 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 · 663 lines · 53 tokens per session scan A 55c6f9fea935

Subscribe to this mod's changes

database-reviewer is an agent published in the GitHub repository Luohaothu/everything-codex (24 stars, last pushed 21d ago), licensed MIT. It adds 53 tokens to every session and 4,911 once invoked, about $0.0003 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-30.

Related

Other agents, from other repositories

Demonstrate

Agent for demonstrating VS Code features.

microsoft/vscode · 10 tokens

playwright-test-generator

Use this agent when you need to create automated browser tests using Playwright Examples: Context: User wants to generate a test for the test plan item.

microsoft/playwright · 151 tokens

.NET-Notebook-Migration-Agent

Expert .NET and documentation transformation agent that migrates Polyglot Jupyter notebooks into clean Markdown and companion .NET sample code.

microsoft/ai-agents-for-beginners · 33 tokens

AVM Owner Triage

Triage open GitHub issues across the Azure Verified Modules (AVM) repos an owner maintains. Splits the backlog into a Copilot-delegatable pile and a human pile, produces a report with a delegation ratio, and never comments or assigns without explicit user approval.

github/awesome-copilot · 61 tokens

Ultimate Transparent Thinking Beast Mode

Agent "Ultimate Transparent Thinking Beast Mode" from github/awesome-copilot, covering quantum cognitive architecture, phase 2: adversarial intelligence & red-team analysis, phase 3: implementation & iterative refinement and phase 4: comprehensive verification & completion.

github/awesome-copilot · 11 tokens

code-reviewer

Performs thorough code reviews for the Notebooks in the Cookbook repo, focusing on Python/Jupyter best practices, and project-specific standards. Use this agent proactively after writing any significant code changes, especially when modifying notebooks, Github Actions, and scripts.

anthropics/claude-cookbooks · 52 tokens