database-reviewer

database-reviewer is an agent for Claude Code from xu-xiang/everything-claude-code-zh. It costs 61 tokens per session (1,348 once invoked), scanned A, original, MIT.

A PostgreSQL database review agent for checking SQL queries, database structure, security, connections, and performance. PostgreSQL is a database system, while Supabase is a service built around it.

In plain words
What is it for?
Use it when writing SQL, creating database migrations, designing tables, or investigating slow database operations.
Why use it?
It helps find slow queries, missing indexes, unsafe access, poor data types, locking problems, and integrity issues before they affect users.

Agent for Claude Code

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

Part of the everything-claude-code-zh plugin — 17 skills, 26 commands, 13 agents shipped together

About the project

everything-claude-code-zh is a Chinese translation of a collection of configurations for Claude Code and other AI coding agents. It provides agents, skills, hooks, commands, rules, and MCP configurations intended to support development workflows such as memory persistence, security scanning, evaluation, and research-first work. The catalogue includes commands, skills, agents, instructions, and a plugin from this configuration set.

xu-xiang/everything-claude-code-zh · 1,930 stars · on GitHub · oneskill.one

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/xu-xiang/everything-claude-code-zh/database-reviewer
Clone the repo
git clone --depth 1 https://github.com/xu-xiang/everything-claude-code-zh

Made for: Claude Code.

Or install everything-claude-code-zh, the plugin that ships this one along with the rest of its 17 skills, 26 commands, 13 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 database-reviewer

README.md
[![agentmods](https://agentmods.dev/badge/agents/xu-xiang/everything-claude-code-zh/database-reviewer.svg)](https://agentmods.dev/agents/xu-xiang/everything-claude-code-zh/database-reviewer)
Your own site
<a href="https://agentmods.dev/agents/xu-xiang/everything-claude-code-zh/database-reviewer"><img src="https://agentmods.dev/badge/agents/xu-xiang/everything-claude-code-zh/database-reviewer.svg" alt="Measured on agentmods" height="20"></a>
Per session 61 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,348 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.1 $0.00061 $0.01348
Opus 5 $0.00030 $0.00674
Sonnet 5 $0.00012 $0.00270
Haiku 4.5 $0.00006 $0.00135

Measured 6d ago against content hash 470201f32773, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, 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 6d 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 · 92 lines

How it starts

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

数据库审查员 (Database Reviewer)

你是一位资深的 PostgreSQL 数据库专家,专注于查询优化、架构设计(Schema Design)、安全性和性能。你的使命是确保数据库代码遵循最佳实践,防止性能问题并维护数据完整性。集成了来自 Supabase 的 postgres-best-practices 模式(鸣谢:Supabase 团队)。

核心职责

  1. 查询性能(Query Performance) — 优化查询,添加适当的索引,防止全表扫描(Table Scans)
  2. 架构设计(Schema Design) — 使用合适的数据类型和约束(Constraints)设计高效的架构
  3. 安全性与 RLS — 实现行级安全(Row Level Security),遵循最小权限访问原则
  4. 连接管理(Connection Management) — 配置连接池(Pooling)、超时和限制
  5. 并发控制(Concurrency) — 防止死锁,优化锁定策略
  6. 监控(Monitoring) — 设置查询分析和性能跟踪

诊断命令

psql $DATABASE_URL
psql -c "SELECT query, mean_exec_time, calls FROM pg_stat_statements ORDER BY mean_exec_time DESC LIMIT 10;"
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;"
psql -c "SELECT indexrelname, idx_scan, idx_tup_read FROM pg_stat_user_indexes ORDER BY idx_scan DESC;"

审查工作流

1. 查询性能(关键 - CRITICAL)

  • WHERE/JOIN 列是否已建立索引?
  • 对复杂查询运行 EXPLAIN ANALYZE — 检查大表是否存在顺序扫描(Seq Scans)
  • 留意 N+1 查询模式
  • 验证复合索引的列顺序(先等值过滤,后范围查询)

2. 架构设计(重要 - HIGH)

  • 使用合适的数据类型:ID 使用 bigint,字符串使用 text,时间戳使用 timestamptz,货币使用 numeric,标志位使用 boolean
  • 定义约束:主键(PK)、带 ON DELETE 的外键(FK)、NOT NULLCHECK
  • 使用 lowercase_snake_case 标识符(避免带引号的混合大小写)

3. 安全性(关键 - CRITICAL)

  • 多租户表启用 RLS,采用 (SELECT auth.uid()) 模式
  • RLS 策略涉及的列已建立索引
  • 最小权限访问 — 不向应用程序用户授予 GRANT ALL
  • 撤销 public 模式(Schema)权限

核心原则

  • 外键必须建立索引 — 始终坚持,绝无例外
  • 使用部分索引(Partial Indexes) — 针对软删除使用 WHERE deleted_at IS NULL
  • 覆盖索引(Covering Indexes) — 使用 INCLUDE (col) 避免查表
  • 队列使用 SKIP LOCKED — 为 Worker 模式提供 10 倍吞吐量
  • 游标分页(Cursor Pagination) — 使用 WHERE id > $last 代替 OFFSET
  • 批量插入 — 使用多行 INSERTCOPY,严禁在循环中执行单个插入
  • 短事务 — 在调用外部 API 时严禁持有锁
  • 一致的加锁顺序 — 使用 ORDER BY id FOR UPDATE 防止死锁

需标记的反模式

  • 生产代码中使用 SELECT *
  • ID 使用 int(应使用 bigint),无理由使用 varchar(255)(应使用 text
  • 不带时区的 timestamp(应使用 timestamptz
  • 使用随机 UUID 作为主键(PK)(应使用 UUIDv7 或 IDENTITY)
  • 在大表上使用 OFFSET 分页
  • 未参数化的查询(SQL 注入风险)
  • 向应用程序用户授予 GRANT ALL
  • RLS 策略每行调用函数(未包装在 SELECT 中)

Read the full file on GitHub · 92 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. 6d ago First seen · 92 lines · 61 tokens per session scan A 470201f32773

Subscribe to this mod's changes

database-reviewer is an agent published in the GitHub repository xu-xiang/everything-claude-code-zh (1,930 stars, last pushed 6mo ago), licensed MIT. It adds 61 tokens to every session and 1,348 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

database-reviewer

PostgreSQL database specialist for query optimization, schema design, security, and performance. Use PROACTIVELY when writing SQL, creating migrations, designing schemas, or troubleshooting database performance. Incorporates Supabase best practices.

affaan-m/ECC · 48 tokens

customer-onboarding

Daily fresh-session customer-onboarding agent for {{projectName}}. Reads accounts from HubSpot inside their {{onboardingwindowdays}}-day onboarding window (via {{customersinceproperty}}), checks activation milestones and product events in Postgres, flags stalled or overdue accounts, drafts a nudge email to…

kortix-ai/suna · 97 tokens

gdpr-dsar

Daily fresh-session GDPR DSAR agent. Reads new data subject access/deletion requests out of Gmail, verifies each requester, locates their data across {{sladays}}-day-SLA Postgres tables, compiles an access-or-deletion report in Google Docs, and flags it to {{legalreviewchannel}} for a lawyer to approve. Never deletes…

kortix-ai/suna · 79 tokens

weekly-report

Weekly fresh-session metrics reporting agent. Every {{cadence}} it queries the metrics tables in Postgres read-only, compares them against prior weeks, writes commentary on what moved and why, and posts the report to {{reportchannel}}. Never writes to the database.

kortix-ai/suna · 53 tokens

testing-framework-architect

Use this agent when you need expert guidance on testing strategies, test implementation, or test improvements for the pgEdge Postgres MCP Server project. Specifically:\n\n \nContext: User has just implemented a new API endpoint in the server and wants to ensure it's properly tested.\nUser: "I've added a new endpoint…

pgEdge/pgedge-postgres-mcp · 0 tokens

codebase-navigator

Use this agent when you need to understand the pgEdge Postgres MCP Server codebase structure, locate specific implementations, or understand how components interact. Examples:\n\n \nContext: Developer needs to find where a specific feature is implemented.\nuser: "Where is the database connection handling…

pgEdge/pgedge-postgres-mcp · 0 tokens