Skip to content

Commit 144fd38

Browse files
committed
feat: add feature design skill
1 parent 8832173 commit 144fd38

1 file changed

Lines changed: 222 additions & 0 deletions

File tree

Lines changed: 222 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,222 @@
1+
---
2+
name: feature-design
3+
description: Guide users through feature specification development using EARS patterns and INCOSE quality rules. Creates requirements documents and technical design specifications with iterative user feedback.
4+
arguments:
5+
- name: feature_idea
6+
description: Brief description of the feature idea to develop
7+
required: false
8+
- name: workspace
9+
description: Absolute path to the workspace directory
10+
required: false
11+
---
12+
13+
# Feature Design
14+
15+
Transform rough feature ideas into detailed requirements and technical design documents through an iterative, user-collaborative process.
16+
17+
## Overview
18+
19+
This skill implements a Spec-Driven Development (SDD) workflow that systematically:
20+
1. Captures and refines feature requirements using EARS (Easy Approach to Requirements Syntax)
21+
2. Validates requirements against INCOSE semantic quality rules
22+
3. Creates technical design documents with architecture, components, and implementation plans
23+
24+
## Glossaries
25+
26+
### EARS (Easy Approach to Requirements Syntax)
27+
28+
EARS provides standardized templates for writing clear, unambiguous requirements:
29+
30+
| Pattern | Template | Example |
31+
|---------|----------|---------|
32+
| Ubiquitous | The `<system>` SHALL `<function>` | The system SHALL provide user login functionality |
33+
| Event-Driven | WHEN `<trigger>`, the `<system>` SHALL `<function>` | WHEN user clicks "Login", the system SHALL validate credentials |
34+
| State-Driven | WHILE `<state>`, the `<system>` SHALL `<function>` | WHILE user is logged in, the system SHALL display dashboard |
35+
| Unwanted-Behavior | IF `<condition>`, the `<system>` SHALL `<function>` | IF password fails 3 times, the system SHALL lock account for 30 minutes |
36+
| Complex | [WHERE] [WHILE] [WHEN/IF] THE `<system>` SHALL `<function>` | Clause order: WHERE → WHILE → WHEN/IF → THE → SHALL |
37+
38+
### INCOSE Semantic Quality Rules
39+
40+
Requirements must comply with these quality rules:
41+
42+
- **Active voice** - Clearly state who does what
43+
- **No vague terms** - Avoid "quickly", "adequate", "user-friendly"
44+
- **No escape clauses** - Avoid "where possible", "if feasible"
45+
- **No negative statements** - Avoid "SHALL NOT" (rephrase positively)
46+
- **One thought per requirement** - Single, testable concept
47+
- **Explicit conditions** - Measurable criteria and thresholds
48+
- **Consistent terminology** - Use defined terms from glossary
49+
- **No pronouns** - Avoid "it", "them", "this"
50+
- **No absolutes** - Avoid "never", "always", "100%"
51+
- **Solution-free** - Focus on what, not how
52+
53+
## Document Templates
54+
55+
### Requirements Document (`requirements.md`)
56+
57+
```markdown
58+
# Requirements Document
59+
60+
## Introduction
61+
62+
[Summary of the feature/system]
63+
64+
## Glossary
65+
66+
- **System/Term**: [Definition]
67+
68+
## Requirements
69+
70+
### Requirement 1
71+
72+
**User Story:** AS [role], I want [feature], so that [benefit]
73+
74+
#### Acceptance Criteria
75+
76+
1. WHEN [event], [system] SHALL [response]
77+
2. WHILE [state], [system] SHALL [response]
78+
3. IF [unwanted event], [system] SHALL [response]
79+
... (2-5 EARS definitions per requirement)
80+
81+
[Repeat for other requirements]
82+
```
83+
84+
### Design Document (`design.md`)
85+
86+
```markdown
87+
# [Feature Title]
88+
89+
Feature Name: feature-name
90+
Updated: yyyy-mm-dd
91+
92+
## Description
93+
94+
[Feature description]
95+
96+
## Architecture
97+
98+
[Mermaid diagrams as needed]
99+
[Architecture explanation]
100+
101+
## Components and Interfaces
102+
103+
[Component and interface descriptions]
104+
105+
## Data Models
106+
107+
[Data structure descriptions]
108+
109+
## Correctness Properties
110+
111+
[Invariants and constraints]
112+
113+
## Error Handling
114+
115+
[Error scenarios and handling strategies]
116+
117+
## Test Strategy
118+
119+
[Testing approach and coverage]
120+
121+
## References
122+
123+
[^1]: (Website) - [Page description](URL)
124+
[^2]: (Filename#Lnnn) - [File link](relative/path)
125+
```
126+
127+
## Workflow
128+
129+
### Phase 1: Requirements Generation
130+
131+
1. **Initialize Feature**
132+
- Generate a short feature name in `kebab-case` format (e.g., `user-authentication`)
133+
- Create directory `.ai-ready/specs/{FEATURE_NAME}/`
134+
135+
2. **Gather Context**
136+
- Read project documentation from `.ai-ready/docs/` if available:
137+
- `INDEX.md` - Project overview
138+
- `ARCHITECTURE.md` - System architecture
139+
- Scan `.ai-ready/specs/*/` for related historical requirements
140+
- Understand existing code structure
141+
142+
3. **Generate Initial Requirements**
143+
- Decompose the feature idea into user stories
144+
- Apply EARS patterns to each acceptance criterion
145+
- Validate against INCOSE quality rules
146+
- Write to `.ai-ready/specs/{FEATURE_NAME}/requirements.md`
147+
148+
4. **Iterate with User**
149+
- Present requirements document to user
150+
- Ask clarifying questions (maximum 3 questions per round)
151+
- Provide options with reasonable defaults
152+
- Update document based on feedback
153+
154+
5. **Special Handling for Parsers/Serializers**
155+
- Explicitly list all parsers and serializers as requirements
156+
- Add pretty-printer requirements for each parser
157+
- Include round-trip validation in acceptance criteria
158+
159+
### Phase 2: Technical Design
160+
161+
1. **Initialize Design Document**
162+
- Get current date via `date '+%Y-%m-%d'`
163+
- Create feature name with date prefix (e.g., `2025-01-15-user-authentication`)
164+
- Create initial design outline in `.ai-ready/specs/{FEATURE_NAME}/design.md`
165+
166+
2. **Gather Technical Context**
167+
- Read `.ai-ready/docs/INDEX.md` and `.ai-ready/docs/ARCHITECTURE.md`
168+
- Analyze project structure and existing patterns
169+
- Review related specifications in `.ai-ready/specs/`
170+
171+
3. **Generate Design Document**
172+
- Include all required sections:
173+
- Description
174+
- Architecture (with Mermaid diagrams)
175+
- Components and Interfaces
176+
- Data Models
177+
- Correctness Properties
178+
- Error Handling
179+
- Test Strategy
180+
- Ensure design addresses all requirements from Phase 1
181+
- Highlight design decisions and rationale
182+
183+
4. **Iterate with User**
184+
- Present design document to user
185+
- Ask technical questions (maximum 3 per round)
186+
- Update based on feedback
187+
188+
5. **Finalize**
189+
- Commit changes with `git commit`
190+
- Push to remote with `git push`
191+
- Summarize deliverables to user
192+
193+
## Decision Points
194+
195+
During the workflow, ask the user about:
196+
197+
| Topic | Example Questions |
198+
|-------|-------------------|
199+
| Scope | Which user roles need this feature? |
200+
| Integration | Should this integrate with existing systems? |
201+
| Performance | What are the expected load requirements? |
202+
| Security | What authentication/authorization is needed? |
203+
| Data | What data needs to be persisted? |
204+
| Error Handling | How should failures be communicated to users? |
205+
206+
## Output Files
207+
208+
```
209+
.ai-ready/specs/{FEATURE_NAME}/
210+
├── requirements.md # EARS-compliant requirements
211+
└── design.md # Technical design specification
212+
```
213+
214+
## Notes
215+
216+
- All communication with users must use the project's configured language
217+
- Maximum 3 clarifying questions per iteration round
218+
- Always validate requirements against both EARS and INCOSE rules
219+
- Correct non-compliant user inputs and explain corrections
220+
- Design documents should be solution-agnostic where possible
221+
- Include Mermaid diagrams for complex architectures
222+
- Reference specific files with line numbers when applicable

0 commit comments

Comments
 (0)