kiro-spec-engine 1.3.0 → 1.4.1
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/CHANGELOG.md +85 -0
- package/README.md +228 -367
- package/README.zh.md +0 -330
- package/docs/README.md +223 -0
- package/docs/command-reference.md +252 -0
- package/docs/examples/add-export-command/design.md +194 -0
- package/docs/examples/add-export-command/requirements.md +110 -0
- package/docs/examples/add-export-command/tasks.md +88 -0
- package/docs/examples/add-rest-api/design.md +855 -0
- package/docs/examples/add-rest-api/requirements.md +323 -0
- package/docs/examples/add-rest-api/tasks.md +355 -0
- package/docs/examples/add-user-dashboard/design.md +192 -0
- package/docs/examples/add-user-dashboard/requirements.md +143 -0
- package/docs/examples/add-user-dashboard/tasks.md +91 -0
- package/docs/faq.md +696 -0
- package/docs/integration-modes.md +529 -0
- package/docs/integration-philosophy.md +313 -0
- package/docs/quick-start-with-ai-tools.md +374 -0
- package/docs/quick-start.md +711 -0
- package/docs/spec-workflow.md +453 -0
- package/docs/tools/claude-guide.md +653 -0
- package/docs/tools/cursor-guide.md +705 -0
- package/docs/tools/generic-guide.md +445 -0
- package/docs/tools/kiro-guide.md +308 -0
- package/docs/tools/vscode-guide.md +444 -0
- package/docs/tools/windsurf-guide.md +390 -0
- package/docs/troubleshooting.md +795 -0
- package/docs/zh/README.md +275 -0
- package/docs/zh/quick-start.md +711 -0
- package/docs/zh/tools/claude-guide.md +348 -0
- package/docs/zh/tools/cursor-guide.md +280 -0
- package/docs/zh/tools/generic-guide.md +498 -0
- package/docs/zh/tools/kiro-guide.md +342 -0
- package/docs/zh/tools/vscode-guide.md +448 -0
- package/docs/zh/tools/windsurf-guide.md +377 -0
- package/package.json +1 -1
|
@@ -0,0 +1,453 @@
|
|
|
1
|
+
# Spec Workflow Guide
|
|
2
|
+
|
|
3
|
+
> Understanding the Spec-driven development workflow in kse
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
**Version**: 1.0.0
|
|
8
|
+
**Last Updated**: 2026-01-23
|
|
9
|
+
**Audience**: Intermediate
|
|
10
|
+
**Estimated Time**: 10 minutes
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Overview
|
|
15
|
+
|
|
16
|
+
A **Spec** (specification) is the fundamental unit of work in kse. It's a structured description of a feature or component that guides both human developers and AI assistants through the implementation process.
|
|
17
|
+
|
|
18
|
+
Every Spec follows a three-stage workflow: **Requirements → Design → Tasks**
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## The Spec Creation Workflow
|
|
23
|
+
|
|
24
|
+
```mermaid
|
|
25
|
+
graph LR
|
|
26
|
+
A[Idea/Feature Request] --> B[Requirements]
|
|
27
|
+
B --> C[Design]
|
|
28
|
+
C --> D[Tasks]
|
|
29
|
+
D --> E[Implementation]
|
|
30
|
+
E --> F[Completion]
|
|
31
|
+
F --> G[Archive/Document]
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Stage Descriptions
|
|
35
|
+
|
|
36
|
+
1. **Idea/Feature Request** - The initial concept or need
|
|
37
|
+
2. **Requirements** - What you're building and why (user stories, acceptance criteria)
|
|
38
|
+
3. **Design** - How you'll build it (architecture, APIs, components)
|
|
39
|
+
4. **Tasks** - Step-by-step implementation plan
|
|
40
|
+
5. **Implementation** - Actual coding (often AI-assisted)
|
|
41
|
+
6. **Completion** - All tasks done, feature working
|
|
42
|
+
7. **Archive/Document** - Spec serves as documentation
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Stage 1: Requirements
|
|
47
|
+
|
|
48
|
+
**Purpose:** Define WHAT you're building and WHY
|
|
49
|
+
|
|
50
|
+
**File:** `requirements.md`
|
|
51
|
+
|
|
52
|
+
**Key Components:**
|
|
53
|
+
- **Overview** - Brief description of the feature
|
|
54
|
+
- **User Stories** - "As a... I want... So that..."
|
|
55
|
+
- **Functional Requirements** - Specific capabilities the system must have
|
|
56
|
+
- **Acceptance Criteria** - "WHEN... THEN..." statements
|
|
57
|
+
- **Non-Functional Requirements** - Performance, security, usability
|
|
58
|
+
|
|
59
|
+
**Example Structure:**
|
|
60
|
+
|
|
61
|
+
```markdown
|
|
62
|
+
# Feature Name
|
|
63
|
+
|
|
64
|
+
## Overview
|
|
65
|
+
Brief description of what this feature does
|
|
66
|
+
|
|
67
|
+
## User Stories
|
|
68
|
+
- As a [user type], I want to [action], so that [benefit]
|
|
69
|
+
|
|
70
|
+
## Functional Requirements
|
|
71
|
+
### FR-1: Requirement Name
|
|
72
|
+
Description of what the system must do
|
|
73
|
+
|
|
74
|
+
## Acceptance Criteria
|
|
75
|
+
- WHEN [condition] THEN [expected result]
|
|
76
|
+
|
|
77
|
+
## Non-Functional Requirements
|
|
78
|
+
- Performance: Response time < 500ms
|
|
79
|
+
- Security: Data encrypted at rest
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
**Best Practices:**
|
|
83
|
+
- ✅ Write from user perspective
|
|
84
|
+
- ✅ Be specific and measurable
|
|
85
|
+
- ✅ Include edge cases
|
|
86
|
+
- ✅ Consider security and performance
|
|
87
|
+
- ❌ Don't include implementation details (that's for Design)
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Stage 2: Design
|
|
92
|
+
|
|
93
|
+
**Purpose:** Define HOW you'll build it
|
|
94
|
+
|
|
95
|
+
**File:** `design.md`
|
|
96
|
+
|
|
97
|
+
**Key Components:**
|
|
98
|
+
- **Architecture Overview** - High-level system structure
|
|
99
|
+
- **Component Design** - Individual components and their responsibilities
|
|
100
|
+
- **API Design** - Endpoints, request/response formats
|
|
101
|
+
- **Data Models** - Database schemas, data structures
|
|
102
|
+
- **Technology Stack** - Languages, frameworks, libraries
|
|
103
|
+
- **Requirements Traceability** - Map requirements to design components
|
|
104
|
+
|
|
105
|
+
**Example Structure:**
|
|
106
|
+
|
|
107
|
+
```markdown
|
|
108
|
+
# Feature Name - Design
|
|
109
|
+
|
|
110
|
+
## Architecture
|
|
111
|
+
|
|
112
|
+
```mermaid
|
|
113
|
+
graph TD
|
|
114
|
+
A[Component A] --> B[Component B]
|
|
115
|
+
B --> C[Database]
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## API Design
|
|
119
|
+
### POST /api/endpoint
|
|
120
|
+
Request: { ... }
|
|
121
|
+
Response: { ... }
|
|
122
|
+
|
|
123
|
+
## Component Design
|
|
124
|
+
### ComponentName
|
|
125
|
+
**Responsibility:** What it does
|
|
126
|
+
**Methods:**
|
|
127
|
+
- method1() - Description
|
|
128
|
+
- method2() - Description
|
|
129
|
+
|
|
130
|
+
## Data Models
|
|
131
|
+
```javascript
|
|
132
|
+
{
|
|
133
|
+
field1: type,
|
|
134
|
+
field2: type
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## Technology Stack
|
|
139
|
+
- Backend: Node.js + Express
|
|
140
|
+
- Database: PostgreSQL
|
|
141
|
+
|
|
142
|
+
## Requirements Traceability
|
|
143
|
+
| Requirement | Design Component |
|
|
144
|
+
|-------------|------------------|
|
|
145
|
+
| FR-1 | ComponentA.method1() |
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
**Best Practices:**
|
|
149
|
+
- ✅ Use diagrams to visualize architecture
|
|
150
|
+
- ✅ Define clear component responsibilities
|
|
151
|
+
- ✅ Specify all APIs and data formats
|
|
152
|
+
- ✅ Link back to requirements
|
|
153
|
+
- ❌ Don't skip the traceability section
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## Stage 3: Tasks
|
|
158
|
+
|
|
159
|
+
**Purpose:** Break down implementation into actionable steps
|
|
160
|
+
|
|
161
|
+
**File:** `tasks.md`
|
|
162
|
+
|
|
163
|
+
**Key Components:**
|
|
164
|
+
- **Task List** - Checkbox list of implementation steps
|
|
165
|
+
- **Task Hierarchy** - Organized by phase or component
|
|
166
|
+
- **Task IDs** - Numbered for easy reference (1.1, 1.2, 2.1, etc.)
|
|
167
|
+
- **Dependencies** - Implicit through ordering
|
|
168
|
+
|
|
169
|
+
**Example Structure:**
|
|
170
|
+
|
|
171
|
+
```markdown
|
|
172
|
+
# Feature Name - Tasks
|
|
173
|
+
|
|
174
|
+
## Phase 1: Setup
|
|
175
|
+
- [ ] 1.1 Set up project structure
|
|
176
|
+
- [ ] 1.2 Install dependencies
|
|
177
|
+
- [ ] 1.3 Configure environment
|
|
178
|
+
|
|
179
|
+
## Phase 2: Core Implementation
|
|
180
|
+
- [ ] 2.1 Implement ComponentA
|
|
181
|
+
- [ ] 2.1.1 Create class structure
|
|
182
|
+
- [ ] 2.1.2 Implement method1()
|
|
183
|
+
- [ ] 2.1.3 Write unit tests
|
|
184
|
+
- [ ] 2.2 Implement ComponentB
|
|
185
|
+
|
|
186
|
+
## Phase 3: Integration
|
|
187
|
+
- [ ] 3.1 Connect components
|
|
188
|
+
- [ ] 3.2 Integration testing
|
|
189
|
+
- [ ] 3.3 End-to-end testing
|
|
190
|
+
|
|
191
|
+
## Phase 4: Documentation
|
|
192
|
+
- [ ] 4.1 API documentation
|
|
193
|
+
- [ ] 4.2 User guide
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
**Best Practices:**
|
|
197
|
+
- ✅ Break large tasks into subtasks
|
|
198
|
+
- ✅ Order tasks logically (dependencies first)
|
|
199
|
+
- ✅ Include testing tasks
|
|
200
|
+
- ✅ Be specific enough for AI to understand
|
|
201
|
+
- ❌ Don't make tasks too granular (not every line of code)
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
## The Complete Workflow in Action
|
|
206
|
+
|
|
207
|
+
### Example: User Login Feature
|
|
208
|
+
|
|
209
|
+
**1. Create the Spec:**
|
|
210
|
+
```bash
|
|
211
|
+
kse create-spec 01-00-user-login
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
**2. Write Requirements** (`.kiro/specs/01-00-user-login/requirements.md`):
|
|
215
|
+
```markdown
|
|
216
|
+
# User Login
|
|
217
|
+
|
|
218
|
+
## User Stories
|
|
219
|
+
- As a user, I want to log in with email and password
|
|
220
|
+
|
|
221
|
+
## Acceptance Criteria
|
|
222
|
+
- WHEN user enters valid credentials THEN they are logged in
|
|
223
|
+
- WHEN user enters invalid credentials THEN they see an error
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
**3. Write Design** (`.kiro/specs/01-00-user-login/design.md`):
|
|
227
|
+
```markdown
|
|
228
|
+
# User Login - Design
|
|
229
|
+
|
|
230
|
+
## API Design
|
|
231
|
+
POST /api/auth/login
|
|
232
|
+
Request: { email, password }
|
|
233
|
+
Response: { token } or { error }
|
|
234
|
+
|
|
235
|
+
## Components
|
|
236
|
+
- AuthController - handles login requests
|
|
237
|
+
- AuthService - validates credentials
|
|
238
|
+
- UserRepository - database access
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
**4. Write Tasks** (`.kiro/specs/01-00-user-login/tasks.md`):
|
|
242
|
+
```markdown
|
|
243
|
+
- [ ] 1.1 Create AuthController
|
|
244
|
+
- [ ] 1.2 Create AuthService
|
|
245
|
+
- [ ] 1.3 Create UserRepository
|
|
246
|
+
- [ ] 1.4 Implement login endpoint
|
|
247
|
+
- [ ] 1.5 Write tests
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
**5. Export Context:**
|
|
251
|
+
```bash
|
|
252
|
+
kse context export 01-00-user-login
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
**6. Implement with AI:**
|
|
256
|
+
- Provide context to your AI tool
|
|
257
|
+
- AI implements tasks based on your Spec
|
|
258
|
+
- Update task checkboxes as you complete them
|
|
259
|
+
|
|
260
|
+
**7. Track Progress:**
|
|
261
|
+
```bash
|
|
262
|
+
kse status
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
---
|
|
266
|
+
|
|
267
|
+
## Workflow Variations
|
|
268
|
+
|
|
269
|
+
### Iterative Refinement
|
|
270
|
+
|
|
271
|
+
You don't have to complete all three stages before starting implementation:
|
|
272
|
+
|
|
273
|
+
```mermaid
|
|
274
|
+
graph TD
|
|
275
|
+
A[Write Basic Requirements] --> B[Write Basic Design]
|
|
276
|
+
B --> C[Write First Tasks]
|
|
277
|
+
C --> D[Implement First Tasks]
|
|
278
|
+
D --> E{Need More Detail?}
|
|
279
|
+
E -->|Yes| F[Refine Requirements/Design]
|
|
280
|
+
F --> C
|
|
281
|
+
E -->|No| G[Continue Implementation]
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
**When to use:**
|
|
285
|
+
- Exploring new features
|
|
286
|
+
- Prototyping
|
|
287
|
+
- Learning new technologies
|
|
288
|
+
|
|
289
|
+
### Waterfall Approach
|
|
290
|
+
|
|
291
|
+
Complete each stage fully before moving to the next:
|
|
292
|
+
|
|
293
|
+
```mermaid
|
|
294
|
+
graph TD
|
|
295
|
+
A[Complete Requirements] --> B[Review Requirements]
|
|
296
|
+
B --> C[Complete Design]
|
|
297
|
+
C --> D[Review Design]
|
|
298
|
+
D --> E[Complete Tasks]
|
|
299
|
+
E --> F[Begin Implementation]
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
**When to use:**
|
|
303
|
+
- Well-understood features
|
|
304
|
+
- Critical systems
|
|
305
|
+
- Team collaboration (clear handoffs)
|
|
306
|
+
|
|
307
|
+
---
|
|
308
|
+
|
|
309
|
+
## Integration with AI Tools
|
|
310
|
+
|
|
311
|
+
### Context Export Workflow
|
|
312
|
+
|
|
313
|
+
```mermaid
|
|
314
|
+
sequenceDiagram
|
|
315
|
+
participant Dev as Developer
|
|
316
|
+
participant kse as kse
|
|
317
|
+
participant AI as AI Tool
|
|
318
|
+
|
|
319
|
+
Dev->>kse: Create Spec (requirements, design, tasks)
|
|
320
|
+
Dev->>kse: kse context export spec-name
|
|
321
|
+
kse->>Dev: context-export.md
|
|
322
|
+
Dev->>AI: Provide context
|
|
323
|
+
AI->>Dev: Generate code
|
|
324
|
+
Dev->>kse: Update task status
|
|
325
|
+
Dev->>kse: kse status (check progress)
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
### Automated Workflow (Windsurf/Cline)
|
|
329
|
+
|
|
330
|
+
```mermaid
|
|
331
|
+
sequenceDiagram
|
|
332
|
+
participant Dev as Developer
|
|
333
|
+
participant AI as AI Tool
|
|
334
|
+
participant kse as kse
|
|
335
|
+
|
|
336
|
+
Dev->>AI: "Implement user login feature"
|
|
337
|
+
AI->>kse: kse context export 01-00-user-login
|
|
338
|
+
kse->>AI: Return context
|
|
339
|
+
AI->>AI: Generate code
|
|
340
|
+
AI->>kse: kse task claim 01-00-user-login 1.1
|
|
341
|
+
AI->>Dev: Code generated, task claimed
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
---
|
|
345
|
+
|
|
346
|
+
## Best Practices
|
|
347
|
+
|
|
348
|
+
### Requirements Stage
|
|
349
|
+
1. **Start with user stories** - Understand the user's perspective
|
|
350
|
+
2. **Use EARS format** for acceptance criteria (WHEN... THEN...)
|
|
351
|
+
3. **Include non-functional requirements** - Don't forget performance, security
|
|
352
|
+
4. **Think about edge cases** - What could go wrong?
|
|
353
|
+
|
|
354
|
+
### Design Stage
|
|
355
|
+
1. **Visualize with diagrams** - A picture is worth a thousand words
|
|
356
|
+
2. **Define clear interfaces** - APIs, method signatures, data formats
|
|
357
|
+
3. **Maintain traceability** - Link every design decision to a requirement
|
|
358
|
+
4. **Choose appropriate technologies** - Document your tech stack
|
|
359
|
+
|
|
360
|
+
### Tasks Stage
|
|
361
|
+
1. **Break down logically** - Group related tasks into phases
|
|
362
|
+
2. **Order by dependencies** - What needs to be done first?
|
|
363
|
+
3. **Include testing** - Every feature needs tests
|
|
364
|
+
4. **Be AI-friendly** - Tasks should be clear enough for AI to implement
|
|
365
|
+
|
|
366
|
+
### Throughout
|
|
367
|
+
1. **Keep it updated** - Specs are living documents
|
|
368
|
+
2. **Use version control** - Commit Spec changes
|
|
369
|
+
3. **Review regularly** - Ensure Spec matches implementation
|
|
370
|
+
4. **Archive completed Specs** - They become documentation
|
|
371
|
+
|
|
372
|
+
---
|
|
373
|
+
|
|
374
|
+
## Common Pitfalls
|
|
375
|
+
|
|
376
|
+
### ❌ Too Vague
|
|
377
|
+
**Bad:**
|
|
378
|
+
```markdown
|
|
379
|
+
- [ ] Make login work
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
**Good:**
|
|
383
|
+
```markdown
|
|
384
|
+
- [ ] 1.1 Implement AuthController.login() method
|
|
385
|
+
- Accept email and password
|
|
386
|
+
- Validate inputs
|
|
387
|
+
- Return JWT token on success
|
|
388
|
+
- Return error message on failure
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
### ❌ Too Detailed
|
|
392
|
+
**Bad:**
|
|
393
|
+
```markdown
|
|
394
|
+
- [ ] 1.1 Create variable named 'email'
|
|
395
|
+
- [ ] 1.2 Create variable named 'password'
|
|
396
|
+
- [ ] 1.3 Write if statement to check email
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
**Good:**
|
|
400
|
+
```markdown
|
|
401
|
+
- [ ] 1.1 Implement input validation
|
|
402
|
+
- Validate email format
|
|
403
|
+
- Validate password length
|
|
404
|
+
- Return validation errors
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
### ❌ Missing Traceability
|
|
408
|
+
**Bad:** Design with no connection to requirements
|
|
409
|
+
|
|
410
|
+
**Good:** Design with clear traceability table:
|
|
411
|
+
```markdown
|
|
412
|
+
| Requirement | Design Component |
|
|
413
|
+
|-------------|------------------|
|
|
414
|
+
| FR-1: User can log in | AuthController.login() |
|
|
415
|
+
| FR-2: Validate inputs | ValidationService |
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
---
|
|
419
|
+
|
|
420
|
+
## Related Documentation
|
|
421
|
+
|
|
422
|
+
- **[Quick Start Guide](quick-start.md)** - Get started with your first Spec
|
|
423
|
+
- **[Integration Modes](integration-modes.md)** - How to use Specs with AI tools
|
|
424
|
+
- **[Command Reference](command-reference.md)** - All kse commands
|
|
425
|
+
- **[Examples](examples/)** - Complete example Specs
|
|
426
|
+
|
|
427
|
+
---
|
|
428
|
+
|
|
429
|
+
## Summary
|
|
430
|
+
|
|
431
|
+
The Spec workflow is:
|
|
432
|
+
1. **Requirements** - Define WHAT and WHY
|
|
433
|
+
2. **Design** - Define HOW
|
|
434
|
+
3. **Tasks** - Define STEPS
|
|
435
|
+
4. **Implementation** - Build it (with AI assistance)
|
|
436
|
+
5. **Completion** - Verify and document
|
|
437
|
+
|
|
438
|
+
**Key Benefits:**
|
|
439
|
+
- ✅ Clear structure for features
|
|
440
|
+
- ✅ Better AI assistance (AI understands your intent)
|
|
441
|
+
- ✅ Built-in documentation
|
|
442
|
+
- ✅ Progress tracking
|
|
443
|
+
- ✅ Team collaboration
|
|
444
|
+
|
|
445
|
+
**Start your next Spec:** 🚀
|
|
446
|
+
```bash
|
|
447
|
+
kse create-spec 02-00-your-feature
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
---
|
|
451
|
+
|
|
452
|
+
**Version**: 1.0.0
|
|
453
|
+
**Last Updated**: 2026-01-23
|