User Input
You MUST consider the user input before proceeding (if not empty).
The text in the task description is the feature description. Assume you always have it available. Do not ask the user to repeat it unless they provided an empty command.
Outline
Given that feature description, do this:
Output
All outputs are written under your task's Artifact path: (from task metadata).
spec.md ← main artifact (feature specification)
requirements-checklist.md ← quality checklist (if applicable)
Workflow
Load constitution document (if available) to understand principles and constraints.
Load clarification.md if it exists ({{BASE_PATH}}/clarification.md or path from dependencyArtifacts). Treat every field that has an explicit value (i.e., resolution: user or resolution: default) as already resolved — do NOT re-ask the user about it and do NOT count it against the [NEEDS CLARIFICATION] budget below. Items listed under blocking_gaps should be treated as known risks but still do not count against the budget (they are surfaced separately by the coordinator).
Read knowledge-graph.json (and, if needed, the query guidance in skills/building-java-knowledge-graph/SKILL.md) to understand the architecture and dependencies related to this feature. Also check for research files if available.
Load skills/writing-feature-spec/templates/spec-template.md for required sections.
Execute:
- Parse feature description from task
If empty: ERROR "No feature description provided"
- Extract key concepts: actors, actions, data, constraints
- Assign unique requirement IDs (CRITICAL for traceability):
- Format:
REQ-XXX where XXX is a 3-digit sequence number (001, 002, ...)
- Example:
REQ-001, REQ-002, REQ-003
- Each requirement MUST have unique ID across entire feature
- For unclear aspects:
- Make informed guesses based on context and industry standards
- Items already answered in
clarification.md are NOT unclear — use the user's answer (or the recorded default) and do not mark them.
- Only mark with [NEEDS CLARIFICATION: specific question] if:
- The choice significantly impacts feature scope or user experience
- Multiple reasonable interpretations exist with different implications
- No reasonable default exists
- LIMIT: Maximum 3 [NEEDS CLARIFICATION] markers total
- Prioritize clarifications by impact: scope > security/privacy > user experience > technical details
- Fill User Scenarios & Testing section
If no clear user flow: ERROR "Cannot determine user scenarios"
- Generate Functional Requirements
Each requirement must be testable
Use reasonable defaults for unspecified details (document assumptions in Assumptions section)
- Define Success Criteria
Create measurable, technology-agnostic outcomes
Include both quantitative metrics (time, performance, volume) and qualitative measures (user satisfaction, task completion)
Each criterion must be verifiable without implementation details
- Identify Key Entities (if data involved)
- Return: SUCCESS (spec ready for planning)
Write the specification to the assigned artifact path using the template structure, replacing placeholders with concrete details derived from the feature description while preserving section order and headings.
Report completion with spec file path, checklist results, and readiness for the next phase.
Research-Driven Mode
When pre-built research files are available (provided by a design/explore phase), use this alternate workflow instead of reading source code directly:
⚠️ NO Direct Codebase Exploration
When research files exist, do NOT read project source files directly (source code, build files, config files). All codebase analysis is already in the research files.
Research File Inputs
Look for these files in the current working directory or as referenced in the task:
project-structure.md — functional domain list (REQUIRED)
tech-stack.md — technology inventory (REQUIRED)
data-model.md — key entities summary (optional)
architecture-summary.md — substitute for direct knowledge graph reading (optional)
- Any additional
*.md research files (optional)
Domain-Driven Generation
Use the functional domain list from project-structure.md to drive:
- User Scenarios: For each domain, generate 1–3 user stories (P1/P2/P3, Given-When-Then)
- Requirements: For each domain, generate 2–4 REQ-XXX items referencing constitution principles
- Key Entities: Use entities from
data-model.md directly (top 6–8)
Incremental Section Writing
Write the spec section by section, appending each to the assigned artifact before moving to the next:
- Header + Scope Baseline → create/write artifact
- User Scenarios & Testing → append
- Requirements (Functional per domain + Non-Functional) → append
- Success Criteria → append
Checklist Generation
After spec is complete, append a quality checklist section at the end of the artifact:
Requirements Quality Checklist
Requirement ID Coverage
Testability
Completeness
Constitution Alignment
General Guidelines
- Focus on WHAT users need and WHY.
- Avoid HOW to implement (no tech stack, APIs, code structure).
- Written for business stakeholders, not developers.
- DO NOT create any checklists that are embedded in the spec. That will be a separate command.
Section Requirements
- Mandatory sections: Must be completed for every feature
- Optional sections: Include only when relevant to the feature
- When a section doesn't apply, remove it entirely (don't leave as "N/A")
For AI Generation
When creating this spec from a user prompt:
- Make informed guesses: Use context, industry standards, and common patterns to fill gaps
- Document assumptions: Record reasonable defaults in the Assumptions section
- Limit clarifications: Maximum 3 [NEEDS CLARIFICATION] markers - use only for critical decisions that:
- Significantly impact feature scope or user experience
- Have multiple reasonable interpretations with different implications
- Lack any reasonable default
- Prioritize clarifications: scope > security/privacy > user experience > technical details
- Think like a tester: Every vague requirement should fail the "testable and unambiguous" checklist item
- Common areas needing clarification (only if no reasonable default exists):
- Feature scope and boundaries (include/exclude specific use cases)
- User types and permissions (if multiple conflicting interpretations possible)
- Security/compliance requirements (when legally/financially significant)
Examples of reasonable defaults (don't ask about these):
- Data retention: Industry-standard practices for the domain
- Performance targets: Standard web/mobile app expectations unless specified
- Error handling: User-friendly messages with appropriate fallbacks
- Authentication method: Standard session-based or OAuth2 for web apps
- Integration patterns: RESTful APIs unless specified otherwise
Success Criteria Guidelines
Success criteria must be:
- Measurable: Include specific metrics (time, percentage, count, rate)
- Technology-agnostic: No mention of frameworks, languages, databases, or tools
- User-focused: Describe outcomes from user/business perspective, not system internals
- Verifiable: Can be tested/validated without knowing implementation details
Good examples:
- "Users can complete checkout in under 3 minutes"
- "System supports 10,000 concurrent users"
- "95% of searches return results in under 1 second"
- "Task completion rate improves by 40%"
Bad examples (implementation-focused):
- "API response time is under 200ms" (too technical, use "Users see results instantly")
- "Database can handle 1000 TPS" (implementation detail, use user-facing metric)
- "React components render efficiently" (framework-specific)
- "Redis cache hit rate above 80%" (technology-specific)
Resources
Templates
templates/spec-template.md — Specification document template with all mandatory sections
1---2name: feature-inventory3description: Catalogs existing features from a codebase (API endpoints, user flows, UI screens, observable behaviors) and generates structured feature specs with REQ-XXX IDs, user scenarios, and success criteria. Triggers: "inventory features", "catalog existing functionality", "list what the app does", "extract requirements from code", "generate feature specs from research", "write a spec", "create feature specification", "define requirements". NOT for: implementation planning (use creating-implementation-plan), implementation (use implementing-code).4---567## User Input89You **MUST** consider the user input before proceeding (if not empty).1011The text in the task description **is** the feature description. Assume you always have it available. Do not ask the user to repeat it unless they provided an empty command.1213## Outline1415Given that feature description, do this:1617## Output1819All outputs are written under your task's `Artifact path:` (from task metadata).2021```22spec.md ← main artifact (feature specification)23requirements-checklist.md ← quality checklist (if applicable)24```2526## Workflow27281. Load constitution document (if available) to understand principles and constraints.29302. **Load `clarification.md` if it exists** (`{{BASE_PATH}}/clarification.md` or path from `dependencyArtifacts`). Treat every field that has an explicit value (i.e., `resolution: user` or `resolution: default`) as **already resolved** — do NOT re-ask the user about it and do NOT count it against the `[NEEDS CLARIFICATION]` budget below. Items listed under `blocking_gaps` should be treated as known risks but still do not count against the budget (they are surfaced separately by the coordinator).31323. Read `knowledge-graph.json` (and, if needed, the query guidance in `skills/building-java-knowledge-graph/SKILL.md`) to understand the architecture and dependencies related to this feature. Also check for research files if available.33344. Load `skills/writing-feature-spec/templates/spec-template.md` for required sections.35365. Execute:37 1. Parse feature description from task38 If empty: ERROR "No feature description provided"39 2. Extract key concepts: actors, actions, data, constraints40 3. **Assign unique requirement IDs** (CRITICAL for traceability):41 - Format: `REQ-XXX` where XXX is a 3-digit sequence number (001, 002, ...)42 - Example: `REQ-001`, `REQ-002`, `REQ-003`43 - Each requirement MUST have unique ID across entire feature44 4. For unclear aspects:45 - Make informed guesses based on context and industry standards46 - **Items already answered in `clarification.md` are NOT unclear** — use the user's answer (or the recorded default) and do not mark them.47 - Only mark with [NEEDS CLARIFICATION: specific question] if:48 - The choice significantly impacts feature scope or user experience49 - Multiple reasonable interpretations exist with different implications50 - No reasonable default exists51 - **LIMIT: Maximum 3 [NEEDS CLARIFICATION] markers total**52 - Prioritize clarifications by impact: scope > security/privacy > user experience > technical details53 5. Fill User Scenarios & Testing section54 If no clear user flow: ERROR "Cannot determine user scenarios"55 6. Generate Functional Requirements56 Each requirement must be testable57 Use reasonable defaults for unspecified details (document assumptions in Assumptions section)58 7. Define Success Criteria59 Create measurable, technology-agnostic outcomes60 Include both quantitative metrics (time, performance, volume) and qualitative measures (user satisfaction, task completion)61 Each criterion must be verifiable without implementation details62 8. Identify Key Entities (if data involved)63 9. Return: SUCCESS (spec ready for planning)64656. Write the specification to the assigned artifact path using the template structure, replacing placeholders with concrete details derived from the feature description while preserving section order and headings.66677. Report completion with spec file path, checklist results, and readiness for the next phase.6869## Research-Driven Mode7071When pre-built research files are available (provided by a design/explore phase), use this alternate workflow instead of reading source code directly:7273### ⚠️ NO Direct Codebase Exploration74When research files exist, do NOT read project source files directly (source code, build files, config files). All codebase analysis is already in the research files.7576### Research File Inputs7778Look for these files in the current working directory or as referenced in the task:79- `project-structure.md` — functional domain list (REQUIRED)80- `tech-stack.md` — technology inventory (REQUIRED)81- `data-model.md` — key entities summary (optional)82- `architecture-summary.md` — substitute for direct knowledge graph reading (optional)83- Any additional `*.md` research files (optional)8485### Domain-Driven Generation86Use the functional domain list from `project-structure.md` to drive:87- **User Scenarios**: For each domain, generate 1–3 user stories (P1/P2/P3, Given-When-Then)88- **Requirements**: For each domain, generate 2–4 REQ-XXX items referencing constitution principles89- **Key Entities**: Use entities from `data-model.md` directly (top 6–8)9091### Incremental Section Writing92Write the spec **section by section**, appending each to the assigned artifact before moving to the next:931. Header + Scope Baseline → create/write artifact942. User Scenarios & Testing → append953. Requirements (Functional per domain + Non-Functional) → append964. Success Criteria → append9798### Checklist Generation99After spec is complete, append a quality checklist section at the end of the artifact:100# Requirements Quality Checklist101102## Requirement ID Coverage103- [ ] All requirements use REQ-XXX format104- [ ] IDs are unique and sequential105106## Testability107- [ ] Every requirement is independently testable108- [ ] Acceptance criteria are concrete (Given-When-Then)109110## Completeness111- [ ] Scope Baseline section complete112- [ ] User Scenarios prioritized (P1, P2, P3)113- [ ] Functional requirements cover all in-scope items114- [ ] Success criteria are measurable115116## Constitution Alignment117- [ ] All constitution principles referenced118- [ ] Migration mode constraints respected119120---121122## General Guidelines123124- Focus on **WHAT** users need and **WHY**.125- Avoid HOW to implement (no tech stack, APIs, code structure).126- Written for business stakeholders, not developers.127- DO NOT create any checklists that are embedded in the spec. That will be a separate command.128129### Section Requirements130131- **Mandatory sections**: Must be completed for every feature132- **Optional sections**: Include only when relevant to the feature133- When a section doesn't apply, remove it entirely (don't leave as "N/A")134135### For AI Generation136137When creating this spec from a user prompt:1381391. **Make informed guesses**: Use context, industry standards, and common patterns to fill gaps1402. **Document assumptions**: Record reasonable defaults in the Assumptions section1413. **Limit clarifications**: Maximum 3 [NEEDS CLARIFICATION] markers - use only for critical decisions that:142 - Significantly impact feature scope or user experience143 - Have multiple reasonable interpretations with different implications144 - Lack any reasonable default1454. **Prioritize clarifications**: scope > security/privacy > user experience > technical details1465. **Think like a tester**: Every vague requirement should fail the "testable and unambiguous" checklist item1476. **Common areas needing clarification** (only if no reasonable default exists):148 - Feature scope and boundaries (include/exclude specific use cases)149 - User types and permissions (if multiple conflicting interpretations possible)150 - Security/compliance requirements (when legally/financially significant)151152**Examples of reasonable defaults** (don't ask about these):153154- Data retention: Industry-standard practices for the domain155- Performance targets: Standard web/mobile app expectations unless specified156- Error handling: User-friendly messages with appropriate fallbacks157- Authentication method: Standard session-based or OAuth2 for web apps158- Integration patterns: RESTful APIs unless specified otherwise159160### Success Criteria Guidelines161162Success criteria must be:1631641. **Measurable**: Include specific metrics (time, percentage, count, rate)1652. **Technology-agnostic**: No mention of frameworks, languages, databases, or tools1663. **User-focused**: Describe outcomes from user/business perspective, not system internals1674. **Verifiable**: Can be tested/validated without knowing implementation details168169**Good examples**:170171- "Users can complete checkout in under 3 minutes"172- "System supports 10,000 concurrent users"173- "95% of searches return results in under 1 second"174- "Task completion rate improves by 40%"175176**Bad examples** (implementation-focused):177178- "API response time is under 200ms" (too technical, use "Users see results instantly")179- "Database can handle 1000 TPS" (implementation detail, use user-facing metric)180- "React components render efficiently" (framework-specific)181- "Redis cache hit rate above 80%" (technology-specific)182183## Resources184185### Templates186- `templates/spec-template.md` — Specification document template with all mandatory sections