design-data-layer
Design the database layer of a project that does not use ScalarDB: schema, keys, transactions and read models. For ScalarDB projects, use design-scalardb.
- License 许可
- MIT
- 最近更新
- 2026-11-14
- Stars
- ★ 13
- Forks
- 1
01 前言 Front Matter
- model
- opus
- description
- Design the database layer of a project that does not use ScalarDB: schema, keys, transactions and read models. For ScalarDB projects, use design-scalardb.
03 SKILL.md 正文
Data Layer Design
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
Generic data layer design for projects not using ScalarDB:
- Database selection and configuration (RDB/NoSQL/hybrid)
- Connection pool design
- Migration strategy
- Transaction management patterns
- ORM/data access patterns
- The read model / CQRS / event sourcing decision per aggregate — default neither; adopt for a
named reason with the projection lag and rebuild cost stated (the same table
/architect:design-scalardbrecords;review-data-integrityreads it as undecided when absent)
Prerequisites
| File | Required/Recommended | Source |
|---|---|---|
| reports/03_design/target-architecture.md | Required | /architect:design-microservices |
| reports/03_design/aggregates/aggregate-manifest.json | Optional | /architect:design-aggregate — the aggregate as the concurrency scope and the unit one transaction writes, one repository per root |
| reports/03_design/state-machines/state-machine-manifest.json | Optional | /architect:design-state-machine — the state column, its concurrency scope, and whether transition history is recorded (@rules/state-modeling.md §6) |
| reports/04_quality/nfr.md | Optional | /product:define-nfr — read-latency and reporting targets for the Read Model / CQRS / Event Sourcing decision; absent, take them from requirements-definition.md's NFR table, and ask what neither states (@rules/open-questions.md) |
Output
| File | Content |
|---|---|
reports/03_design/data-layer-design.md |
DB design, transaction management, migration, the Read Model / CQRS / Event Sourcing decision per aggregate |
Output language and frontmatter: @rules/output-conventions.md.
Architecture Decision Records
The decisions this skill makes that a later phase depends on — the storage engine and consistency mechanism, and the CQRS / Event Sourcing adoption verdicts — are each recorded as
reports/03_design/adr/adr-NNN-<slug>.md under @rules/architecture-decision-records.md: allocate
ADR- as max + 1 over work/traceability.json and the directory (redesign registers the
prefix; this skill appends), cite what drove the decision in upstream — typically AGG- / STM- / NFR- nodes, or reports/ paths on the legacy path, per the rule's §2 (never
empty), list the alternatives rejected, append one { "type": "decision" } node per record to
the graph, regenerate index.md, and run
python3 "${CLAUDE_PLUGIN_ROOT}/tools/lib/adr_records.py" <project_dir> before completing. A
record you disagree with is superseded by a new one, never edited.
Related Skills
| Skill | Relationship |
|---|---|
| /architect:design-microservices | Input source |
| /architect:review-data-integrity | Review target |
04 同仓库更多 Skills
doctor
Check the install and a project: plugins at the repository's version, hooks and skills in place, the two knowledge bundles present and fresh, the project's registry, question store, audit log, learned rules and claims readable. Run it first when a command misbehaves.
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.