| name | new-spec-usecase |
| description | Create the usecase layer spec template at `docs/spec/<feature>/usecase.md`. Asks for feature name (kebab-case) + usecase package name (lowercase, e.g., `user`) + Usecase interface name (default `Usecase`) via `AskUserQuestion`, reads the section structure for the usecase layer from `.claude/scaffold-spec/usecase-spec.md`, then writes a Markdown file with YAML code-block placeholders and TODO markers (Overview / Interface / DTOs / Dependencies / Workflow). 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 โ Usecase
Create the usecase 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 usecase layer spec template.
- Adding the usecase spec to an existing feature directory.
Do NOT use this skill for:
- Editing an existing
usecase.md โ open in the editor directly.
- Generating Go code from spec โ that's
scaffold-usecase.
- 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/usecase-spec.md โ canonical section list for the usecase layer.
docs/spec/<feature>/ โ checks whether usecase.md already exists.
Writes (with confirmation):
docs/spec/<feature>/usecase.md โ template file.
Never touches:
- Existing
usecase.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-]*$.
- Usecase package name โ free-text, lowercase (e.g.,
user, order).
- Usecase interface name โ free-text, default
Usecase (PascalCase).
If docs/spec/<feature>/usecase.md exists โ abort. Otherwise create docs/spec/<feature>/ if missing.
Step 1. Read Section Definitions
Read .claude/scaffold-spec/usecase-spec.md for the canonical section list:
- Overview
- Interface
- DTOs
- Dependencies
- Workflow
NEVER hardcode โ re-read the spec format file each run.
Step 2. Generate the Template
Assemble Markdown with H1 title <FeatureName Display> โ Usecase Spec, then per section:
- Overview: single
TODO: line
- Interface: YAML code block with
package / name / methods (1 placeholder method)
- DTOs: YAML code block with placeholder DTO struct
- Dependencies: YAML code block with placeholder boundary list
- Workflow: H3 per method with YAML block (
tx_required / steps / calls / errors)
Use the example output shown in .claude/scaffold-spec/usecase-spec.md as the literal template format.
Step 3. Confirm and Write
Display proposed path + first ~20 lines, then ask:
- ใไปฅไธใฎๅ
ๅฎนใง
docs/spec/<feature>/usecase.md ใไฝๆใใพใใ๏ผใ
- Options: ใไฝๆใใใ / ใใญใฃใณใปใซใ
If approved, mkdir -p docs/spec/<feature> and Write the file.
Step 4. Closing
docs/spec/<feature>/usecase.md ใไฝๆใใพใใใๆฌกใฏ editor ใง TODO ใๅใใฆใใ ใใใ
domain spec ใๅฟ
่ฆใชใ new-spec-domain ใพใใฏ็ตฑๅ 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
usecase.md exists.
Constraints
- โ Overwrite an existing
usecase.md
- โ Invent business content (methods / DTOs / workflow)
- โ Hardcode section list (always read
.claude/scaffold-spec/usecase-spec.md)
- โ Skip the identity
AskUserQuestion
- โ Touch any layer other than
usecase.md
- โ
Japanese user-facing output
- โ
Validate feature name kebab-case + package name lowercase
Checklist