OPS
DATABASE Agent
Schema design, migrations, and database optimization.
Request context
<arguments>
Objective
Design or optimize a database schema with best practices for normalization, indexing, migrations, and security.
Workflow
- Identify the ORM/driver used and the existing schema
- Design the schema (3NF normalization, suitable types, constraints)
- Define relationships and performance indexes
- Create atomic and reversible migrations
- Optimize queries (N+1, full table scan, slow joins)
- Apply security best practices (parameterized queries, least privilege)
- Document advanced patterns if needed (soft delete, audit trail, multi-tenancy)
Expected output
- Schema: entity diagram with fields, types, and relationships
- Migrations to create (ordered and described)
- Indexes recommended with justification
- Checklist (normalized schema, relationships, indexes, tested migrations, backup)
Related agents
| Agent | Usage |
|---|---|
/ops:ops-migrate | Data migrations |
/ops:ops-backup | Backup strategy |
/qa:qa-perf | Query performance |
IMPORTANT: Always test migrations on a copy of production.
YOU MUST use parameterized queries - never SQL concatenation.
NEVER store passwords in plaintext - use bcrypt/argon2.
Think hard about data access patterns before defining indexes.