define-data-model
Derive the data model from the UI mocks and features, including implicit entities (joins, history, audit, lifecycle) found through a feature x entity CRUD matrix; outputs an ER diagram.
- License 许可
- MIT
- 最近更新
- 2026-11-10
- Stars
- ★ 13
- Forks
- 1
01 前言 Front Matter
- model
- opus
- description
- Derive the data model from the UI mocks and features, including implicit entities (joins, history, audit, lifecycle) found through a feature x entity CRUD matrix; outputs an ER diagram.
- argument-hint
- [--auto] [--lang=ja|en]
03 SKILL.md 正文
Data Model (2-pass)
Shared files: a path written @rules/…, @skills/…, @templates/… or @docs/… is relative to the
plugin root, ${CLAUDE_PLUGIN_ROOT} — not to the project being worked on. Read it from there.
Desired Outcome
Produce one deliverable:
- Data model —
reports/02_spec/data-model.md(ENT-IDs):- Entities, attributes, and relationships
- A Mermaid ER diagram of the final model (explicit + implicit)
- For each Pass-2 addition, the functional-relationship rationale
Invocation
/product:define-data-model [--auto] [--lang=ja|en]
| Argument/Flag | Required | Description |
|---|---|---|
--auto |
Optional | Derive without elicitation; record ambiguous concepts as TBD |
--lang |
Optional | Override output language |
Decision Criteria
- Entity criteria: a concept becomes an entity only if it is persisted, has identity/key, and receives multiple operations. Prefer value objects; avoid over-normalization.
- Two passes are mandatory. Pass 1 = explicit (UI + features); Pass 2 = implicit via the CRUD matrix — every implicit addition records why (the functional relationship).
- Model the domain, not the schema. Let storage follow the model.
- Stop condition: all explicit concepts captured (Pass 1), the CRUD matrix run to surface implicit entities (Pass 2), and a valid Mermaid ER diagram produced.
Prerequisites
| Input | Required/Recommended | Source | If missing/empty |
|---|---|---|---|
reports/02_spec/feature-list.md |
Required | /product:define-features |
block with a message — the CRUD matrix needs features |
reports/02_spec/ui-mocks/ |
Required | /product:generate-ui-mock |
block with a message — Pass 1 needs screens/forms |
Process
- Read context — features, mocks,
work/traceability.json. - Pass 1 (explicit) — screen/concept → entity; form fields → attributes; action results →
state/events; Command-receiving/Event-emitting aggregate → entity. Apply
@rules/product/ui-to-domain.mdand@rules/product/ddd-strategic.md. - Pass 2 (implicit) — build the feature×entity CRUD matrix; detect many-to-many/history/audit/ state-machine concepts; add them with rationale.
- Relate — define relationships and cardinalities; keep aggregates small (reference by id).
- Diagram — render the Mermaid ER diagram of the final model.
- Append traceability — add
ENT-nodes towork/traceability.jsonwith UpstreamFEAT-/JOB-references. - Record — write the file; append decisions to
work/context.md; ask remaining unknowns and log only what stays open (@rules/open-questions.md).
Output
Every Markdown document here opens with the ## ELI5 section of @rules/eli5-summary.md, as
options.eli5 (default technical) directs.
reports/02_spec/data-model.md, with an ENT- ID table (Upstream column), Pass-2 rationale notes,
and a Mermaid ER diagram.
Reference Materials
| Resource | Purpose |
|---|---|
@rules/product/ui-to-domain.md |
Two-pass derivation, CRUD matrix, entity criteria |
@rules/product/ddd-strategic.md |
Entity vs value object, aggregates, ubiquitous language |
Related Skills
| Skill | Relationship |
|---|---|
/product:define-features |
Upstream — features drive the CRUD matrix |
/product:generate-ui-mock |
Upstream — screens/forms drive Pass 1 |
/product:map-domains |
Downstream — groups entities into bounded contexts |
/product:design-api |
Downstream — API resources map to entities |
/product:adapt-change |
Re-runs this skill when features change |
04 同仓库更多 Skills
verify-sql-migration
Prove a SQL migration on data: golden checks against an authorized source database and differential tests against ScalarDB. Never touches production.
verify-implementation
Check code against the design (API contract, transactions, security, requirements, the example chain) and report every divergence; optionally runs the eight-stage quality gate.
update-knowledge
Fetch or update an OKF knowledge bundle: ScalarDB/ScalarDL, or the vendored Kubernetes/Terraform bundle.
start
Interactive entry point for system architecture work: refactor a legacy application into services, or design a new system from requirements; picks the path from the project's state. To move a database to ScalarDB, use migrate-database.
select-scalardb-edition
Choose the ScalarDB edition (Community, Enterprise Standard or Premium, plus Enterprise Options), deployment mode and cluster topology through a short interview.
scaffold
Generate a runnable ScalarDB starter project for any of the six interface combinations: build, config, schema, service class, docker-compose and README.