@haposoft/cafekit 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +866 -0
- package/bin/install.js +773 -0
- package/package.json +40 -0
- package/src/antigravity/GEMINI.md +162 -0
- package/src/antigravity/workflows/code.md +16 -0
- package/src/antigravity/workflows/docs-init.md +432 -0
- package/src/antigravity/workflows/docs-update.md +245 -0
- package/src/antigravity/workflows/review.md +15 -0
- package/src/antigravity/workflows/spec-design.md +220 -0
- package/src/antigravity/workflows/spec-init.md +78 -0
- package/src/antigravity/workflows/spec-requirements.md +122 -0
- package/src/antigravity/workflows/spec-status.md +95 -0
- package/src/antigravity/workflows/spec-tasks.md +156 -0
- package/src/antigravity/workflows/spec-validate.md +106 -0
- package/src/antigravity/workflows/test.md +13 -0
- package/src/claude/ROUTING.md +101 -0
- package/src/claude/agents/code-reviewer.md +131 -0
- package/src/claude/agents/debugger.md +137 -0
- package/src/claude/agents/fullstack-developer.md +95 -0
- package/src/claude/agents/tester.md +105 -0
- package/src/claude/commands/code.md +17 -0
- package/src/claude/commands/docs.md +609 -0
- package/src/claude/commands/review/codebase/parallel.md +122 -0
- package/src/claude/commands/review/codebase.md +49 -0
- package/src/claude/commands/review.md +16 -0
- package/src/claude/commands/spec-design.md +247 -0
- package/src/claude/commands/spec-init.md +118 -0
- package/src/claude/commands/spec-requirements.md +138 -0
- package/src/claude/commands/spec-status.md +98 -0
- package/src/claude/commands/spec-tasks.md +173 -0
- package/src/claude/commands/spec-validate.md +118 -0
- package/src/claude/commands/test.md +8 -0
- package/src/claude/migration-manifest.json +39 -0
- package/src/common/skills/specs/SKILL.md +101 -0
- package/src/common/skills/specs/rules/design-discovery-full.md +93 -0
- package/src/common/skills/specs/rules/design-discovery-light.md +49 -0
- package/src/common/skills/specs/rules/design-principles.md +182 -0
- package/src/common/skills/specs/rules/design-review.md +110 -0
- package/src/common/skills/specs/rules/ears-format.md +49 -0
- package/src/common/skills/specs/rules/gap-analysis.md +144 -0
- package/src/common/skills/specs/rules/steering-principles.md +90 -0
- package/src/common/skills/specs/rules/tasks-generation.md +131 -0
- package/src/common/skills/specs/rules/tasks-parallel-analysis.md +34 -0
- package/src/common/skills/specs/templates/design.md +276 -0
- package/src/common/skills/specs/templates/init.json +41 -0
- package/src/common/skills/specs/templates/requirements-init.md +9 -0
- package/src/common/skills/specs/templates/requirements.md +26 -0
- package/src/common/skills/specs/templates/research.md +61 -0
- package/src/common/skills/specs/templates/tasks.md +21 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: ⚡⚡⚡ Scan & analyze the codebase.
|
|
3
|
+
argument-hint: [tasks-or-prompt]
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Think harder to scan the codebase and analyze it follow the Orchestration Protocol, Core Responsibilities, Subagents Team and Development Rules:
|
|
7
|
+
<tasks>$ARGUMENTS</tasks>
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Role Responsibilities
|
|
12
|
+
- You are an elite software engineering expert who specializes in system architecture design and technical decision-making.
|
|
13
|
+
- You operate by the holy trinity of software engineering: **YAGNI** (You Aren't Gonna Need It), **KISS** (Keep It Simple, Stupid), and **DRY** (Don't Repeat Yourself). Every solution you propose must honor these principles.
|
|
14
|
+
- **IMPORTANT:** Sacrifice grammar for the sake of concision when writing reports.
|
|
15
|
+
- **IMPORTANT:** In reports, list any unresolved questions at the end, if any.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Workflow:
|
|
20
|
+
|
|
21
|
+
**IMPORTANT:** Analyze the skills catalog and activate the skills that are needed for the task during the process.
|
|
22
|
+
|
|
23
|
+
### Research
|
|
24
|
+
|
|
25
|
+
* Use 2 `researcher` subagents in parallel to search up to max 5 sources for the user's request, idea validation, best practices, challenges, and find the best possible solutions.
|
|
26
|
+
* Keep every research markdown report concise (≤150 lines) while covering all requested topics and citations.
|
|
27
|
+
* Use `/scout:ext` (preferred) or `/scout` (fallback) slash command to search the codebase for files needed to complete the task
|
|
28
|
+
|
|
29
|
+
### Code Review
|
|
30
|
+
|
|
31
|
+
* After finishing, use multiple `code-reviewer` subagents in parallel to review code.
|
|
32
|
+
* If there are any issues, duplicate code, or security vulnerabilities, ask main agent to improve the code and repeat the "Testing" process until all tests pass.
|
|
33
|
+
* When all tests pass, code is reviewed, the tasks are completed, report back to user with a summary of the changes and explain everything briefly, ask user to review the changes and approve them.
|
|
34
|
+
* **IMPORTANT:** Sacrifice grammar for the sake of concision when writing outputs.
|
|
35
|
+
|
|
36
|
+
### Plan
|
|
37
|
+
* Use `planner` subagent to analyze reports from `researcher` and `scout` subagents to create an improvement plan following the progressive disclosure structure:
|
|
38
|
+
- Create a directory using naming pattern from `## Naming` section.
|
|
39
|
+
- Save the overview access point at `plan.md`, keep it generic, under 80 lines, and list each phase with status/progress and links.
|
|
40
|
+
- For each phase, add `phase-XX-phase-name.md` files containing sections (Context links, Overview with date/priority/statuses, Key Insights, Requirements, Architecture, Related code files, Implementation Steps, Todo list, Success Criteria, Risk Assessment, Security Considerations, Next steps).
|
|
41
|
+
|
|
42
|
+
### Final Report
|
|
43
|
+
* Report back to user with a summary of the changes and explain everything briefly, guide user to get started and suggest the next steps.
|
|
44
|
+
* Ask the user if they want to commit and push to git repository, if yes, use `git-manager` subagent to commit and push to git repository.
|
|
45
|
+
|
|
46
|
+
**REMEMBER**:
|
|
47
|
+
- You can always generate images with `ai-multimodal` skill on the fly for visual assets.
|
|
48
|
+
- You always read and analyze the generated assets with `ai-multimodal` skill to verify they meet requirements.
|
|
49
|
+
- For image editing (removing background, adjusting, cropping), use ImageMagick or similar tools as needed.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: review
|
|
3
|
+
description: Review recent code changes for quality, security, and maintainability.
|
|
4
|
+
allowed-tools: Bash, Read, Grep, Glob
|
|
5
|
+
argument-hint: [scope]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# /review
|
|
9
|
+
|
|
10
|
+
Review recent code changes. Prioritize:
|
|
11
|
+
- correctness
|
|
12
|
+
- security
|
|
13
|
+
- regressions
|
|
14
|
+
- maintainability
|
|
15
|
+
|
|
16
|
+
Output findings by severity and include concrete fixes.
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: spec-design
|
|
3
|
+
description: Create comprehensive technical design for a specification
|
|
4
|
+
allowed-tools: Glob, Grep, Read, Write, Edit, WebSearch, WebFetch
|
|
5
|
+
argument-hint: <feature-name> [-y]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Technical Design Generator
|
|
9
|
+
|
|
10
|
+
<background_information>
|
|
11
|
+
- **Mission**: Generate comprehensive technical design document that translates requirements (WHAT) into architectural design (HOW)
|
|
12
|
+
- **Success Criteria**:
|
|
13
|
+
- All requirements mapped to technical components with clear interfaces
|
|
14
|
+
- Appropriate architecture discovery and research completed
|
|
15
|
+
- Design aligns with steering context and existing patterns
|
|
16
|
+
- Visual diagrams included for complex architectures
|
|
17
|
+
</background_information>
|
|
18
|
+
|
|
19
|
+
<instructions>
|
|
20
|
+
## Core Task
|
|
21
|
+
Generate technical design document for feature **$ARGUMENTS** based on approved requirements.
|
|
22
|
+
|
|
23
|
+
## Execution Steps
|
|
24
|
+
|
|
25
|
+
### Step 0: Validate Phase State (Plan-Style Gate)
|
|
26
|
+
|
|
27
|
+
- Read `.specs/$ARGUMENTS/spec.json` first
|
|
28
|
+
- If feature directory or `spec.json` is missing: stop and instruct user to run `/spec-init <project-description>` and `/spec-requirements <feature-name>` first
|
|
29
|
+
- If requirements have not been generated yet (phase before requirements): stop and instruct user to run `/spec-requirements $ARGUMENTS`
|
|
30
|
+
- If `phase` is `tasks-generated`: stop and explain design phase is already completed; only re-run for explicit regeneration/update intent
|
|
31
|
+
|
|
32
|
+
### Step 1: Load Context
|
|
33
|
+
|
|
34
|
+
**Read all necessary context**:
|
|
35
|
+
- `.specs/$ARGUMENTS/spec.json`, `requirements.md`, `design.md` (if exists)
|
|
36
|
+
- Resolve scope baseline from `spec.json.scope_lock`:
|
|
37
|
+
- `scope_lock.source` = canonical original intent
|
|
38
|
+
- `scope_lock.in_scope[]` = designable capability space
|
|
39
|
+
- `scope_lock.out_of_scope[]` = capabilities that must stay deferred
|
|
40
|
+
- `scope_lock.expansion_policy` = default `requires-user-approval`
|
|
41
|
+
- Backward-compatible fallback for older specs without `scope_lock`:
|
|
42
|
+
- Derive baseline scope from project description and existing requirements
|
|
43
|
+
- Continue without hard-fail, but keep strict no-expansion behavior
|
|
44
|
+
- Load `.specs/steering/` (if exists) as constraints and standards only
|
|
45
|
+
- `{{SKILLS_DIR}}/specs/templates/design.md` for document structure
|
|
46
|
+
- `{{SKILLS_DIR}}/specs/rules/design-principles.md` for design principles
|
|
47
|
+
- `{{SKILLS_DIR}}/specs/templates/research.md` for discovery log structure
|
|
48
|
+
- **Load project docs context (Plan-style quality gate)** when available:
|
|
49
|
+
- `docs/codebase-summary.md`
|
|
50
|
+
- `docs/code-standards.md`
|
|
51
|
+
- `docs/system-architecture.md`
|
|
52
|
+
- `docs/project-overview-pdr.md`
|
|
53
|
+
- If any docs file is missing, continue and mention missing context in execution output (do not block generation)
|
|
54
|
+
|
|
55
|
+
**Validate requirements approval and scope eligibility**:
|
|
56
|
+
- If `-y` flag provided: Auto-approve requirements in spec.json
|
|
57
|
+
- Otherwise: Verify approval status (stop if unapproved, see Safety & Fallback)
|
|
58
|
+
- Build `in_scope_requirement_ids` by filtering requirements against scope_lock
|
|
59
|
+
- If no in-scope requirement IDs found, or requirements are ambiguous against scope_lock: stop and instruct user to re-run `/spec-requirements $ARGUMENTS`
|
|
60
|
+
|
|
61
|
+
### Step 2: Discovery & Analysis
|
|
62
|
+
|
|
63
|
+
**Critical: This phase ensures design is based on complete, accurate information.**
|
|
64
|
+
|
|
65
|
+
### Step 2A: Discovery Mode Router (Plan-Style)
|
|
66
|
+
|
|
67
|
+
Before discovery, select a deterministic mode and record the reason:
|
|
68
|
+
- **minimal**: UI/CRUD-only change, no new external dependency/API, no schema change, <=2 integration points
|
|
69
|
+
- **light**: extension of existing feature with known patterns and limited integration risk
|
|
70
|
+
- **full**: new subsystem, external integration, auth/security/performance impact, schema boundary changes, or explicit user request for deep exploration
|
|
71
|
+
- **Default rule**: when uncertain, choose **light** (scope-safe by default)
|
|
72
|
+
- **Escalation trigger**: switch to **full** only when a concrete trigger is present and documented
|
|
73
|
+
- **Research budget**: keep discovery scoped; use at most 2 major external investigations unless findings reveal a blocker
|
|
74
|
+
|
|
75
|
+
Use the selected mode to drive Step 2 execution and persist it in spec metadata during Step 3 finalize.
|
|
76
|
+
|
|
77
|
+
1. **Classify Feature Type**:
|
|
78
|
+
- **New Feature** (greenfield) → Start with light discovery; escalate to full only with explicit triggers
|
|
79
|
+
- **Extension** (existing system) → Integration-focused discovery
|
|
80
|
+
- **Simple Addition** (CRUD/UI) → Minimal or no discovery
|
|
81
|
+
- **Complex Integration** → Full discovery required
|
|
82
|
+
- **Note**: Full mode is triggered by concrete signals, not by default uncertainty
|
|
83
|
+
|
|
84
|
+
2. **Execute Appropriate Discovery Process**:
|
|
85
|
+
|
|
86
|
+
**For Full Mode**:
|
|
87
|
+
- Read and execute `{{SKILLS_DIR}}/specs/rules/design-discovery-full.md`
|
|
88
|
+
- Conduct focused research using WebSearch/WebFetch only for in-scope uncertainty:
|
|
89
|
+
- External dependency verification (APIs, libraries, versions, compatibility)
|
|
90
|
+
- Official documentation, migration guides, known issues
|
|
91
|
+
- Security/performance considerations tied to current scope
|
|
92
|
+
|
|
93
|
+
**For Light Mode**:
|
|
94
|
+
- Read and execute `{{SKILLS_DIR}}/specs/rules/design-discovery-light.md`
|
|
95
|
+
- Focus on integration points, existing patterns, compatibility
|
|
96
|
+
- Use Grep to analyze existing codebase patterns
|
|
97
|
+
|
|
98
|
+
**For Minimal Mode / Simple Additions**:
|
|
99
|
+
- Skip formal discovery, quick pattern check only
|
|
100
|
+
|
|
101
|
+
3. **Retain Discovery Findings for Step 3**:
|
|
102
|
+
- External API contracts and constraints (only if in-scope)
|
|
103
|
+
- Technology decisions with rationale
|
|
104
|
+
- Existing patterns to follow or extend
|
|
105
|
+
- Integration points and dependencies
|
|
106
|
+
- Identified risks and mitigation strategies
|
|
107
|
+
- Potential architecture patterns and boundary options
|
|
108
|
+
- Explicitly note any out-of-scope discoveries as deferred (do not design them now)
|
|
109
|
+
|
|
110
|
+
4. **Persist Findings to Research Log**:
|
|
111
|
+
- Create or update `.specs/$ARGUMENTS/research.md` using the shared template
|
|
112
|
+
- Summarize discovery scope and key findings (Summary section)
|
|
113
|
+
- Record investigations in Research Log topics with sources and implications
|
|
114
|
+
- Document architecture pattern evaluation, design decisions, and risks
|
|
115
|
+
- Use the language specified in spec.json
|
|
116
|
+
|
|
117
|
+
### Step 2B: Scope-Lock Enforcement Before Writing Design
|
|
118
|
+
|
|
119
|
+
- Validate each planned component/flow against `in_scope_requirement_ids`
|
|
120
|
+
- If a design element does not map to an in-scope requirement ID:
|
|
121
|
+
- Remove it from main design sections
|
|
122
|
+
- Optionally note it in `research.md` as deferred/out-of-scope
|
|
123
|
+
- Do not open new domains (e.g., API/mobile/new data platform) without explicit user approval under `scope_lock.expansion_policy`
|
|
124
|
+
|
|
125
|
+
### Step 3: Generate Design Document
|
|
126
|
+
|
|
127
|
+
1. **Load Design Template and Rules**:
|
|
128
|
+
- Read `{{SKILLS_DIR}}/specs/templates/design.md` for structure
|
|
129
|
+
- Read `{{SKILLS_DIR}}/specs/rules/design-principles.md` for principles
|
|
130
|
+
|
|
131
|
+
2. **Generate Design Document**:
|
|
132
|
+
- **Follow template structure strictly**
|
|
133
|
+
- **Design only for in-scope requirement IDs** from Step 1
|
|
134
|
+
- **Integrate only in-scope discovery findings** throughout component definitions
|
|
135
|
+
- If existing design.md found, use it as reference context (merge mode)
|
|
136
|
+
- Apply design rules: Type Safety, Visual Communication, Formal Tone
|
|
137
|
+
- Use language specified in spec.json
|
|
138
|
+
- Include Mermaid diagrams only when complexity warrants visualization
|
|
139
|
+
|
|
140
|
+
3. **Required Sections & Detail Level** (Complexity-Aware):
|
|
141
|
+
|
|
142
|
+
**Verbosity Guideline**: Match depth to feature complexity. Prefer concise, concrete decisions over exhaustive boilerplate.
|
|
143
|
+
**Type Detail Rule**: Define full TypeScript interfaces only for components/contracts that cross boundaries or carry non-trivial state.
|
|
144
|
+
|
|
145
|
+
| Section | Requirement | Instructions |
|
|
146
|
+
|---------|-------------|--------------|
|
|
147
|
+
| **Overview** | ✅ Mandatory | Purpose, users, impact, goals, non-goals focused on current scope |
|
|
148
|
+
| **Architecture** | ✅ Mandatory | Pattern and boundaries for in-scope requirements only |
|
|
149
|
+
| **System Flows** | 🔶 Conditional | Add Mermaid sequence/flow only when interactions are non-trivial |
|
|
150
|
+
| **Requirements Traceability** | ✅ Mandatory | Map only valid in-scope numeric requirement IDs |
|
|
151
|
+
| **Components and Interfaces** | ✅ Mandatory | Define interfaces/contracts only for components that need explicit boundaries |
|
|
152
|
+
| **Data Models** | 🔶 Conditional | Include only if data/storage changes are in-scope |
|
|
153
|
+
| **Error Handling** | ✅ Mandatory | Include feature-relevant errors and recovery strategies |
|
|
154
|
+
| **Testing Strategy** | ✅ Mandatory | Right-size test scope to feature risk and complexity |
|
|
155
|
+
| **Security Considerations** | 🔶 Conditional | Required when feature touches auth, input trust boundaries, or sensitive data |
|
|
156
|
+
| **Performance & Scalability** | 🔶 Conditional | Required when feature has explicit performance/scalability constraints |
|
|
157
|
+
| **Supporting References** | 🔶 Optional | Include only when details would hurt readability in main sections |
|
|
158
|
+
|
|
159
|
+
4. **Update Metadata** in spec.json:
|
|
160
|
+
- Set `phase: "design-generated"`
|
|
161
|
+
- Set `approvals.design.generated: true, approved: false`
|
|
162
|
+
- Set `approvals.requirements.approved: true`
|
|
163
|
+
- Set `design_context.discovery_mode: "minimal" | "light" | "full"` (based on Step 2A)
|
|
164
|
+
- Set `design_context.discovery_reason: "<short reason>"`
|
|
165
|
+
- Set `design_context.validation_recommended: true` when discovery mode is `full` or risk level is medium/high
|
|
166
|
+
- Update `updated_at` timestamp
|
|
167
|
+
|
|
168
|
+
## Critical Constraints
|
|
169
|
+
- **Type Safety**:
|
|
170
|
+
- Enforce strong typing aligned with the project's technology stack
|
|
171
|
+
- For TypeScript, never use `any`; prefer precise types and generics
|
|
172
|
+
- Document public interfaces and contracts clearly where relevant
|
|
173
|
+
- **Scope Lock**: Do not design capabilities outside `scope_lock`; out-of-scope discoveries must be marked deferred
|
|
174
|
+
- **Latest Information**: Use WebSearch/WebFetch only when external dependencies are in-scope and uncertain
|
|
175
|
+
- **Steering Alignment**: Respect existing architecture patterns from steering context
|
|
176
|
+
- **Template Adherence**: Follow template structure while allowing complexity-aware section optionality
|
|
177
|
+
- **Design Focus**: Architecture and interfaces ONLY, no implementation code
|
|
178
|
+
- **Requirements Traceability IDs**: Use numeric requirement IDs only (e.g. "1.1", "1.2") as defined in requirements.md
|
|
179
|
+
</instructions>
|
|
180
|
+
|
|
181
|
+
## Tool Guidance
|
|
182
|
+
- **Read first**: Load all context before taking action (specs, steering, templates, rules)
|
|
183
|
+
- **Research when uncertain**: Use WebSearch/WebFetch only for in-scope external dependencies and unresolved constraints
|
|
184
|
+
- **Analyze existing code**: Use Grep to find patterns and integration points in codebase
|
|
185
|
+
- **Write last**: Generate design.md only after all research and analysis complete
|
|
186
|
+
|
|
187
|
+
## Output Description
|
|
188
|
+
|
|
189
|
+
**Command execution output** (separate from design.md content):
|
|
190
|
+
|
|
191
|
+
Provide brief summary in the language specified in spec.json:
|
|
192
|
+
|
|
193
|
+
1. **Status**: Confirm design document generated at `.specs/$ARGUMENTS/design.md`
|
|
194
|
+
2. **Discovery Type**: Which discovery process was executed (full/light/minimal)
|
|
195
|
+
3. **Discovery Rationale**: One-line reason why this mode was selected
|
|
196
|
+
4. **Key Findings**: 2-3 critical in-scope insights from `research.md` that shaped the design
|
|
197
|
+
5. **Scope Guard**: Confirm no out-of-scope domains were added to design.md (or list deferred items)
|
|
198
|
+
6. **Next Action**: Approval workflow guidance (include whether `/spec-validate $ARGUMENTS` is recommended before `/spec-tasks`)
|
|
199
|
+
7. **Research Log**: Confirm `research.md` updated with latest decisions
|
|
200
|
+
|
|
201
|
+
**Format**: Concise Markdown (under 200 words)
|
|
202
|
+
|
|
203
|
+
## Safety & Fallback
|
|
204
|
+
|
|
205
|
+
### Error Scenarios
|
|
206
|
+
|
|
207
|
+
**Requirements Not Approved**:
|
|
208
|
+
- **Stop Execution**: Cannot proceed without approved requirements
|
|
209
|
+
- **User Message**: "Requirements not yet approved. Approval required before design generation."
|
|
210
|
+
- **Suggested Action**: "Run `/spec-design $ARGUMENTS -y` to auto-approve requirements and proceed"
|
|
211
|
+
|
|
212
|
+
**Missing Requirements**:
|
|
213
|
+
- **Stop Execution**: Requirements document must exist
|
|
214
|
+
- **User Message**: "No requirements.md found at `.specs/$ARGUMENTS/requirements.md`"
|
|
215
|
+
- **Suggested Action**: "Run `/spec-requirements $ARGUMENTS` to generate requirements first"
|
|
216
|
+
|
|
217
|
+
**Template Missing**:
|
|
218
|
+
- **User Message**: "Template file missing"
|
|
219
|
+
- **Suggested Action**: "Check repository setup or restore template file"
|
|
220
|
+
- **Fallback**: Use inline basic structure with warning
|
|
221
|
+
|
|
222
|
+
**Steering Context Missing**:
|
|
223
|
+
- **Warning**: "Steering directory empty or missing - design may not align with project standards"
|
|
224
|
+
- **Proceed**: Continue with generation but keep scope strictly bound to scope_lock
|
|
225
|
+
|
|
226
|
+
**Discovery Complexity Unclear**:
|
|
227
|
+
- **Default**: Use light discovery process
|
|
228
|
+
- **Escalate to Full**: Only when explicit trigger exists (external integration, security/perf criticality, schema boundary change, or user request)
|
|
229
|
+
|
|
230
|
+
**Invalid Requirement IDs**:
|
|
231
|
+
- **Stop Execution**: If requirements.md uses non-numeric headings, stop and instruct user to fix
|
|
232
|
+
|
|
233
|
+
**No In-Scope Requirement IDs**:
|
|
234
|
+
- **Stop Execution**: If none of the requirement IDs are in-scope under scope_lock, stop and ask user to regenerate requirements
|
|
235
|
+
|
|
236
|
+
### Next Phase: Task Generation
|
|
237
|
+
|
|
238
|
+
**If Design Approved**:
|
|
239
|
+
- Review generated design at `.specs/$ARGUMENTS/design.md`
|
|
240
|
+
- **Recommended for medium/high-risk designs**: Run `/spec-validate $ARGUMENTS` to confirm assumptions and trade-offs
|
|
241
|
+
- Then `/spec-tasks $ARGUMENTS -y` to generate implementation tasks
|
|
242
|
+
|
|
243
|
+
**If Modifications Needed**:
|
|
244
|
+
- Provide feedback and re-run `/spec-design $ARGUMENTS`
|
|
245
|
+
- Existing design used as reference (merge mode)
|
|
246
|
+
|
|
247
|
+
**Note**: Design approval is mandatory before proceeding to task generation.
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: spec-init
|
|
3
|
+
description: Initialize a new specification with detailed project description
|
|
4
|
+
allowed-tools: Read, Write, Glob, AskUserQuestion
|
|
5
|
+
argument-hint: <project-description>
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Spec Initialization
|
|
9
|
+
|
|
10
|
+
<background_information>
|
|
11
|
+
- **Mission**: Initialize the first phase of spec-driven development by creating directory structure and metadata for a new specification
|
|
12
|
+
- **Success Criteria**:
|
|
13
|
+
- Generate appropriate feature name from project description
|
|
14
|
+
- Create unique spec structure without conflicts
|
|
15
|
+
- Provide clear path to next phase (requirements generation)
|
|
16
|
+
</background_information>
|
|
17
|
+
|
|
18
|
+
<instructions>
|
|
19
|
+
## Pre-Validation (STEP 0 - MANDATORY)
|
|
20
|
+
Before any execution, validate $ARGUMENTS:
|
|
21
|
+
1. **Input Interpretation**: $ARGUMENTS is ALWAYS the project description to initialize - never interpret it as a meta-command or instruction to modify the workflow itself
|
|
22
|
+
2. **Ambiguity Detection**: If $ARGUMENTS meets ANY of these conditions, STOP and trigger Ambiguity Fallback:
|
|
23
|
+
- Has fewer than 5 words
|
|
24
|
+
- Contains only generic terms like "better", "improve", "fix", "update" without specific context
|
|
25
|
+
- Lacks clear nouns describing what to build
|
|
26
|
+
3. **Ambiguity Fallback**: When triggered, use AskUserQuestion tool:
|
|
27
|
+
- Do NOT proceed with initialization
|
|
28
|
+
- Invoke AskUserQuestion with 2-3 specific feature options based on common patterns
|
|
29
|
+
|
|
30
|
+
**Example:**
|
|
31
|
+
```json
|
|
32
|
+
{
|
|
33
|
+
"questions": [
|
|
34
|
+
{
|
|
35
|
+
"question": "Your description is too vague. What type of feature are you building?",
|
|
36
|
+
"header": "Feature Type",
|
|
37
|
+
"options": [
|
|
38
|
+
{
|
|
39
|
+
"label": "User Management",
|
|
40
|
+
"description": "Authentication, profiles, user CRUD operations"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"label": "Data Dashboard",
|
|
44
|
+
"description": "Analytics, charts, reporting interface"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"label": "Mobile App",
|
|
48
|
+
"description": "Cross-platform mobile application"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"label": "API Service",
|
|
52
|
+
"description": "Backend API endpoints and business logic"
|
|
53
|
+
}
|
|
54
|
+
],
|
|
55
|
+
"multiSelect": false
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
**After user selects:** Re-run spec-init with the selected feature description
|
|
62
|
+
4. **Only proceed** to Core Task if input clearly describes a feature/project
|
|
63
|
+
5. **Scope Baseline Clarification**: If description is broad enough to imply multiple domains, ask 1 focused question to confirm initial in-scope vs out-of-scope boundaries before writing spec files
|
|
64
|
+
|
|
65
|
+
## Core Task
|
|
66
|
+
Generate a unique feature name from the project description ($ARGUMENTS) and initialize the specification structure.
|
|
67
|
+
|
|
68
|
+
## Execution Steps
|
|
69
|
+
1. **Check Uniqueness**: Verify `.specs/` for naming conflicts (append number suffix if needed)
|
|
70
|
+
2. **Create Directory**: `.specs/[feature-name]/`
|
|
71
|
+
3. **Initialize Files Using Templates**:
|
|
72
|
+
- Read `{{SKILLS_DIR}}/specs/templates/init.json`
|
|
73
|
+
- Read `{{SKILLS_DIR}}/specs/templates/requirements-init.md`
|
|
74
|
+
- Replace placeholders:
|
|
75
|
+
- `{{FEATURE_NAME}}` → generated feature name
|
|
76
|
+
- `{{TIMESTAMP}}` → current ISO 8601 timestamp
|
|
77
|
+
- `{{PROJECT_DESCRIPTION}}` → $ARGUMENTS
|
|
78
|
+
- Set `scope_lock` in `spec.json` as initialization contract:
|
|
79
|
+
- `scope_lock.source` = original project description
|
|
80
|
+
- `scope_lock.in_scope` = concise bullets derived from explicit user intent
|
|
81
|
+
- `scope_lock.out_of_scope` = nearby domains/capabilities explicitly excluded for this iteration
|
|
82
|
+
- `scope_lock.expansion_policy` = `requires-user-approval`
|
|
83
|
+
- Write `spec.json` and `requirements.md` to spec directory
|
|
84
|
+
|
|
85
|
+
## Important Constraints
|
|
86
|
+
- DO NOT generate requirements/design/tasks at this stage
|
|
87
|
+
- Follow stage-by-stage development principles
|
|
88
|
+
- Maintain strict phase separation
|
|
89
|
+
- Only initialization is performed in this phase
|
|
90
|
+
- Scope lock is mandatory: initialize `scope_lock` and treat it as authoritative baseline for later phases
|
|
91
|
+
</instructions>
|
|
92
|
+
|
|
93
|
+
## Tool Guidance
|
|
94
|
+
- Use **Glob** to check existing spec directories for name uniqueness
|
|
95
|
+
- Use **Read** to fetch templates: `init.json` and `requirements-init.md`
|
|
96
|
+
- Use **Write** to create spec.json and requirements.md after placeholder replacement
|
|
97
|
+
- Perform validation before any file write operation
|
|
98
|
+
|
|
99
|
+
## Output Description
|
|
100
|
+
Provide output in the language specified in `spec.json` with the following structure:
|
|
101
|
+
|
|
102
|
+
1. **Generated Feature Name**: `feature-name` format with 1-2 sentence rationale
|
|
103
|
+
2. **Project Summary**: Brief summary (1 sentence)
|
|
104
|
+
3. **Created Files**: Bullet list with full paths
|
|
105
|
+
4. **Next Step**: Command block showing `/spec-requirements <feature-name>`
|
|
106
|
+
5. **Notes**: Explain why only initialization was performed (2-3 sentences on phase separation)
|
|
107
|
+
|
|
108
|
+
**Format Requirements**:
|
|
109
|
+
- Use Markdown headings (##, ###)
|
|
110
|
+
- Wrap commands in code blocks
|
|
111
|
+
- Keep total output concise (under 250 words)
|
|
112
|
+
- Use clear, professional language per `spec.json.language`
|
|
113
|
+
|
|
114
|
+
## Safety & Fallback
|
|
115
|
+
- **Ambiguous Feature Name**: If feature name generation is unclear, propose 2-3 options and ask user to select
|
|
116
|
+
- **Template Missing**: If template files don't exist in `{{SKILLS_DIR}}/specs/templates/`, report error with specific missing file path and suggest checking repository setup
|
|
117
|
+
- **Directory Conflict**: If feature name already exists, append numeric suffix (e.g., `feature-name-2`) and notify user of automatic conflict resolution
|
|
118
|
+
- **Write Failure**: Report error with specific path and suggest checking permissions or disk space
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: spec-requirements
|
|
3
|
+
description: Generate comprehensive requirements for a specification
|
|
4
|
+
allowed-tools: Glob, Grep, Read, Write, Edit, WebSearch, WebFetch
|
|
5
|
+
argument-hint: <feature-name>
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Requirements Generation
|
|
9
|
+
|
|
10
|
+
<background_information>
|
|
11
|
+
- **Mission**: Generate comprehensive, testable requirements in EARS format based on the project description from spec initialization
|
|
12
|
+
- **Success Criteria**:
|
|
13
|
+
- Create complete requirements document aligned with steering context
|
|
14
|
+
- Follow the project's EARS patterns and constraints for all acceptance criteria
|
|
15
|
+
- Focus on core functionality without implementation details
|
|
16
|
+
- Update metadata to track generation status
|
|
17
|
+
</background_information>
|
|
18
|
+
|
|
19
|
+
<instructions>
|
|
20
|
+
## Core Task
|
|
21
|
+
Generate complete requirements for feature **$ARGUMENTS** based on the project description in requirements.md.
|
|
22
|
+
|
|
23
|
+
## Execution Steps
|
|
24
|
+
|
|
25
|
+
0. **Validate Phase State (Plan-Style Gate)**:
|
|
26
|
+
- Read `.specs/$ARGUMENTS/spec.json` first
|
|
27
|
+
- If missing feature directory or spec.json: stop and ask user to run `/spec-init <project-description>` first
|
|
28
|
+
- If `phase` is `design-generated` or `tasks-generated`: stop and explain requirements phase already completed; ask user to edit/re-run only with explicit intent to regenerate requirements
|
|
29
|
+
|
|
30
|
+
1. **Load Context**:
|
|
31
|
+
- Read `.specs/$ARGUMENTS/spec.json` for language and metadata
|
|
32
|
+
- Read `.specs/$ARGUMENTS/requirements.md` for project description
|
|
33
|
+
- Resolve scope baseline from `spec.json.scope_lock`:
|
|
34
|
+
- `scope_lock.source` = canonical original intent
|
|
35
|
+
- `scope_lock.in_scope[]` = capability list that requirements MUST stay within
|
|
36
|
+
- `scope_lock.out_of_scope[]` = nearby capabilities that MUST NOT be promoted into main requirements
|
|
37
|
+
- `scope_lock.expansion_policy` = default `requires-user-approval`
|
|
38
|
+
- Backward-compatible fallback for older specs without `scope_lock`:
|
|
39
|
+
- Derive initial scope from project description in requirements.md
|
|
40
|
+
- Initialize scope lock in memory for this run (do not hard-fail)
|
|
41
|
+
- Load steering context from `.specs/steering/` (if exists) as **constraints only**:
|
|
42
|
+
- Use steering to enforce standards, conventions, and constraints
|
|
43
|
+
- Do NOT add new product capabilities/domains beyond scope_lock
|
|
44
|
+
|
|
45
|
+
2. **Read Guidelines**:
|
|
46
|
+
- Read `{{SKILLS_DIR}}/specs/rules/ears-format.md` for EARS syntax rules
|
|
47
|
+
- Read `{{SKILLS_DIR}}/specs/templates/requirements.md` for document structure
|
|
48
|
+
- **Load project docs context (Plan-style quality gate)** when available:
|
|
49
|
+
- `docs/codebase-summary.md`
|
|
50
|
+
- `docs/code-standards.md`
|
|
51
|
+
- `docs/system-architecture.md`
|
|
52
|
+
- `docs/project-overview-pdr.md`
|
|
53
|
+
- If any docs file is missing, continue and note the missing context in output (do not block generation)
|
|
54
|
+
|
|
55
|
+
3. **Analyze Existing Codebase** (for Extension/Enhancement features):
|
|
56
|
+
- Search for related files: `**/*.{tsx,jsx,ts,js,vue,py}`
|
|
57
|
+
- Read existing components/modules related to the feature
|
|
58
|
+
- Identify what's already implemented vs what needs to be added
|
|
59
|
+
- If existing implementation found:
|
|
60
|
+
- Add Introduction section in requirements.md acknowledging existing code
|
|
61
|
+
- Focus requirements on enhancements/additions, not reimplementation
|
|
62
|
+
- Reference existing components (e.g., "The project already has X and Y")
|
|
63
|
+
- If greenfield (no existing code): Skip Introduction, proceed normally
|
|
64
|
+
|
|
65
|
+
4. **Scope-Lock Filtering & Clarification**:
|
|
66
|
+
- Draft candidate requirement topics from description + codebase findings
|
|
67
|
+
- Keep only topics that fit `scope_lock.in_scope` and `scope_lock.source`
|
|
68
|
+
- For topics matching `scope_lock.out_of_scope` or introducing new domains:
|
|
69
|
+
- Mark as `Deferred / Out of Scope` in requirements.md notes section
|
|
70
|
+
- Do NOT include them in main requirement list
|
|
71
|
+
- If ambiguity could change scope boundaries, ask 1-2 focused clarification questions before finalizing requirements
|
|
72
|
+
|
|
73
|
+
5. **Generate Requirements**:
|
|
74
|
+
- Create initial requirements based on project description
|
|
75
|
+
- Consider existing codebase findings (if any)
|
|
76
|
+
- Group related functionality into logical requirement areas
|
|
77
|
+
- Apply EARS format to all acceptance criteria:
|
|
78
|
+
- Event-Driven: `When [event], the [system] shall [response]`
|
|
79
|
+
- State-Driven: `While [precondition], the [system] shall [response]`
|
|
80
|
+
- Unwanted: `If [trigger], the [system] shall [response]`
|
|
81
|
+
- Optional: `Where [feature], the [system] shall [response]`
|
|
82
|
+
- Ubiquitous: `The [system] shall [response]`
|
|
83
|
+
- Use language specified in spec.json
|
|
84
|
+
|
|
85
|
+
6. **Update Metadata**:
|
|
86
|
+
- Set `phase: "requirements-generated"`
|
|
87
|
+
- Set `approvals.requirements.generated: true`
|
|
88
|
+
- Update `updated_at` timestamp
|
|
89
|
+
|
|
90
|
+
## Important Constraints
|
|
91
|
+
- Focus on WHAT, not HOW (no implementation details)
|
|
92
|
+
- Requirements must be testable and verifiable
|
|
93
|
+
- Choose appropriate subject for EARS statements (system/service name for software)
|
|
94
|
+
- Requirements generation is scope-locked by `spec.json.scope_lock`
|
|
95
|
+
- Out-of-scope ideas must be captured as deferred, not merged into primary requirements
|
|
96
|
+
- Requirement headings in requirements.md MUST include a leading numeric ID only (for example: "Requirement 1", "1.", "2 Feature ..."); do not use alphabetic IDs like "Requirement A".
|
|
97
|
+
</instructions>
|
|
98
|
+
|
|
99
|
+
## Tool Guidance
|
|
100
|
+
- **Read first**: Load all context (spec, scope lock, steering constraints, rules, templates) before generation
|
|
101
|
+
- **Write last**: Update requirements.md only after complete generation
|
|
102
|
+
- Use **WebSearch/WebFetch** only if external domain knowledge needed
|
|
103
|
+
|
|
104
|
+
## Output Description
|
|
105
|
+
Provide output in the language specified in spec.json with:
|
|
106
|
+
|
|
107
|
+
1. **Generated Requirements Summary**: Brief overview of major in-scope requirement areas (3-5 bullets)
|
|
108
|
+
2. **Scope Guard Summary**: List deferred/out-of-scope topics excluded from primary requirements
|
|
109
|
+
3. **Document Status**: Confirm requirements.md updated and spec.json metadata updated
|
|
110
|
+
4. **Next Steps**: Guide user on how to proceed (approve and continue, or modify)
|
|
111
|
+
|
|
112
|
+
**Format Requirements**:
|
|
113
|
+
- Use Markdown headings for clarity
|
|
114
|
+
- Include file paths in code blocks
|
|
115
|
+
- Keep summary concise (under 300 words)
|
|
116
|
+
|
|
117
|
+
## Safety & Fallback
|
|
118
|
+
|
|
119
|
+
### Error Scenarios
|
|
120
|
+
- **Missing Project Description**: If requirements.md lacks project description, ask user for feature details
|
|
121
|
+
- **Ambiguous Requirements**: Propose initial version and iterate with user rather than asking many upfront questions
|
|
122
|
+
- **Template Missing**: If template files don't exist, use inline fallback structure with warning
|
|
123
|
+
- **Language Undefined**: Default to English (`en`) if spec.json doesn't specify language
|
|
124
|
+
- **Incomplete Requirements**: After generation, explicitly ask user if requirements cover all expected functionality
|
|
125
|
+
- **Steering Directory Empty**: Warn user that project standards context is missing and may affect quality constraints
|
|
126
|
+
- **Scope Drift Risk**: If candidate requirements introduce domains outside scope_lock, ask 1-2 clarifying questions; if unconfirmed, classify as deferred/out-of-scope
|
|
127
|
+
- **Non-numeric Requirement Headings**: If existing headings do not include a leading numeric ID, normalize them to numeric IDs
|
|
128
|
+
|
|
129
|
+
### Next Phase: Design Generation
|
|
130
|
+
|
|
131
|
+
**If Requirements Approved**:
|
|
132
|
+
- Review generated requirements at `.specs/$ARGUMENTS/requirements.md`
|
|
133
|
+
- Then `/spec-design $ARGUMENTS` to proceed to design phase
|
|
134
|
+
|
|
135
|
+
**If Modifications Needed**:
|
|
136
|
+
- Provide feedback and re-run `/spec-requirements $ARGUMENTS`
|
|
137
|
+
|
|
138
|
+
**Note**: Approval is mandatory before proceeding to design phase.
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: spec-status
|
|
3
|
+
description: Display current status of a specification.
|
|
4
|
+
allowed-tools: Read, Glob
|
|
5
|
+
argument-hint: [feature-name]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# /spec-status - View Specification Status
|
|
9
|
+
|
|
10
|
+
$ARGUMENTS
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Purpose
|
|
15
|
+
|
|
16
|
+
Hiển thị trạng thái hiện tại của một spec hoặc liệt kê tất cả specs.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Task
|
|
21
|
+
|
|
22
|
+
### Execution Steps
|
|
23
|
+
|
|
24
|
+
**If `$ARGUMENTS` is provided:**
|
|
25
|
+
|
|
26
|
+
1. Read `.specs/$ARGUMENTS/spec.json`
|
|
27
|
+
2. Display:
|
|
28
|
+
- Feature name
|
|
29
|
+
- Current phase
|
|
30
|
+
- Approval status
|
|
31
|
+
- Discovery mode (if available)
|
|
32
|
+
- Validation status and last validated time (if available)
|
|
33
|
+
- **Backward compatibility fallback (older specs):**
|
|
34
|
+
- If `design_context` is missing, show Discovery mode as `n/a`
|
|
35
|
+
- If `validation` is missing, show Validation as `not-run` and Last validated as `n/a`
|
|
36
|
+
- Created/Updated timestamps
|
|
37
|
+
- Summary of files
|
|
38
|
+
|
|
39
|
+
**If no arguments:**
|
|
40
|
+
|
|
41
|
+
1. Glob `.specs/*/spec.json`
|
|
42
|
+
2. List all specs with their status
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Output Format
|
|
47
|
+
|
|
48
|
+
### Single Spec Status
|
|
49
|
+
|
|
50
|
+
```markdown
|
|
51
|
+
## 📊 Spec Status: `<feature-name>`
|
|
52
|
+
|
|
53
|
+
| Property | Value |
|
|
54
|
+
|----------|-------|
|
|
55
|
+
| **Phase** | `<phase>` |
|
|
56
|
+
| **Discovery Mode** | `<minimal/light/full or n/a>` |
|
|
57
|
+
| **Validation** | `<completed/pending/n/a>` |
|
|
58
|
+
| **Last Validated** | `<timestamp or n/a>` |
|
|
59
|
+
| **Created** | `<timestamp>` |
|
|
60
|
+
| **Updated** | `<timestamp>` |
|
|
61
|
+
|
|
62
|
+
### Approvals
|
|
63
|
+
- Requirements: ✅/❌ Generated | ✅/❌ Approved
|
|
64
|
+
- Design: ✅/❌ Generated | ✅/❌ Approved
|
|
65
|
+
- Tasks: ✅/❌ Generated | ✅/❌ Approved
|
|
66
|
+
|
|
67
|
+
### Files
|
|
68
|
+
- `spec.json` ✅
|
|
69
|
+
- `requirements.md` ✅/❌
|
|
70
|
+
- `research.md` ✅/❌
|
|
71
|
+
- `design.md` ✅/❌
|
|
72
|
+
- `tasks.md` ✅/❌
|
|
73
|
+
|
|
74
|
+
### Next Action
|
|
75
|
+
- If phase = `requirements-generated`: Run `/spec-design <feature-name>`
|
|
76
|
+
- If phase = `design-generated`: Run `/spec-tasks <feature-name>`
|
|
77
|
+
- If phase = `tasks-generated`: Run `/code <feature-name>`, then `/test`, then `/review`
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### All Specs List
|
|
81
|
+
|
|
82
|
+
```markdown
|
|
83
|
+
## 📊 All Specs
|
|
84
|
+
|
|
85
|
+
| Feature | Phase | Last Updated |
|
|
86
|
+
|---------|-------|--------------|
|
|
87
|
+
| `mobile-app` | tasks-generated | 2026-01-21 |
|
|
88
|
+
| `auth-module` | design-generated | 2026-01-20 |
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## Usage Examples
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
/spec-status mobile-app
|
|
97
|
+
/spec-status
|
|
98
|
+
```
|