| name | new-spec-domain |
| description | Create the domain layer spec template at `docs/spec/<feature>/domain.md`. Asks for feature name (kebab-case) + aggregate name (PascalCase) via `AskUserQuestion`, reads the section structure for the domain layer from `.claude/scaffold-spec/domain-spec.md`, then writes a Markdown file with YAML code-block placeholders and TODO markers for the user to fill in (Overview / Entity / Cross-field Invariants / Behavior Methods / Value Objects / Repository Methods). NEVER overwrites an existing file. Does not invent business content โ gathers identity only. Reads the spec format file at runtime so format changes propagate automatically. |
New Spec โ Domain
Create the domain layer spec template for one feature.
A Japanese reference translation of this skill is available at SKILL.ja.md in the same directory (not loaded as a skill; for human reference only).
When to Use
- Starting a new feature and need the domain layer spec template.
- Adding the domain spec to an existing feature directory (e.g., other layer specs are already in place).
Do NOT use this skill for:
- Editing an existing
domain.md โ open in the editor directly.
- Generating Go code from spec โ that's
scaffold-domain.
- Validating spec consistency โ that's
verify-spec.
- Creating both layer specs (domain + usecase) in one go โ use the integrator
new-spec. lean A only requires these two specs; controller / infra are derived from OpenAPI gen + sqlc gen, no spec file.
What This Skill Reads / Writes
Reads (always):
.claude/scaffold-spec/domain-spec.md โ canonical section list for the domain layer.
docs/spec/<feature>/ โ checks whether domain.md already exists.
Writes (with confirmation):
docs/spec/<feature>/domain.md โ template file.
Never touches:
- Existing
domain.md (aborts if found).
- Any other layer's spec file.
First Step: Confirm Identity
This skill MUST call AskUserQuestion immediately after invocation (unless invoked from new-spec integrator with the feature name in context):
- Feature name โ free-text, kebab-case. Validate
^[a-z][a-z0-9-]*$.
- Aggregate name โ free-text, PascalCase (e.g.,
User, Order). Becomes the Go struct name.
If docs/spec/<feature>/domain.md exists โ abort. Otherwise create docs/spec/<feature>/ if missing.
Step 1. Read Section Definitions
Read .claude/scaffold-spec/domain-spec.md and extract the canonical section list. NEVER hardcode โ this file is the source of truth.
Current section list (mirror dynamically):
- Overview
- Entity
- Cross-field Invariants
- Behavior Methods
- Value Objects
- Repository Methods
Step 2. Generate the Template
Assemble Markdown with H1 title <FeatureName Display> โ Domain Spec, then per section:
- Overview: single
TODO: line
- Entity: YAML code block with
package / struct / fields (1 placeholder field)
- Cross-field Invariants: bullet list with
TODO: line
- Behavior Methods: YAML code block with placeholder method
- Value Objects: YAML code block with note "ๅฉ็จใใชใๅ ดๅใฏ็ฏใใจๅ้ค"
- Repository Methods: YAML code block with placeholder method
Use the example output shown in .claude/scaffold-spec/domain-spec.md as the literal template format.
Step 3. Confirm and Write
Display proposed path + first ~20 lines of template, then ask:
- ใไปฅไธใฎๅ
ๅฎนใง
docs/spec/<feature>/domain.md ใไฝๆใใพใใ๏ผใ
- Options: ใไฝๆใใใ / ใใญใฃใณใปใซใ
If approved, mkdir -p docs/spec/<feature> and Write the file.
Step 4. Closing
docs/spec/<feature>/domain.md ใไฝๆใใพใใใๆฌกใฏ editor ใง TODO ใๅใใฆใใ ใใใ
usecase spec ใๅฟ
่ฆใชใ new-spec-usecase ใพใใฏ็ตฑๅ new-spec ใไฝฟใฃใฆใใ ใใ
๏ผlean A ๆงๆ: controller / infra spec ใฏไธ่ฆใOpenAPI gen + sqlc gen ใใๅฐๅบใใใพใ๏ผใ
AI Modification Scope
- Write scope: new files under
docs/spec/<feature>/ only.
- Aborts if
domain.md exists.
Constraints
- โ Overwrite an existing
domain.md
- โ Invent business content (fields / methods)
- โ Hardcode section list (always read
.claude/scaffold-spec/domain-spec.md)
- โ Skip the identity
AskUserQuestion
- โ Touch any layer other than
domain.md
- โ
Japanese user-facing output
- โ
Validate feature name kebab-case + aggregate name PascalCase
Checklist