Database Architect — DB Design Full Pipeline
An agent team collaborates to perform data modeling, migration, indexing, query optimization, and security verification in a single pass.
Execution Mode
Agent Team — 5 members communicate directly via SendMessage and cross-validate each other's work.
Agent Composition
| Agent |
File |
Role |
Type |
| data-modeler |
.claude/agents/data-modeler.md |
ERD, normalization, relationship design |
general-purpose |
| migration-manager |
.claude/agents/migration-manager.md |
DDL, version control, rollback |
general-purpose |
| performance-analyst |
.claude/agents/performance-analyst.md |
Indexing, query optimization |
general-purpose |
| security-auditor |
.claude/agents/security-auditor.md |
Access control, encryption, auditing |
general-purpose |
| integration-reviewer |
.claude/agents/integration-reviewer.md |
Alignment, operational readiness verification |
general-purpose |
Workflow
Phase 1: Preparation (Performed directly by the orchestrator)
- Extract from user input:
- Domain: What service is the DB for
- DBMS: PostgreSQL / MySQL / MongoDB / DynamoDB
- Core Entities: Primary data subjects
- Expected Scale (optional): Row counts, TPS
- Existing Files (optional): Existing schemas, ERDs, SQL, etc.
- Create the
_workspace/ directory at the project root
- Organize the input and save to
_workspace/00_input.md
- If existing files are provided, copy them to
_workspace/ and skip the corresponding phase
- Determine the execution mode based on the scope of the request
Phase 2: Team Assembly and Execution
| Order |
Task |
Owner |
Dependencies |
Artifact |
| 1 |
Data Modeling |
data-modeler |
None |
_workspace/01_data_model.md |
| 2 |
Migration Generation |
migration-manager |
Task 1 |
_workspace/02_migration.sql, 02_migration_plan.md |
| 3a |
Performance Optimization |
performance-analyst |
Tasks 1, 2 |
_workspace/03_performance.md |
| 3b |
Security Verification |
security-auditor |
Tasks 1, 2 |
_workspace/04_security.md |
| 4 |
Integration Review |
integration-reviewer |
Tasks 2, 3a, 3b |
_workspace/05_review_report.md |
Tasks 3a (performance) and 3b (security) are executed in parallel.
Inter-team communication flow:
- data-modeler completes -> Delivers DDL basis to migration-manager, access patterns to performance-analyst, sensitive data to security-auditor
- migration-manager completes -> Delivers index DDL to performance-analyst, permission DDL to security-auditor
- performance-analyst <-> security-auditor: Mutually verify that performance optimizations do not compromise security
- integration-reviewer cross-validates all artifacts. When 🔴 must-fix issues are found, requests revisions from the relevant agent -> rework -> re-verify (up to 2 rounds)
Phase 3: Integration and Final Artifacts
Organize the final artifacts based on the review report:
- Verify all files in
_workspace/
- Confirm that all 🔴 must-fix items from the review report have been addressed
- Report the final summary to the user
Mode by Task Scale
| User Request Pattern |
Execution Mode |
Agents Deployed |
| "Design a database", "full design" |
Full Pipeline |
All 5 agents |
| "Just draw the ERD", "table design only" |
Modeling Mode |
data-modeler + integration-reviewer |
| "Optimize this schema" (existing SQL) |
Optimization Mode |
performance-analyst + integration-reviewer |
| "DB security audit" (existing DB) |
Security Mode |
security-auditor + integration-reviewer |
| "Review this schema" |
Review Mode |
integration-reviewer only |
Leveraging existing files: If the user provides schemas, ERDs, or other existing files, skip the corresponding steps.
Data Transfer Protocol
| Strategy |
Method |
Purpose |
| File-based |
_workspace/ directory |
Store and share primary artifacts |
| Message-based |
SendMessage |
Real-time delivery of key information, revision requests |
| Task-based |
TaskCreate/TaskUpdate |
Progress tracking, dependency management |
File naming convention: {order}_{agent}_{artifact}.{extension}
Error Handling
| Error Type |
Strategy |
| DBMS not specified |
Default to PostgreSQL; add compatibility notes for other DBMSs |
| Insufficient domain information |
Data modeler starts with common patterns; document assumptions |
| Agent failure |
Retry once -> If still fails, proceed without that artifact; note the omission in the review report |
| 🔴 found during review |
Request revision from the relevant agent -> rework -> re-verify (up to 2 rounds) |
| Existing schema parsing failure |
Manually analyze and reconstruct the data model |
Test Scenarios
Normal Flow
Prompt: "Design a PostgreSQL database for an e-commerce platform. I need user, product, order, payment, and review tables. Expecting 100K orders per day"
Expected Result:
- Model: 5 core tables + junction tables, 3NF normalization, ERD
- Migration: Sequential DDL + rollback scripts + seed data
- Performance: Index strategy, key query optimization, partitioning design
- Security: RBAC, PII encryption, audit logging, backup strategy
- Review: All items in the alignment matrix verified
Existing File Flow
Prompt: "Optimize the performance of this SQL schema" + SQL file
Expected Result:
- Copy existing schema to
_workspace/02_migration.sql
- Optimization mode: deploy performance-analyst + integration-reviewer
- Skip data-modeler, migration-manager, security-auditor
Error Flow
Prompt: "Design a database, blog platform"
Expected Result:
- Scale/DBMS unknown -> data-modeler infers PostgreSQL + standard blog entities (Post, User, Comment, Tag)
- Execute in full pipeline mode
- Review report notes "design based on inferred requirements"
Agent Extension Skills
Extension skills that enhance each agent's domain expertise:
| Skill |
Target Agent |
Role |
normalization-patterns |
data-modeler |
1NF-BCNF identification, denormalization strategies, domain-specific ERD templates |
query-optimization-catalog |
performance-analyst |
Index strategies, EXPLAIN analysis, N+1 resolution, partitioning |
1---2name: database-architect3description: Full pipeline for DB design. An agent team collaborates to perform data modeling, migration, indexing, query optimization, and security verification. Use this skill for any database design task including 'design a database', 'database modeling', 'table design', 'ERD', 'migration', 'query optimization', 'index design', 'SQL schema', 'PostgreSQL design', 'MySQL design', etc. Also supports optimization and security auditing for existing schemas. Note: actual DB server installation/operation, cloud infrastructure provisioning, and monitoring dashboard setup are outside the scope of this skill.4---56# Database Architect — DB Design Full Pipeline78An agent team collaborates to perform data modeling, migration, indexing, query optimization, and security verification in a single pass.910## Execution Mode1112**Agent Team** — 5 members communicate directly via SendMessage and cross-validate each other's work.1314## Agent Composition1516| Agent | File | Role | Type |17|-------|------|------|------|18| data-modeler | `.claude/agents/data-modeler.md` | ERD, normalization, relationship design | general-purpose |19| migration-manager | `.claude/agents/migration-manager.md` | DDL, version control, rollback | general-purpose |20| performance-analyst | `.claude/agents/performance-analyst.md` | Indexing, query optimization | general-purpose |21| security-auditor | `.claude/agents/security-auditor.md` | Access control, encryption, auditing | general-purpose |22| integration-reviewer | `.claude/agents/integration-reviewer.md` | Alignment, operational readiness verification | general-purpose |2324## Workflow2526### Phase 1: Preparation (Performed directly by the orchestrator)27281. Extract from user input:29 - **Domain**: What service is the DB for30 - **DBMS**: PostgreSQL / MySQL / MongoDB / DynamoDB31 - **Core Entities**: Primary data subjects32 - **Expected Scale** (optional): Row counts, TPS33 - **Existing Files** (optional): Existing schemas, ERDs, SQL, etc.342. Create the `_workspace/` directory at the project root353. Organize the input and save to `_workspace/00_input.md`364. If existing files are provided, copy them to `_workspace/` and skip the corresponding phase375. Determine the **execution mode** based on the scope of the request3839### Phase 2: Team Assembly and Execution4041| Order | Task | Owner | Dependencies | Artifact |42|-------|------|-------|-------------|----------|43| 1 | Data Modeling | data-modeler | None | `_workspace/01_data_model.md` |44| 2 | Migration Generation | migration-manager | Task 1 | `_workspace/02_migration.sql`, `02_migration_plan.md` |45| 3a | Performance Optimization | performance-analyst | Tasks 1, 2 | `_workspace/03_performance.md` |46| 3b | Security Verification | security-auditor | Tasks 1, 2 | `_workspace/04_security.md` |47| 4 | Integration Review | integration-reviewer | Tasks 2, 3a, 3b | `_workspace/05_review_report.md` |4849Tasks 3a (performance) and 3b (security) are **executed in parallel**.5051**Inter-team communication flow:**52- data-modeler completes -> Delivers DDL basis to migration-manager, access patterns to performance-analyst, sensitive data to security-auditor53- migration-manager completes -> Delivers index DDL to performance-analyst, permission DDL to security-auditor54- performance-analyst <-> security-auditor: Mutually verify that performance optimizations do not compromise security55- integration-reviewer cross-validates all artifacts. When 🔴 must-fix issues are found, requests revisions from the relevant agent -> rework -> re-verify (up to 2 rounds)5657### Phase 3: Integration and Final Artifacts5859Organize the final artifacts based on the review report:60611. Verify all files in `_workspace/`622. Confirm that all 🔴 must-fix items from the review report have been addressed633. Report the final summary to the user6465## Mode by Task Scale6667| User Request Pattern | Execution Mode | Agents Deployed |68|---------------------|----------------|-----------------|69| "Design a database", "full design" | **Full Pipeline** | All 5 agents |70| "Just draw the ERD", "table design only" | **Modeling Mode** | data-modeler + integration-reviewer |71| "Optimize this schema" (existing SQL) | **Optimization Mode** | performance-analyst + integration-reviewer |72| "DB security audit" (existing DB) | **Security Mode** | security-auditor + integration-reviewer |73| "Review this schema" | **Review Mode** | integration-reviewer only |7475**Leveraging existing files**: If the user provides schemas, ERDs, or other existing files, skip the corresponding steps.7677## Data Transfer Protocol7879| Strategy | Method | Purpose |80|----------|--------|---------|81| File-based | `_workspace/` directory | Store and share primary artifacts |82| Message-based | SendMessage | Real-time delivery of key information, revision requests |83| Task-based | TaskCreate/TaskUpdate | Progress tracking, dependency management |8485File naming convention: `{order}_{agent}_{artifact}.{extension}`8687## Error Handling8889| Error Type | Strategy |90|-----------|----------|91| DBMS not specified | Default to PostgreSQL; add compatibility notes for other DBMSs |92| Insufficient domain information | Data modeler starts with common patterns; document assumptions |93| Agent failure | Retry once -> If still fails, proceed without that artifact; note the omission in the review report |94| 🔴 found during review | Request revision from the relevant agent -> rework -> re-verify (up to 2 rounds) |95| Existing schema parsing failure | Manually analyze and reconstruct the data model |9697## Test Scenarios9899### Normal Flow100**Prompt**: "Design a PostgreSQL database for an e-commerce platform. I need user, product, order, payment, and review tables. Expecting 100K orders per day"101**Expected Result**:102- Model: 5 core tables + junction tables, 3NF normalization, ERD103- Migration: Sequential DDL + rollback scripts + seed data104- Performance: Index strategy, key query optimization, partitioning design105- Security: RBAC, PII encryption, audit logging, backup strategy106- Review: All items in the alignment matrix verified107108### Existing File Flow109**Prompt**: "Optimize the performance of this SQL schema" + SQL file110**Expected Result**:111- Copy existing schema to `_workspace/02_migration.sql`112- Optimization mode: deploy performance-analyst + integration-reviewer113- Skip data-modeler, migration-manager, security-auditor114115### Error Flow116**Prompt**: "Design a database, blog platform"117**Expected Result**:118- Scale/DBMS unknown -> data-modeler infers PostgreSQL + standard blog entities (Post, User, Comment, Tag)119- Execute in full pipeline mode120- Review report notes "design based on inferred requirements"121122## Agent Extension Skills123124Extension skills that enhance each agent's domain expertise:125126| Skill | Target Agent | Role |127|-------|-------------|------|128| `normalization-patterns` | data-modeler | 1NF-BCNF identification, denormalization strategies, domain-specific ERD templates |129| `query-optimization-catalog` | performance-analyst | Index strategies, EXPLAIN analysis, N+1 resolution, partitioning |