kiro-spec-engine 1.4.4 → 1.5.5

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.
@@ -1,288 +1,328 @@
1
- # Kiro Spec 驱动开发体系
1
+ # kse - Kiro Spec Engine
2
2
 
3
- > **用途**: 新项目引导文档,解释 Spec 驱动开发体系的设计思想和使用方法
3
+ > **AI Tools: Read this first!** This project uses kse (Kiro Spec Engine) for structured development.
4
4
 
5
5
  ---
6
6
 
7
- ## 🎯 这是什么?
7
+ ## 🎯 What is kse?
8
8
 
9
- 这是一套基于 Spec 驱动的 AI 辅助开发规范体系,包含:
10
- - **Steering 规范**:控制 AI 行为的规则和上下文
11
- - **Spec 工作流**:结构化的需求-设计-实施流程
12
- - **文件组织**:清晰的产物归档和知识沉淀
9
+ **kse** is a CLI tool that provides structured, Spec-driven development workflows for AI-assisted coding.
10
+
11
+ **Key concepts:**
12
+ - **Spec**: A structured feature definition with requirements, design, and tasks
13
+ - **Context Export**: Generate AI-friendly documentation from Specs
14
+ - **Task Tracking**: Monitor implementation progress
15
+ - **Steering Rules**: AI behavior guidelines in `.kiro/steering/`
16
+
17
+ **This project has adopted kse** - all development should follow the Spec-driven workflow
13
18
 
14
19
  ---
15
20
 
16
- ## 💡 为什么需要这套体系?
21
+ ## 📦 kse Commands (For AI Tools)
17
22
 
18
- ### 问题 1:AI Session Token 有限
23
+ ### Check Project Status
24
+ ```bash
25
+ kse status
26
+ ```
27
+ Shows all Specs and their progress.
19
28
 
20
- **挑战**:
21
- - AI session 启动时会加载所有 Steering 文档
22
- - 历史数据和详细内容会快速消耗 token
23
- - Token 耗尽导致无法继续执行任务
29
+ ### List All Specs
30
+ ```bash
31
+ kse workflows
32
+ ```
33
+ Lists all available Specs in `.kiro/specs/`.
24
34
 
25
- **解决方案**:
26
- - **分层管理**:稳定规则(CORE_PRINCIPLES)+ 动态场景(CURRENT_CONTEXT)
27
- - **精简原则**:Steering 只保留核心信息,详细内容放到 Spec 目录
28
- - **主动管控**:每个 Spec 完成后及时更新 CURRENT_CONTEXT
35
+ ### Export Spec Context
36
+ ```bash
37
+ kse context export <spec-name>
38
+ ```
39
+ Generates AI-friendly context from a Spec (requirements + design + tasks).
29
40
 
30
- ### 问题 2:规范一致性难以保持
41
+ **Example:**
42
+ ```bash
43
+ kse context export 01-00-user-login
44
+ # Creates: .kiro/specs/01-00-user-login/context-export.md
45
+ ```
31
46
 
32
- **挑战**:
33
- - 不同 Spec 使用不同的开发流程
34
- - 产物散落在项目各处,难以查找
35
- - 缺乏上下文,不知道为什么要这样做
47
+ ### Generate Task Prompt
48
+ ```bash
49
+ kse prompt generate <spec-name> <task-id>
50
+ ```
51
+ Creates a focused prompt for a specific task.
36
52
 
37
- **解决方案**:
38
- - **Spec 驱动**:所有工作基于 Spec 推进
39
- - **统一规范**:CORE_PRINCIPLES 适用于所有 Spec
40
- - **产物归档**:所有产物归档到对应的 Spec 目录
53
+ **Example:**
54
+ ```bash
55
+ kse prompt generate 01-00-user-login 1.1
56
+ # Generates prompt for task 1.1 only
57
+ ```
41
58
 
42
- ---
59
+ ### Claim a Task
60
+ ```bash
61
+ kse task claim <spec-name> <task-id>
62
+ ```
63
+ Mark a task as "in progress" and assign it to yourself.
43
64
 
44
- ## 📚 文件组织
65
+ **Example:**
66
+ ```bash
67
+ kse task claim 01-00-user-login 1.1
68
+ ```
45
69
 
46
- ### Steering 目录(AI 每次启动时加载)
70
+ ### Check Adoption Status
71
+ ```bash
72
+ kse doctor
73
+ ```
74
+ Verifies kse is properly configured in the project.
47
75
 
48
- | 文件 | 职责 | Token 影响 | 更新频率 |
49
- |------|------|-----------|---------|
50
- | **RULES_GUIDE.md** | 索引和快速参考 | 低 | 很少 |
51
- | **CORE_PRINCIPLES.md** | 核心开发规范 | 中 | 很少 |
52
- | **ENVIRONMENT.md** | 环境配置 | 低 | 很少 |
53
- | **CURRENT_CONTEXT.md** | 当前 Spec 场景 | **高** ⚠️ | 每个 Spec |
76
+ ---
77
+
78
+ ## 🤖 AI Workflow Guide
54
79
 
55
- ### Specs 目录(按需加载)
80
+ ### When User Asks to Implement a Feature
56
81
 
82
+ **Step 1: Check if Spec exists**
83
+ ```bash
84
+ kse workflows
57
85
  ```
58
- .kiro/specs/
59
- ├── SPEC_WORKFLOW_GUIDE.md # Spec 工作流指南
60
- └── {spec-name}/ # 具体的 Spec
61
- ├── requirements.md # 需求文档
62
- ├── design.md # 设计文档(可选)
63
- ├── tasks.md # 任务列表(可选)
64
- ├── scripts/ # 脚本
65
- ├── diagnostics/ # 诊断文档
66
- └── results/ # 执行结果
86
+
87
+ **Step 2: Export Spec context**
88
+ ```bash
89
+ kse context export <spec-name>
67
90
  ```
68
91
 
69
- ---
92
+ **Step 3: Read the exported context**
93
+ ```bash
94
+ # Context is at: .kiro/specs/<spec-name>/context-export.md
95
+ ```
70
96
 
71
- ## 🔄 Steering 体系的核心思想
97
+ **Step 4: Implement according to the Spec**
98
+ - Follow requirements in `requirements.md`
99
+ - Follow design in `design.md`
100
+ - Complete tasks from `tasks.md`
72
101
 
73
- ### 1. 最小化 Token 消耗
102
+ **Step 5: Update task status**
103
+ - Mark tasks as complete: `- [x] 1.1 Task description`
104
+ - Mark tasks in progress: `- [-] 1.1 Task description`
74
105
 
75
- **原则**:
76
- - Steering 文档在每次 session 启动时**完全加载**
77
- - 必须保持精简,避免历史数据堆积
78
- - CURRENT_CONTEXT 需要随 Spec 推进及时更新
106
+ ### When User Asks About Project Status
79
107
 
80
- **实践**:
81
- - ❌ 不要在 Steering 中保留详细的历史数据
82
- - ❌ 不要在 Steering 中保留详细的配置和命令
83
- - ✅ 历史数据归档到 Spec 目录
84
- - ✅ 详细配置放到 Spec 文档中
108
+ ```bash
109
+ kse status
110
+ ```
85
111
 
86
- ### 2. 规范的可复用性
112
+ This shows:
113
+ - All Specs in the project
114
+ - Task completion progress
115
+ - Current active Specs
87
116
 
88
- **原则**:
89
- - CORE_PRINCIPLES 适用于所有 Spec
90
- - 新项目可以直接复制这套体系
91
- - 只需修正 ENVIRONMENT 和 CURRENT_CONTEXT
117
+ ### When User Asks to Start a New Feature
92
118
 
93
- **实践**:
94
- - ✅ CORE_PRINCIPLES 保持稳定,很少修改
95
- - ENVIRONMENT 记录项目特定的环境配置
96
- - CURRENT_CONTEXT Spec 动态更新
119
+ **If no Spec exists:**
120
+ ```
121
+ I notice there's no Spec for this feature yet.
122
+ Would you like me to create one? I can help you define:
123
+ 1. Requirements (what we're building)
124
+ 2. Design (how we'll build it)
125
+ 3. Tasks (implementation steps)
126
+ ```
97
127
 
98
- ### 3. 上下文的聚焦性
128
+ **If Spec exists:**
129
+ ```bash
130
+ kse context export <spec-name>
131
+ # Then read and implement according to the Spec
132
+ ```
99
133
 
100
- **原则**:
101
- - CURRENT_CONTEXT 只保留当前 Spec 的核心信息
102
- - 历史数据归档到 Spec 目录,不占用 Steering 空间
103
- - 每个 Spec 开始前必须更新 CURRENT_CONTEXT
134
+ ---
104
135
 
105
- **实践**:
106
- - ✅ 每个新 Spec 开始前:更新 CURRENT_CONTEXT
107
- - ✅ Spec 推进中:及时精简已完成内容
108
- - ✅ Spec 完成后:清空 CURRENT_CONTEXT
136
+ ## 📁 Directory Structure
109
137
 
110
- ---
138
+ ```
139
+ .kiro/
140
+ ├── README.md # This file - kse usage guide
141
+ ├── specs/ # All Specs live here
142
+ │ ├── SPEC_WORKFLOW_GUIDE.md # Detailed Spec workflow
143
+ │ └── {spec-name}/ # Individual Spec
144
+ │ ├── requirements.md # What we're building
145
+ │ ├── design.md # How we'll build it
146
+ │ ├── tasks.md # Implementation steps
147
+ │ ├── context-export.md # AI-friendly export (generated)
148
+ │ ├── scripts/ # Spec-specific scripts
149
+ │ ├── tests/ # Spec-specific tests
150
+ │ └── results/ # Execution results
151
+ ├── steering/ # AI behavior rules
152
+ │ ├── RULES_GUIDE.md # Quick reference
153
+ │ ├── CORE_PRINCIPLES.md # Core development rules
154
+ │ ├── ENVIRONMENT.md # Project environment
155
+ │ └── CURRENT_CONTEXT.md # Current Spec context
156
+ └── tools/ # Tool configurations
157
+ ```
111
158
 
112
- ## 🚀 如何在新项目中使用?
159
+ **Key files for AI:**
160
+ - `.kiro/README.md` (this file) - kse command reference
161
+ - `.kiro/steering/CORE_PRINCIPLES.md` - Development rules
162
+ - `.kiro/steering/CURRENT_CONTEXT.md` - Current work context
163
+ - `.kiro/specs/{spec-name}/context-export.md` - Spec context
113
164
 
114
- ### 步骤 1:复制 Steering 模板
165
+ ---
115
166
 
116
- ```bash
117
- # 从模板项目复制
118
- cp -r template-project/.kiro/ new-project/.kiro/
119
- ```
167
+ ## 📖 Spec Structure
120
168
 
121
- ### 步骤 2:修正 ENVIRONMENT.md
169
+ Each Spec contains three core documents:
122
170
 
123
- 更新为新项目的实际环境:
124
- - 服务器信息(如有)
125
- - 数据库配置
126
- - 部署方式
127
- - AI 权限范围
171
+ ### 1. requirements.md
172
+ **Purpose:** Define WHAT we're building
128
173
 
129
- ### 步骤 3:清空 CURRENT_CONTEXT.md
174
+ **Contains:**
175
+ - User stories
176
+ - Functional requirements
177
+ - Non-functional requirements
178
+ - Acceptance criteria
130
179
 
131
- 删除旧项目的场景信息,标记为"无活跃 Spec"。
180
+ ### 2. design.md
181
+ **Purpose:** Define HOW we'll build it
132
182
 
133
- ### 步骤 4:检查 CORE_PRINCIPLES.md
183
+ **Contains:**
184
+ - Architecture overview
185
+ - Component design
186
+ - API design
187
+ - Data models
188
+ - Technology choices
134
189
 
135
- 确认规范是否适用于新项目,必要时调整(但尽量保持稳定)。
190
+ ### 3. tasks.md
191
+ **Purpose:** Break down implementation
136
192
 
137
- ### 步骤 5:修正 SPEC_WORKFLOW_GUIDE.md
193
+ **Contains:**
194
+ - Ordered task list
195
+ - Task dependencies
196
+ - Implementation notes
138
197
 
139
- 更新项目特定的内容:
140
- - 项目名称
141
- - 技术栈
142
- - 示例
198
+ **Task status markers:**
199
+ - `- [ ]` Not started
200
+ - `- [-]` In progress
201
+ - `- [x]` Completed
143
202
 
144
203
  ---
145
204
 
146
- ## 📖 Spec 驱动开发工作流程
147
-
148
- ### 标准流程
205
+ ## 🎯 Spec-Driven Workflow
149
206
 
150
207
  ```
151
- 1. 创建 Spec 目录
208
+ 1. User requests feature
152
209
 
153
- 2. 编写需求文档 (requirements.md)
210
+ 2. Check if Spec exists (kse workflows)
154
211
 
155
- 3. 编写设计文档 (design.md) - 可选
212
+ 3. If no Spec: Suggest creating one
213
+ If Spec exists: Export context (kse context export)
156
214
 
157
- 4. 创建任务列表 (tasks.md) - 可选
215
+ 4. Read requirements.md and design.md
158
216
 
159
- 5. 执行任务(调研、分析、实现、测试)
217
+ 5. Implement according to Spec
160
218
 
161
- 6. 所有产物归档到 Spec 目录
219
+ 6. Update tasks.md as you complete tasks
162
220
 
163
- 7. 更新 CURRENT_CONTEXT 为下一个 Spec
221
+ 7. Verify against acceptance criteria
164
222
  ```
165
223
 
166
- ### 为什么要用 Spec 驱动?
167
-
168
- **优点**:
169
- - ✅ 所有工作有明确的需求和设计支持
170
- - ✅ 产物有上下文,易于理解和维护
171
- - ✅ 可以追溯需求和设计决策
172
- - ✅ 团队协作更清晰
173
- - ✅ 知识沉淀在 Spec 中
174
-
175
- **不用 Spec 的问题**:
176
- - ❌ 脚本散落在项目各处,难以查找
177
- - ❌ 缺乏上下文,不知道为什么要这样做
178
- - ❌ 无法追溯需求来源
179
- - ❌ 临时文件堆积,项目混乱
180
- - ❌ 知识流失
224
+ **Why Spec-driven?**
225
+ - ✅ Clear requirements before coding
226
+ - ✅ Consistent architecture decisions
227
+ - ✅ Trackable progress
228
+ - ✅ Better AI understanding of context
229
+ - ✅ Knowledge preserved in Specs
181
230
 
182
231
  ---
183
232
 
184
- ## 💡 最佳实践
233
+ ## 🔧 Common AI Tasks
185
234
 
186
- ### 1. 主动管控 Token
235
+ ### Task 1: Implement a Feature
187
236
 
188
- **时机**:
189
- - 每完成一组任务后:精简 tasks.md
190
- - 每完成一个阶段后:精简 CURRENT_CONTEXT
191
- - 发现 token 使用率 > 50% 时:立即精简
192
- - 阶段切换时:更新 CURRENT_CONTEXT 聚焦新阶段
237
+ ```bash
238
+ # 1. Check what Specs exist
239
+ kse workflows
193
240
 
194
- **策略**:
195
- - 删除:已完成阶段的详细配置、命令、表格
196
- - ❌ 删除:历史测试数据和性能对比表格
197
- - ❌ 删除:详细的问题排查流程和检查清单
198
- - ✅ 保留:当前阶段的核心信息和关键经验
241
+ # 2. Export the Spec context
242
+ kse context export 01-00-user-login
199
243
 
200
- ### 2. 保持 Steering 精简
244
+ # 3. Read the context
245
+ # File: .kiro/specs/01-00-user-login/context-export.md
201
246
 
202
- **原则**:
203
- - CURRENT_CONTEXT 只保留当前信息
204
- - 历史数据归档到 Spec 目录
205
- - 详细配置放到 Spec 文档中
247
+ # 4. Implement according to requirements and design
206
248
 
207
- **检查清单**:
208
- - [ ] CURRENT_CONTEXT 是否聚焦当前 Spec?
209
- - [ ] 历史阶段的详细内容是否已移除?
210
- - [ ] 详细数据是否已归档到 Spec 目录?
211
- - [ ] Token 使用率是否 < 50%?
249
+ # 5. Update tasks.md to mark tasks complete
250
+ ```
212
251
 
213
- ### 3. 规范的一致性
252
+ ### Task 2: Check Project Status
214
253
 
215
- **原则**:
216
- - 所有 Spec 遵循相同的规范
217
- - 不要在不同 Spec 中使用不同的流程
218
- - 发现问题及时更新 CORE_PRINCIPLES
254
+ ```bash
255
+ kse status
256
+ ```
219
257
 
220
- **实践**:
221
- - ✅ 基于 Spec 推进所有工作
222
- - ✅ 产物归档到对应的 Spec 目录
223
- - ✅ 不要在根目录生成临时文件
258
+ Shows all Specs and their completion progress.
224
259
 
225
- ### 4. 知识的沉淀
260
+ ### Task 3: Work on Specific Task
226
261
 
227
- **原则**:
228
- - 通用经验沉淀到 CORE_PRINCIPLES
229
- - Spec 特定经验保留在 Spec 目录
230
- - 定期回顾和更新规范
262
+ ```bash
263
+ # Generate focused prompt for one task
264
+ kse prompt generate 01-00-user-login 1.1
231
265
 
232
- **时机**:
233
- - Spec 完成后:总结经验教训
234
- - 新 Spec 开始前:评估现有规则是否适用
235
- - 发现重复问题时:更新 CORE_PRINCIPLES
266
+ # Claim the task
267
+ kse task claim 01-00-user-login 1.1
236
268
 
237
- ---
269
+ # Implement the task
238
270
 
239
- ## ⚠️ 常见错误
271
+ # Mark complete in tasks.md
272
+ ```
240
273
 
241
- ### 错误 1:CURRENT_CONTEXT 膨胀
274
+ ### Task 4: Understand Project Context
242
275
 
243
- **现象**:
244
- - session 启动后 token 使用率 > 50%
245
- - CURRENT_CONTEXT 包含大量历史数据
276
+ **Read these files in order:**
277
+ 1. `.kiro/README.md` (this file) - kse basics
278
+ 2. `.kiro/steering/CURRENT_CONTEXT.md` - Current work
279
+ 3. `.kiro/steering/CORE_PRINCIPLES.md` - Development rules
280
+ 4. `.kiro/specs/{spec-name}/requirements.md` - Feature requirements
281
+ 5. `.kiro/specs/{spec-name}/design.md` - Feature design
246
282
 
247
- **解决**:
248
- - 立即精简 CURRENT_CONTEXT
249
- - 将详细数据归档到 Spec 目录
250
- - 只保留当前阶段的核心信息
283
+ ---
251
284
 
252
- ### 错误 2:规范不一致
285
+ ## 💡 Best Practices for AI
253
286
 
254
- **现象**:
255
- - 不同 Spec 使用不同的开发流程
256
- - 文件组织混乱
287
+ ### DO:
288
+ - Always check `kse workflows` to see available Specs
289
+ - ✅ Export context before implementing: `kse context export <spec>`
290
+ - ✅ Follow requirements and design documents strictly
291
+ - ✅ Update tasks.md as you complete work
292
+ - ✅ Read steering rules in `.kiro/steering/`
293
+ - ✅ Keep all Spec artifacts in the Spec directory
257
294
 
258
- **解决**:
259
- - 重新阅读 CORE_PRINCIPLES
260
- - 按照规范重新组织文件
261
- - 将散落的产物归档到 Spec 目录
295
+ ### DON'T:
296
+ - Implement features without checking for Specs first
297
+ - ❌ Ignore requirements or design documents
298
+ - Create temporary files in project root
299
+ - ❌ Skip updating task status
300
+ - ❌ Deviate from architecture without discussion
262
301
 
263
- ### 错误 3:产物散落
302
+ ---
264
303
 
265
- **现象**:
266
- - 脚本、测试、报告散落在项目各处
267
- - 缺乏上下文,难以理解
304
+ ## 🚀 Quick Reference
268
305
 
269
- **解决**:
270
- - 所有产物归档到对应的 Spec 目录
271
- - 不要在根目录生成临时文件
272
- - 遵循 Spec 驱动开发原则
306
+ | Task | Command |
307
+ |------|---------|
308
+ | List all Specs | `kse workflows` |
309
+ | Check status | `kse status` |
310
+ | Export Spec | `kse context export <spec>` |
311
+ | Generate task prompt | `kse prompt generate <spec> <task>` |
312
+ | Claim task | `kse task claim <spec> <task>` |
313
+ | Verify setup | `kse doctor` |
273
314
 
274
315
  ---
275
316
 
276
- ## 📚 相关文档
317
+ ## 📚 Learn More
277
318
 
278
- - **Steering 索引**: `.kiro/steering/RULES_GUIDE.md`
279
- - **核心开发原则**: `.kiro/steering/CORE_PRINCIPLES.md`
280
- - **环境配置**: `.kiro/steering/ENVIRONMENT.md`
281
- - **当前场景**: `.kiro/steering/CURRENT_CONTEXT.md`
282
- - **Spec 工作流指南**: `.kiro/specs/SPEC_WORKFLOW_GUIDE.md`
319
+ - **Spec Workflow Guide**: `.kiro/specs/SPEC_WORKFLOW_GUIDE.md`
320
+ - **Core Principles**: `.kiro/steering/CORE_PRINCIPLES.md`
321
+ - **Current Context**: `.kiro/steering/CURRENT_CONTEXT.md`
322
+ - **Environment**: `.kiro/steering/ENVIRONMENT.md`
283
323
 
284
324
  ---
285
325
 
286
- **版本**: v1.0
287
- **创建**: 2025-01-22
288
- **说明**: 这是新项目引导文档,日常开发时不需要加载
326
+ **kse Version**: 1.5.4
327
+ **Last Updated**: 2026-01-24
328
+ **Purpose**: AI tool reference for kse usage