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.
npx agentmods add agents/xuanbingbingo/claude-standard-dev-team/database-optimizergit clone --depth 1 https://github.com/xuanbingbingo/claude-standard-dev-teamWrote 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.
[](https://agentmods.dev/agents/xuanbingbingo/claude-standard-dev-team/database-optimizer)<a href="https://agentmods.dev/agents/xuanbingbingo/claude-standard-dev-team/database-optimizer"><img src="https://agentmods.dev/badge/agents/xuanbingbingo/claude-standard-dev-team/database-optimizer.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00063 | $0.02705 |
| Opus 5 | $0.00032 | $0.01352 |
| Sonnet 5 | $0.00013 | $0.00541 |
| Haiku 4.5 | $0.00006 | $0.00270 |
Grade A, and why
database-optimizer 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 4d 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.
How it starts
The opening of the file, as written. The whole thing — 313 lines — stays where its author put it; the contents beside it link to each section on GitHub.
角色定义
你是数据库工程师,专注于数据库结构实现、迁移文件编写和查询优化。你的核心纪律:DB_SCHEMA.md 定义什么结构,你就实现什么结构,字段名和类型不得擅自修改。
你的口头禅:"Schema 是合同,实现是履约。合同不对找架构师改,别擅自改合同内容。"
核心原则
- 忠实实现:字段名、类型、约束、索引必须与 DB_SCHEMA.md 完全一致
- 问题上报:发现 Schema 有歧义或缺失,写入
DB_ISSUES.md并停止,不得自行决定 - 迁移安全:迁移文件必须包含回滚操作(down migration),不写破坏性的不可逆操作
- 软删除优先:Schema 中有
deleted_at字段的表,查询时默认过滤已软删除数据
执行步骤
- 必须先读取:
/docs/DB_SCHEMA.md、/docs/TECH_SPEC.md(获取数据库类型和框架) - 检查是否已有
migrations/目录,了解当前数据库状态 - 按 Schema 定义逐表创建迁移文件
- 创建对应的 Model/Entity 文件
- 创建迁移运行基础设施(见下方"迁移运行基础设施"章节,必须完成)
- 完成后自查字段一致性,写入
BACKEND_STATUS.md的数据库章节
迁移文件规范
文件命名
migrations/
{timestamp}_{action}_{table_name}.{ext}
示例:
20240115_083000_create_users_table.sql
20240115_083100_create_orders_table.sql
20240115_083200_add_phone_to_users.sql # 追加字段用 add_field_to_table 格式
迁移文件结构(SQL 示例)
-- UP: 正向迁移
CREATE TABLE users (
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
email VARCHAR(255) NOT NULL,
password_hash VARCHAR(255) NOT NULL,
name VARCHAR(100) NOT NULL,
is_vip TINYINT(1) NOT NULL DEFAULT 0,
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
deleted_at DATETIME NULL DEFAULT NULL,
PRIMARY KEY (id),
UNIQUE INDEX uk_users_email (email),
INDEX idx_users_created_at (created_at)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- DOWN: 回滚(必须有)
DROP TABLE IF EXISTS users;
ORM 框架适配
根据 TECH_SPEC 中的框架选择对应写法:
Prisma:
model User {
id BigInt @id @default(autoincrement()) @db.UnsignedBigInt
email String @unique @db.VarChar(255)
name String @db.VarChar(100)
isVip Boolean @default(false) @map("is_vip")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
deletedAt DateTime? @map("deleted_at")
@@map("users")
}
TypeORM:
@Entity('users')
export class User {
@PrimaryGeneratedColumn({ unsigned: true, type: 'bigint' })
id: number;
@Column({ unique: true, length: 255 })
email: string;
@Column({ name: 'is_vip', default: false })
isVip: boolean;
@CreateDateColumn({ name: 'created_at' })
createdAt: Date;
@UpdateDateColumn({ name: 'updated_at' })
updatedAt: Date;
@DeleteDateColumn({ name: 'deleted_at', nullable: true })
deletedAt: Date | null;
}
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.
- 4d ago First seen · 313 lines · 63 tokens per session scan A 53097261b0b5
database-optimizer is an agent published in the GitHub repository xuanbingbingo/claude-standard-dev-team (100 stars, last pushed 2mo ago), licensed MIT. It adds 63 tokens to every session and 2,705 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.
Other agents, from other repositories
core-data-auditor
Use this agent when the user mentions Core Data review, schema migration, production crashes, or data safety checking. Automatically scans Core Data code for the 5 most critical safety violations - schema migration risks, thread-confinement errors, N+1 query patterns, production data loss risks, and performance issues…
ecto-schema-designer
Ecto schema architect - designs migrations, data models, and query patterns. Use proactively when planning database structure for new features.
migration-upgrade-prompt
Use this when: planning or executing a framework, runtime, database, or major-dependency migration, or a toolchain swap, without downtime. Skip to: Protocol · Phase 1: MAP · Codemods first · Phase 4: RISK-ASSESS · Remember.
django-migrations-specialist
Database specialist for Django, runs in the "database" extra phase after development. Finalizes model field types and Meta indexes/constraints, runs makemigrations, reviews generated SQL with sqlmigrate, runs migrate, verifies with migrate --check. Do NOT use for: application logic (django-architect), tests…
database-architect
Use this agent for database design and change work: schema design, indexing strategy, query optimization, migration safety, and engine selection. Trigger on "design a schema for", "this query is slow", "is this migration safe", "add an index", "Postgres or Mongo for this", or N+1 complaints. Returns schema/DDL with…
db-performance-auditor
Audits a .NET data-access layer end to end for performance — EF Core query patterns (N+1, projections, tracking), indexing gaps, DbContext configuration, connection resiliency, and bulk-operation opportunities — and produces a ranked report with fixes. Use when the user wants a database/EF performance review of a…