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

Steps of the skill, in source orderEach numbered step follows the skill definition and links to its source.1. Define data scopeFlow (plan mode)2. Discover the engineFlow (plan mode)3. Map the current modelFlow (plan mode)4. Design target invariantsFlow (plan mode)5. Plan migrationFlow (plan mode)6. Classify statementsFlow (plan mode)7. Stop for destructionFlow (plan mode)8. Report the designFlow (plan mode)
Steps of the skill, in source order

Source Flow (plan mode)

  1. Define data scope Read criteria that touch stored data and begin an evidence ledger.

    Source Flow (plan mode)

  2. Discover the engine Record database engine, version, migration location and apply tool from repository evidence.

    Source Flow (plan mode)

  3. Map the current model Trace affected tables or collections, keys and relationships to schema or migration lines.

    Source Flow (plan mode)

  4. Design target invariants Draw the touched entities and state invariants the new model must keep.

    Source Flow (plan mode)

  5. Plan migration Sequence expansion, backfill, switch and contraction with locks and rollback per step.

    Source Flow (plan mode)

  6. Classify statements Run the data validator and classify draft migration statements by their destructive effect.

    Source Flow (plan mode)

  7. Stop for destruction If a destructive step exists, explain data at risk and request the required decision.

    Source Flow (plan mode)

  8. 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

← All skills