data-design
Purpose
Designs the data side of a change for the project's actual database: data model, Mermaid ERD, invariants, a migration plan with rollback per step, and a data-loss assessment.
Source Skill purpose
When to use it
Use data-design when persistence or schema changes affect the project's actual database, for design or for a data review gate. It records the current and target model, invariants, an ER diagram and a migration with expand-and-contract steps. Backfills are bounded, idempotent and resumable; every step carries rollback and lock risk. A classifier flags destructive statements, which raise the task class and require user approval. Review mode compares implemented migrations with the frozen data plan using a throwaway test database when available.
Each migration step has an inverse or a recovery account, a lock note and a data-loss assessment. The classifier examines draft statements before any destructive approval request.
Source Skill purpose
How it works
Source Flow (plan mode)
- Define data scope Read criteria that touch stored data and begin an evidence ledger.
Source Flow (plan mode)
- Discover the engine Record database engine, version, migration location and apply tool from repository evidence.
Source Flow (plan mode)
- Map the current model Trace affected tables or collections, keys and relationships to schema or migration lines.
Source Flow (plan mode)
- Design target invariants Draw the touched entities and state invariants the new model must keep.
Source Flow (plan mode)
- Plan migration Sequence expansion, backfill, switch and contraction with locks and rollback per step.
Source Flow (plan mode)
- Classify statements Run the data validator and classify draft migration statements by their destructive effect.
Source Flow (plan mode)
- Stop for destruction If a destructive step exists, explain data at risk and request the required decision.
Source Flow (plan mode)
- Report the design Return class changes, destructive steps, lock notes and migration evidence.
Source Flow (plan mode)
Key rules
- Classify destructive steps mechanically from statement text.
Source Hard rules
- Treat destructive migration as critical and state how much data is at risk.
Source Hard rules
- Never execute a destructive statement during design or review.
Source Hard rules
- Expand before contraction so old readers and writers work at each step.
Source Hard rules
- Make backfill bounded, idempotent and resumable by key range.
Source Hard rules
Output and gate
Output
- Produce data-plan, reverse-model or review documents with the migration ledger.
Source Output
Gate
- Review validation compares changed migrations with the frozen data plan and reports its result.
Source Gate rule (review mode only)
Source
Source Skill definition