cowork-flow 0.0.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/README.md +193 -0
- package/bin/cowork-flow.js +9 -0
- package/package.json +28 -0
- package/src/cli.js +61 -0
- package/src/commands/init.js +88 -0
- package/src/commands/sync.js +33 -0
- package/src/commands/update.js +60 -0
- package/src/lib/copy-template.js +189 -0
- package/src/lib/package-info.js +49 -0
- package/src/lib/paths.js +6 -0
- package/template/.agent/skills/break-loop/SKILL.md +131 -0
- package/template/.agent/skills/check-cross-layer/SKILL.md +158 -0
- package/template/.agent/skills/finish-work/SKILL.md +163 -0
- package/template/.agent/skills/record-session/SKILL.md +78 -0
- package/template/.agent/skills/start/SKILL.md +390 -0
- package/template/.agent/skills/update-spec/SKILL.md +335 -0
- package/template/.cowork-flow/.version +1 -0
- package/template/.cowork-flow/changes/archive/.gitkeep +1 -0
- package/template/.cowork-flow/config.yaml +49 -0
- package/template/.cowork-flow/plans/.gitkeep +1 -0
- package/template/.cowork-flow/scripts/add_session.py +441 -0
- package/template/.cowork-flow/scripts/change.py +314 -0
- package/template/.cowork-flow/scripts/common/__init__.py +84 -0
- package/template/.cowork-flow/scripts/common/config.py +128 -0
- package/template/.cowork-flow/scripts/common/developer.py +205 -0
- package/template/.cowork-flow/scripts/common/files.py +24 -0
- package/template/.cowork-flow/scripts/common/git_context.py +628 -0
- package/template/.cowork-flow/scripts/common/paths.py +350 -0
- package/template/.cowork-flow/scripts/common/task_utils.py +200 -0
- package/template/.cowork-flow/scripts/get_context.py +16 -0
- package/template/.cowork-flow/scripts/get_developer.py +26 -0
- package/template/.cowork-flow/scripts/init_developer.py +51 -0
- package/template/.cowork-flow/scripts/task.py +1378 -0
- package/template/.cowork-flow/spec/backend/database-guidelines.md +26 -0
- package/template/.cowork-flow/spec/backend/directory-structure.md +27 -0
- package/template/.cowork-flow/spec/backend/error-handling.md +20 -0
- package/template/.cowork-flow/spec/backend/index.md +36 -0
- package/template/.cowork-flow/spec/backend/logging-guidelines.md +20 -0
- package/template/.cowork-flow/spec/backend/quality-guidelines.md +24 -0
- package/template/.cowork-flow/spec/frontend/component-guidelines.md +19 -0
- package/template/.cowork-flow/spec/frontend/directory-structure.md +18 -0
- package/template/.cowork-flow/spec/frontend/hook-guidelines.md +17 -0
- package/template/.cowork-flow/spec/frontend/index.md +28 -0
- package/template/.cowork-flow/spec/frontend/quality-guidelines.md +23 -0
- package/template/.cowork-flow/spec/frontend/state-management.md +18 -0
- package/template/.cowork-flow/spec/frontend/type-safety.md +18 -0
- package/template/.cowork-flow/spec/guides/code-reuse-thinking-guide.md +26 -0
- package/template/.cowork-flow/spec/guides/cross-layer-thinking-guide.md +21 -0
- package/template/.cowork-flow/spec/guides/index.md +31 -0
- package/template/.cowork-flow/spec/guides/pre-implementation-checklist.md +15 -0
- package/template/.cowork-flow/tasks/.gitkeep +1 -0
- package/template/.cowork-flow/tasks/archive/.gitkeep +1 -0
- package/template/.cowork-flow/workflow.md +411 -0
- package/template/.cowork-flow/workspace/index.md +95 -0
- package/template/.superpowers/brainstorming/SKILL.md +164 -0
- package/template/.superpowers/brainstorming/scripts/frame-template.html +214 -0
- package/template/.superpowers/brainstorming/scripts/helper.js +88 -0
- package/template/.superpowers/brainstorming/scripts/server.cjs +354 -0
- package/template/.superpowers/brainstorming/scripts/start-server.sh +148 -0
- package/template/.superpowers/brainstorming/scripts/stop-server.sh +56 -0
- package/template/.superpowers/brainstorming/spec-document-reviewer-prompt.md +49 -0
- package/template/.superpowers/brainstorming/visual-companion.md +287 -0
- package/template/.superpowers/dispatching-parallel-agents/SKILL.md +182 -0
- package/template/.superpowers/executing-plans/SKILL.md +70 -0
- package/template/.superpowers/finishing-a-development-branch/SKILL.md +251 -0
- package/template/.superpowers/receiving-code-review/SKILL.md +213 -0
- package/template/.superpowers/requesting-code-review/SKILL.md +103 -0
- package/template/.superpowers/requesting-code-review/code-reviewer.md +168 -0
- package/template/.superpowers/subagent-driven-development/SKILL.md +279 -0
- package/template/.superpowers/subagent-driven-development/code-quality-reviewer-prompt.md +25 -0
- package/template/.superpowers/subagent-driven-development/implementer-prompt.md +113 -0
- package/template/.superpowers/subagent-driven-development/spec-reviewer-prompt.md +61 -0
- package/template/.superpowers/systematic-debugging/CREATION-LOG.md +119 -0
- package/template/.superpowers/systematic-debugging/SKILL.md +296 -0
- package/template/.superpowers/systematic-debugging/condition-based-waiting-example.ts +158 -0
- package/template/.superpowers/systematic-debugging/condition-based-waiting.md +115 -0
- package/template/.superpowers/systematic-debugging/defense-in-depth.md +122 -0
- package/template/.superpowers/systematic-debugging/find-polluter.sh +63 -0
- package/template/.superpowers/systematic-debugging/root-cause-tracing.md +169 -0
- package/template/.superpowers/systematic-debugging/test-academic.md +14 -0
- package/template/.superpowers/systematic-debugging/test-pressure-1.md +58 -0
- package/template/.superpowers/systematic-debugging/test-pressure-2.md +68 -0
- package/template/.superpowers/systematic-debugging/test-pressure-3.md +69 -0
- package/template/.superpowers/test-driven-development/SKILL.md +371 -0
- package/template/.superpowers/test-driven-development/testing-anti-patterns.md +299 -0
- package/template/.superpowers/using-git-worktrees/SKILL.md +215 -0
- package/template/.superpowers/using-superpowers/SKILL.md +117 -0
- package/template/.superpowers/using-superpowers/references/codex-tools.md +59 -0
- package/template/.superpowers/using-superpowers/references/copilot-tools.md +42 -0
- package/template/.superpowers/using-superpowers/references/gemini-tools.md +51 -0
- package/template/.superpowers/verification-before-completion/SKILL.md +139 -0
- package/template/.superpowers/writing-plans/SKILL.md +152 -0
- package/template/.superpowers/writing-plans/plan-document-reviewer-prompt.md +49 -0
- package/template/.superpowers/writing-skills/SKILL.md +655 -0
- package/template/.superpowers/writing-skills/anthropic-best-practices.md +1150 -0
- package/template/.superpowers/writing-skills/examples/CLAUDE_MD_TESTING.md +189 -0
- package/template/.superpowers/writing-skills/graphviz-conventions.dot +172 -0
- package/template/.superpowers/writing-skills/persuasion-principles.md +187 -0
- package/template/.superpowers/writing-skills/render-graphs.js +168 -0
- package/template/.superpowers/writing-skills/testing-skills-with-subagents.md +384 -0
- package/template/AGENTS.md +116 -0
|
@@ -0,0 +1,411 @@
|
|
|
1
|
+
# 标准开发工作流
|
|
2
|
+
|
|
3
|
+
## 1. 流程目标
|
|
4
|
+
|
|
5
|
+
开发过程必须形成稳定闭环:
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
获取上下文 -> 阅读规范 -> 任务分级 -> 规格与计划 -> 执行实现 -> 验证审阅 -> 状态同步 -> session 记录
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
所有任务都应先明确目标和验收标准,再进入实现;所有完成结论都必须有验证证据支撑。
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## 2. 职责边界
|
|
16
|
+
|
|
17
|
+
### 2.1 cowork-flow change
|
|
18
|
+
|
|
19
|
+
`cowork-flow change` 负责行为变更治理:
|
|
20
|
+
|
|
21
|
+
- proposal:为什么要改
|
|
22
|
+
- spec:外部行为与验收标准
|
|
23
|
+
- design:重要设计取舍,主要用于复杂或跨层变更
|
|
24
|
+
- change.yaml:变更状态、分级、关联 plan / task
|
|
25
|
+
- archive:完成后的行为规格归档
|
|
26
|
+
|
|
27
|
+
### 2.2 superpowers
|
|
28
|
+
|
|
29
|
+
`superpowers` 负责工作方法:
|
|
30
|
+
|
|
31
|
+
- `superpowers:brainstorming`:澄清需求、比较方案、形成设计
|
|
32
|
+
- `superpowers:writing-plans`:把设计拆成可执行计划
|
|
33
|
+
- `superpowers:test-driven-development` 是实现阶段的强制方法。除一次性原型、生成代码、纯配置文件等明确例外并经人工确认外,功能新增、缺陷修复、重构和行为变更都必须按 RED-GREEN-REFACTOR 推进:先写失败测试并确认失败原因正确,再写最小实现使测试通过,最后在测试保护下重构。复杂或难点问题:深度优先
|
|
34
|
+
- `superpowers:executing-plans`:按计划顺序执行
|
|
35
|
+
- `superpowers:subagent-driven-development`:在适合时并行拆分独立工作
|
|
36
|
+
- `superpowers:verification-before-completion`:完成前用证据验证
|
|
37
|
+
|
|
38
|
+
### 2.3 任务状态与上下文
|
|
39
|
+
|
|
40
|
+
`.cowork-flow` 负责承载任务状态与上下文:
|
|
41
|
+
|
|
42
|
+
- 当前开发者身份
|
|
43
|
+
- 当前任务
|
|
44
|
+
- 任务 PRD
|
|
45
|
+
- implement / check / debug 上下文
|
|
46
|
+
- journal 与 session 记录
|
|
47
|
+
- 任务归档
|
|
48
|
+
|
|
49
|
+
执行按 superpowers 方法推进;`.cowork-flow` 不替代 superpowers,也不替代项目验证命令。
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## 3. 核心原则
|
|
54
|
+
|
|
55
|
+
1. **先读后写**:动手前先读取项目规则、任务上下文和相关规范。
|
|
56
|
+
2. **规格先行**:有行为变化时,先补规格,再写计划,再实现。
|
|
57
|
+
3. **计划后编码**:复杂或行为变更任务必须先形成可执行计划。
|
|
58
|
+
4. **上下文显式化**:不要依赖记忆,把关键规范、设计、计划写入任务上下文。
|
|
59
|
+
5. **一次一个任务**:避免在多个无关任务之间来回切换。
|
|
60
|
+
6. **执行中回写状态**:计划、任务状态、change metadata 和 journal 不应长期漂移。
|
|
61
|
+
7. **证据先于结论**:未验证前不声称完成、通过或可交付。
|
|
62
|
+
8. **经验沉淀回规范**:实现中发现的契约、坑点、规则应更新到 `.cowork-flow/spec/`。
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## 4. 会话开始流程
|
|
67
|
+
|
|
68
|
+
### 4.1 初始化开发者身份
|
|
69
|
+
|
|
70
|
+
首次进入项目时执行:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
python3 ./.cowork-flow/scripts/get_developer.py
|
|
74
|
+
python3 ./.cowork-flow/scripts/init_developer.py <developer-name>
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
如果已经存在开发者身份,只需读取当前身份。
|
|
78
|
+
|
|
79
|
+
### 4.2 获取当前上下文
|
|
80
|
+
|
|
81
|
+
每次开始工作先执行:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
python3 ./.cowork-flow/scripts/get_context.py
|
|
85
|
+
python3 ./.cowork-flow/scripts/task.py list
|
|
86
|
+
git status
|
|
87
|
+
git log --oneline -10
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
至少确认:
|
|
91
|
+
|
|
92
|
+
- 当前开发者是谁
|
|
93
|
+
- 是否存在当前任务
|
|
94
|
+
- 是否存在未归档任务
|
|
95
|
+
- 工作区是否干净
|
|
96
|
+
- 最近提交是否影响当前任务
|
|
97
|
+
|
|
98
|
+
### 4.3 阅读固定入口文件
|
|
99
|
+
|
|
100
|
+
开始编码前至少读取:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
cat AGENTS.md
|
|
104
|
+
for f in .cowork-flow/spec/frontend/index.md .cowork-flow/spec/backend/index.md .cowork-flow/spec/guides/index.md; do
|
|
105
|
+
[ -f "$f" ] && cat "$f"
|
|
106
|
+
done
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
然后根据索引读取与当前任务相关的细分规范。
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## 5. 任务分级
|
|
114
|
+
|
|
115
|
+
所有任务先分级,再选择流程。
|
|
116
|
+
|
|
117
|
+
### 5.1 L0:无外部行为变化
|
|
118
|
+
|
|
119
|
+
适用场景:
|
|
120
|
+
|
|
121
|
+
- 文档整理
|
|
122
|
+
- 小范围重构
|
|
123
|
+
- 测试补充
|
|
124
|
+
- 注释、格式、脚本清理
|
|
125
|
+
- 不改变用户可观察行为的内部调整
|
|
126
|
+
|
|
127
|
+
流程:
|
|
128
|
+
|
|
129
|
+
```text
|
|
130
|
+
任务 -> 读取规范 -> 简短计划 -> 实现 -> 验证 -> 记录 session
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### 5.2 L1:局部行为变化
|
|
134
|
+
|
|
135
|
+
适用场景:
|
|
136
|
+
|
|
137
|
+
- 单模块功能调整
|
|
138
|
+
- 单接口行为变化
|
|
139
|
+
- 局部数据处理逻辑变化
|
|
140
|
+
- 有明确边界的新能力
|
|
141
|
+
|
|
142
|
+
流程:
|
|
143
|
+
|
|
144
|
+
```text
|
|
145
|
+
cowork-flow change -> brainstorming -> writing-plans -> 任务上下文 -> 执行计划 -> 验证 -> 归档与记录
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### 5.3 L2:跨层或重要行为变化
|
|
149
|
+
|
|
150
|
+
适用场景:
|
|
151
|
+
|
|
152
|
+
- 跨前后端或跨服务变更
|
|
153
|
+
- API / DB / 消息 / 缓存 / 文件等契约变化
|
|
154
|
+
- 架构边界变化
|
|
155
|
+
- 影响发布、迁移、安全、权限或兼容性的变更
|
|
156
|
+
|
|
157
|
+
流程:
|
|
158
|
+
|
|
159
|
+
```text
|
|
160
|
+
cowork-flow change -> brainstorming -> design.md -> writing-plans -> 任务上下文 -> 执行计划 -> 多视角审阅 -> 验证 -> 归档与记录
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## 6. L0 标准流程
|
|
166
|
+
|
|
167
|
+
### 6.1 创建或选择任务
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
python3 ./.cowork-flow/scripts/task.py list
|
|
171
|
+
python3 ./.cowork-flow/scripts/task.py create "<title>" --slug <task-name>
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### 6.2 写入任务 PRD
|
|
175
|
+
|
|
176
|
+
在任务目录创建或更新 `prd.md`,至少包含:
|
|
177
|
+
|
|
178
|
+
- 目标
|
|
179
|
+
- 范围
|
|
180
|
+
- 验收标准
|
|
181
|
+
- 相关文件或模块
|
|
182
|
+
- 验证方式
|
|
183
|
+
|
|
184
|
+
### 6.3 初始化任务上下文
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
python3 ./.cowork-flow/scripts/task.py init-context <task-dir> <type>
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
`<type>` 按任务选择:
|
|
191
|
+
|
|
192
|
+
- `backend`
|
|
193
|
+
- `frontend`
|
|
194
|
+
- `fullstack`
|
|
195
|
+
- `test`
|
|
196
|
+
- `docs`
|
|
197
|
+
|
|
198
|
+
### 6.4 补充任务上下文
|
|
199
|
+
|
|
200
|
+
把任务相关规范、代码模式、计划文件加入上下文:
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
python3 ./.cowork-flow/scripts/task.py add-context <task-dir> implement <path> "<reason>"
|
|
204
|
+
python3 ./.cowork-flow/scripts/task.py add-context <task-dir> check <path> "<reason>"
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### 6.5 激活任务并执行
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
python3 ./.cowork-flow/scripts/task.py start <task-dir>
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
执行要求:
|
|
214
|
+
|
|
215
|
+
- 按 `prd.md` 和上下文实现
|
|
216
|
+
- 遵循 `.cowork-flow/spec/` 中的相关规范
|
|
217
|
+
- 变更保持聚焦
|
|
218
|
+
- 若执行中发现行为变化升级,立即重新分级并进入 L1 / L2 流程
|
|
219
|
+
- 执行计划中的每个实现步骤必须优先进入 `superpowers:test-driven-development` 循环,不得先写生产代码再补测试。
|
|
220
|
+
|
|
221
|
+
---
|
|
222
|
+
|
|
223
|
+
## 7. L1 / L2 标准流程
|
|
224
|
+
|
|
225
|
+
### 7.1 创建 cowork-flow change
|
|
226
|
+
|
|
227
|
+
```bash
|
|
228
|
+
python3 ./.cowork-flow/scripts/change.py create <slug>
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### 7.2 使用 brainstorming 形成方案
|
|
232
|
+
|
|
233
|
+
使用 `superpowers:brainstorming` 澄清需求、比较方案,并补齐:
|
|
234
|
+
|
|
235
|
+
- `.cowork-flow/changes/<slug>/proposal.md`
|
|
236
|
+
- `.cowork-flow/changes/<slug>/specs/.../spec.md`
|
|
237
|
+
- L2 任务需要 `.cowork-flow/changes/<slug>/design.md`
|
|
238
|
+
|
|
239
|
+
### 7.3 校验 cowork-flow change
|
|
240
|
+
|
|
241
|
+
```bash
|
|
242
|
+
python3 ./.cowork-flow/scripts/change.py validate <slug>
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
### 7.4 使用 writing-plans 形成计划
|
|
246
|
+
|
|
247
|
+
使用 `superpowers:writing-plans` 输出可执行计划:
|
|
248
|
+
|
|
249
|
+
```text
|
|
250
|
+
.cowork-flow/plans/YYYY-MM-DD-<slug>.md
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
计划必须包含:
|
|
254
|
+
|
|
255
|
+
- 可勾选步骤
|
|
256
|
+
- 每步验证方式
|
|
257
|
+
- 当前执行状态
|
|
258
|
+
- 阻塞与决策记录位置
|
|
259
|
+
|
|
260
|
+
### 7.5 同步计划与状态边界
|
|
261
|
+
|
|
262
|
+
`.cowork-flow/changes/<slug>/` 只保存 proposal、design、behavior specs 和 change.yaml。
|
|
263
|
+
实现 checklist 只保存在 `.cowork-flow/plans/*.md`。
|
|
264
|
+
任务运行状态只保存在 `.cowork-flow/tasks/`。
|
|
265
|
+
|
|
266
|
+
不要在 change 目录中维护实现 checklist,避免维护两套细节状态。
|
|
267
|
+
|
|
268
|
+
### 7.6 创建或绑定任务
|
|
269
|
+
|
|
270
|
+
将以下内容加入任务上下文:
|
|
271
|
+
|
|
272
|
+
- proposal
|
|
273
|
+
- spec
|
|
274
|
+
- design,如存在
|
|
275
|
+
- implementation plan
|
|
276
|
+
- 相关 `.cowork-flow/spec/`
|
|
277
|
+
- 相关代码模式或契约文件
|
|
278
|
+
|
|
279
|
+
### 7.7 按 superpowers 方法执行
|
|
280
|
+
|
|
281
|
+
执行时使用:
|
|
282
|
+
|
|
283
|
+
- `superpowers:executing-plans`
|
|
284
|
+
- 或在存在独立并行工作时使用 `superpowers:subagent-driven-development`
|
|
285
|
+
- `superpowers:test-driven-development` 不得先写生产代码再补测试。
|
|
286
|
+
|
|
287
|
+
执行中必须持续同步:
|
|
288
|
+
|
|
289
|
+
- plan checkbox
|
|
290
|
+
- plan 当前执行状态
|
|
291
|
+
- 任务状态
|
|
292
|
+
- 必要的 `.cowork-flow/spec/` 更新
|
|
293
|
+
|
|
294
|
+
---
|
|
295
|
+
|
|
296
|
+
## 8. 验证与审阅
|
|
297
|
+
|
|
298
|
+
### 8.1 验证命令来源
|
|
299
|
+
|
|
300
|
+
验证命令按以下顺序读取:
|
|
301
|
+
|
|
302
|
+
1. `.cowork-flow/config.yaml`
|
|
303
|
+
2. `AGENTS.md`
|
|
304
|
+
3. 项目现有脚本或配置文件
|
|
305
|
+
|
|
306
|
+
如果需要推断验证命令,必须明确说明推断依据。
|
|
307
|
+
|
|
308
|
+
### 8.2 完成前检查
|
|
309
|
+
|
|
310
|
+
完成前至少确认:
|
|
311
|
+
|
|
312
|
+
- 相关测试通过
|
|
313
|
+
- 新增或修改的行为有测试先失败、再通过的验证证据
|
|
314
|
+
- lint / format / build / typecheck 按项目要求通过
|
|
315
|
+
- 行为符合 cowork-flow change 规格或 PRD
|
|
316
|
+
- 相关 `.cowork-flow/spec/` 已同步
|
|
317
|
+
- 计划状态与真实进度一致
|
|
318
|
+
- 没有未说明的临时文件、调试输出或绕过逻辑
|
|
319
|
+
|
|
320
|
+
### 8.3 L2 额外审阅
|
|
321
|
+
|
|
322
|
+
L2 任务完成前需要多视角审阅:
|
|
323
|
+
|
|
324
|
+
- 行为契约
|
|
325
|
+
- 数据流
|
|
326
|
+
- 错误处理
|
|
327
|
+
- 兼容性
|
|
328
|
+
- 测试覆盖
|
|
329
|
+
- 发布或迁移风险
|
|
330
|
+
|
|
331
|
+
---
|
|
332
|
+
|
|
333
|
+
## 9. 会话结束流程
|
|
334
|
+
|
|
335
|
+
### 9.1 收尾前同步状态
|
|
336
|
+
|
|
337
|
+
结束前确认:
|
|
338
|
+
|
|
339
|
+
- 当前 task 状态准确
|
|
340
|
+
- plan checkbox 与真实进度一致
|
|
341
|
+
- change metadata 与 plan 高层状态一致
|
|
342
|
+
- `.cowork-flow/spec/` 已沉淀必要经验
|
|
343
|
+
- 工作区状态清晰
|
|
344
|
+
|
|
345
|
+
### 9.2 记录 session
|
|
346
|
+
|
|
347
|
+
```bash
|
|
348
|
+
python3 ./.cowork-flow/scripts/get_context.py --mode record
|
|
349
|
+
python3 ./.cowork-flow/scripts/add_session.py \
|
|
350
|
+
--title "<session-title>" \
|
|
351
|
+
--commit "<commit-or-handoff-ref>" \
|
|
352
|
+
--summary "<summary>"
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
### 9.3 归档任务
|
|
356
|
+
|
|
357
|
+
仅在任务真实完成后归档:
|
|
358
|
+
|
|
359
|
+
```bash
|
|
360
|
+
python3 ./.cowork-flow/scripts/task.py archive <task-name>
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
行为变更任务还需要归档 cowork-flow change:
|
|
364
|
+
|
|
365
|
+
```bash
|
|
366
|
+
python3 ./.cowork-flow/scripts/change.py archive <slug>
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
---
|
|
370
|
+
|
|
371
|
+
## 10. 状态持久化规则
|
|
372
|
+
|
|
373
|
+
长任务必须把关键状态写入文件,而不是只留在聊天上下文中。
|
|
374
|
+
|
|
375
|
+
| 状态 | 持久化位置 |
|
|
376
|
+
|------|------------|
|
|
377
|
+
| 当前开发者 | `.cowork-flow/.developer` |
|
|
378
|
+
| 当前任务 | `.cowork-flow/.current-task` |
|
|
379
|
+
| 任务目标 | `.cowork-flow/tasks/<task>/prd.md` |
|
|
380
|
+
| 任务上下文 | `.cowork-flow/tasks/<task>/*.jsonl` |
|
|
381
|
+
| 行为变更规格 | `.cowork-flow/changes/<slug>/` |
|
|
382
|
+
| 执行计划 | `.cowork-flow/plans/*.md` |
|
|
383
|
+
| 项目规范 | `.cowork-flow/spec/` |
|
|
384
|
+
| 会话记录 | `.cowork-flow/workspace/<developer>/journal-*.md` |
|
|
385
|
+
|
|
386
|
+
如果状态只存在于对话中,就不能视为可靠流程状态。
|
|
387
|
+
|
|
388
|
+
---
|
|
389
|
+
|
|
390
|
+
## 11. 禁止事项
|
|
391
|
+
|
|
392
|
+
- 不跳过上下文读取直接编码。
|
|
393
|
+
- 不在未验证时声称完成。
|
|
394
|
+
- 不把 reusable skill 改成项目临时清单。
|
|
395
|
+
- 不维护互相冲突的任务状态。
|
|
396
|
+
- 不在行为变化未补规格时直接实现。
|
|
397
|
+
- 不在计划未同步时记录 session 或归档任务。
|
|
398
|
+
|
|
399
|
+
---
|
|
400
|
+
|
|
401
|
+
## 12. 完成定义
|
|
402
|
+
|
|
403
|
+
一个任务只有在以下条件同时满足时,才算完成:
|
|
404
|
+
|
|
405
|
+
- 需求或 PRD 已满足
|
|
406
|
+
- cowork-flow change 规格或计划中的必要步骤已完成
|
|
407
|
+
- 验证命令已按项目要求执行
|
|
408
|
+
- 失败、跳过或无法执行的验证已明确说明
|
|
409
|
+
- 相关规范已更新
|
|
410
|
+
- change metadata、计划状态、任务状态不冲突
|
|
411
|
+
- session 已记录
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# 工作区索引
|
|
2
|
+
|
|
3
|
+
> 记录所有开发者的 AI 会话工作记录
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 概览
|
|
8
|
+
|
|
9
|
+
此目录用于跟踪项目中所有开发者与 AI 协作时产生的记录。
|
|
10
|
+
|
|
11
|
+
### 目录结构
|
|
12
|
+
|
|
13
|
+
```text
|
|
14
|
+
workspace/
|
|
15
|
+
|-- index.md # 当前文件:主索引
|
|
16
|
+
+-- {developer}/ # 每个开发者的独立目录
|
|
17
|
+
|-- index.md # 个人索引与会话历史
|
|
18
|
+
+-- journal-N.md # 顺序递增的日志文件
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## 活跃开发者
|
|
24
|
+
|
|
25
|
+
| 开发者 | 最近活跃 | 会话数 | 当前文件 |
|
|
26
|
+
|--------|----------|--------|----------|
|
|
27
|
+
| (none yet) | - | - | - |
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## 开始使用
|
|
32
|
+
|
|
33
|
+
### 新开发者
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
python3 ./.cowork-flow/scripts/init_developer.py <your-name>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### 已初始化开发者
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
python3 ./.cowork-flow/scripts/get_developer.py
|
|
43
|
+
cat .cowork-flow/workspace/$(python3 ./.cowork-flow/scripts/get_developer.py)/index.md
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## 记录约定
|
|
49
|
+
|
|
50
|
+
- 单个 journal 文件最多 `2000` 行
|
|
51
|
+
- 超过上限后,创建 `journal-{N+1}.md`
|
|
52
|
+
- 新建文件后,更新个人 `index.md`
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## 会话模板
|
|
57
|
+
|
|
58
|
+
```markdown
|
|
59
|
+
## 会话 {N}:{标题}
|
|
60
|
+
|
|
61
|
+
**日期**:YYYY-MM-DD
|
|
62
|
+
**任务**:{task-name}
|
|
63
|
+
|
|
64
|
+
### 摘要
|
|
65
|
+
|
|
66
|
+
{一句话摘要}
|
|
67
|
+
|
|
68
|
+
### 主要变更
|
|
69
|
+
|
|
70
|
+
- {变更 1}
|
|
71
|
+
- {变更 2}
|
|
72
|
+
|
|
73
|
+
### Git 提交
|
|
74
|
+
|
|
75
|
+
| 哈希 | 说明 |
|
|
76
|
+
|------|------|
|
|
77
|
+
| `abc1234` | {commit message} |
|
|
78
|
+
|
|
79
|
+
### 验证
|
|
80
|
+
|
|
81
|
+
- [OK] {验证结果}
|
|
82
|
+
|
|
83
|
+
### 状态
|
|
84
|
+
|
|
85
|
+
[OK] **已完成** / # **进行中** / [P] **阻塞**
|
|
86
|
+
|
|
87
|
+
### 后续动作
|
|
88
|
+
|
|
89
|
+
- {后续动作 1}
|
|
90
|
+
- {后续动作 2}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
**语言约定**:新增记录默认使用中文;如果项目统一使用英文,请在复制后整体改口径。
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: brainstorming
|
|
3
|
+
description: "You MUST use this before any creative work - creating features, building components, adding functionality, or modifying behavior. Explores user intent, requirements and design before implementation."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Brainstorming Ideas Into Designs
|
|
7
|
+
|
|
8
|
+
Help turn ideas into fully formed designs and specs through natural collaborative dialogue.
|
|
9
|
+
|
|
10
|
+
Start by understanding the current project context, then ask questions one at a time to refine the idea. Once you understand what you're building, present the design and get user approval.
|
|
11
|
+
|
|
12
|
+
<HARD-GATE>
|
|
13
|
+
Do NOT invoke any implementation skill, write any code, scaffold any project, or take any implementation action until you have presented a design and the user has approved it. This applies to EVERY project regardless of perceived simplicity.
|
|
14
|
+
</HARD-GATE>
|
|
15
|
+
|
|
16
|
+
## Anti-Pattern: "This Is Too Simple To Need A Design"
|
|
17
|
+
|
|
18
|
+
Every project goes through this process. A todo list, a single-function utility, a config change — all of them. "Simple" projects are where unexamined assumptions cause the most wasted work. The design can be short (a few sentences for truly simple projects), but you MUST present it and get approval.
|
|
19
|
+
|
|
20
|
+
## Checklist
|
|
21
|
+
|
|
22
|
+
You MUST create a task for each of these items and complete them in order:
|
|
23
|
+
|
|
24
|
+
1. **Explore project context** — check files, docs, recent commits
|
|
25
|
+
2. **Offer visual companion** (if topic will involve visual questions) — this is its own message, not combined with a clarifying question. See the Visual Companion section below.
|
|
26
|
+
3. **Ask clarifying questions** — one at a time, understand purpose/constraints/success criteria
|
|
27
|
+
4. **Propose 2-3 approaches** — with trade-offs and your recommendation
|
|
28
|
+
5. **Present design** — in sections scaled to their complexity, get user approval after each section
|
|
29
|
+
6. **Write design doc** — save to `docs/superpowers/specs/YYYY-MM-DD-<topic>-design.md` and commit
|
|
30
|
+
7. **Spec self-review** — quick inline check for placeholders, contradictions, ambiguity, scope (see below)
|
|
31
|
+
8. **User reviews written spec** — ask user to review the spec file before proceeding
|
|
32
|
+
9. **Transition to implementation** — invoke writing-plans skill to create implementation plan
|
|
33
|
+
|
|
34
|
+
## Process Flow
|
|
35
|
+
|
|
36
|
+
```dot
|
|
37
|
+
digraph brainstorming {
|
|
38
|
+
"Explore project context" [shape=box];
|
|
39
|
+
"Visual questions ahead?" [shape=diamond];
|
|
40
|
+
"Offer Visual Companion\n(own message, no other content)" [shape=box];
|
|
41
|
+
"Ask clarifying questions" [shape=box];
|
|
42
|
+
"Propose 2-3 approaches" [shape=box];
|
|
43
|
+
"Present design sections" [shape=box];
|
|
44
|
+
"User approves design?" [shape=diamond];
|
|
45
|
+
"Write design doc" [shape=box];
|
|
46
|
+
"Spec self-review\n(fix inline)" [shape=box];
|
|
47
|
+
"User reviews spec?" [shape=diamond];
|
|
48
|
+
"Invoke writing-plans skill" [shape=doublecircle];
|
|
49
|
+
|
|
50
|
+
"Explore project context" -> "Visual questions ahead?";
|
|
51
|
+
"Visual questions ahead?" -> "Offer Visual Companion\n(own message, no other content)" [label="yes"];
|
|
52
|
+
"Visual questions ahead?" -> "Ask clarifying questions" [label="no"];
|
|
53
|
+
"Offer Visual Companion\n(own message, no other content)" -> "Ask clarifying questions";
|
|
54
|
+
"Ask clarifying questions" -> "Propose 2-3 approaches";
|
|
55
|
+
"Propose 2-3 approaches" -> "Present design sections";
|
|
56
|
+
"Present design sections" -> "User approves design?";
|
|
57
|
+
"User approves design?" -> "Present design sections" [label="no, revise"];
|
|
58
|
+
"User approves design?" -> "Write design doc" [label="yes"];
|
|
59
|
+
"Write design doc" -> "Spec self-review\n(fix inline)";
|
|
60
|
+
"Spec self-review\n(fix inline)" -> "User reviews spec?";
|
|
61
|
+
"User reviews spec?" -> "Write design doc" [label="changes requested"];
|
|
62
|
+
"User reviews spec?" -> "Invoke writing-plans skill" [label="approved"];
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
**The terminal state is invoking writing-plans.** Do NOT invoke frontend-design, mcp-builder, or any other implementation skill. The ONLY skill you invoke after brainstorming is writing-plans.
|
|
67
|
+
|
|
68
|
+
## The Process
|
|
69
|
+
|
|
70
|
+
**Understanding the idea:**
|
|
71
|
+
|
|
72
|
+
- Check out the current project state first (files, docs, recent commits)
|
|
73
|
+
- Before asking detailed questions, assess scope: if the request describes multiple independent subsystems (e.g., "build a platform with chat, file storage, billing, and analytics"), flag this immediately. Don't spend questions refining details of a project that needs to be decomposed first.
|
|
74
|
+
- If the project is too large for a single spec, help the user decompose into sub-projects: what are the independent pieces, how do they relate, what order should they be built? Then brainstorm the first sub-project through the normal design flow. Each sub-project gets its own spec → plan → implementation cycle.
|
|
75
|
+
- For appropriately-scoped projects, ask questions one at a time to refine the idea
|
|
76
|
+
- Prefer multiple choice questions when possible, but open-ended is fine too
|
|
77
|
+
- Only one question per message - if a topic needs more exploration, break it into multiple questions
|
|
78
|
+
- Focus on understanding: purpose, constraints, success criteria
|
|
79
|
+
|
|
80
|
+
**Exploring approaches:**
|
|
81
|
+
|
|
82
|
+
- Propose 2-3 different approaches with trade-offs
|
|
83
|
+
- Present options conversationally with your recommendation and reasoning
|
|
84
|
+
- Lead with your recommended option and explain why
|
|
85
|
+
|
|
86
|
+
**Presenting the design:**
|
|
87
|
+
|
|
88
|
+
- Once you believe you understand what you're building, present the design
|
|
89
|
+
- Scale each section to its complexity: a few sentences if straightforward, up to 200-300 words if nuanced
|
|
90
|
+
- Ask after each section whether it looks right so far
|
|
91
|
+
- Cover: architecture, components, data flow, error handling, testing
|
|
92
|
+
- Be ready to go back and clarify if something doesn't make sense
|
|
93
|
+
|
|
94
|
+
**Design for isolation and clarity:**
|
|
95
|
+
|
|
96
|
+
- Break the system into smaller units that each have one clear purpose, communicate through well-defined interfaces, and can be understood and tested independently
|
|
97
|
+
- For each unit, you should be able to answer: what does it do, how do you use it, and what does it depend on?
|
|
98
|
+
- Can someone understand what a unit does without reading its internals? Can you change the internals without breaking consumers? If not, the boundaries need work.
|
|
99
|
+
- Smaller, well-bounded units are also easier for you to work with - you reason better about code you can hold in context at once, and your edits are more reliable when files are focused. When a file grows large, that's often a signal that it's doing too much.
|
|
100
|
+
|
|
101
|
+
**Working in existing codebases:**
|
|
102
|
+
|
|
103
|
+
- Explore the current structure before proposing changes. Follow existing patterns.
|
|
104
|
+
- Where existing code has problems that affect the work (e.g., a file that's grown too large, unclear boundaries, tangled responsibilities), include targeted improvements as part of the design - the way a good developer improves code they're working in.
|
|
105
|
+
- Don't propose unrelated refactoring. Stay focused on what serves the current goal.
|
|
106
|
+
|
|
107
|
+
## After the Design
|
|
108
|
+
|
|
109
|
+
**Documentation:**
|
|
110
|
+
|
|
111
|
+
- Write the validated design (spec) to `docs/superpowers/specs/YYYY-MM-DD-<topic>-design.md`
|
|
112
|
+
- (User preferences for spec location override this default)
|
|
113
|
+
- Use elements-of-style:writing-clearly-and-concisely skill if available
|
|
114
|
+
- Commit the design document to git
|
|
115
|
+
|
|
116
|
+
**Spec Self-Review:**
|
|
117
|
+
After writing the spec document, look at it with fresh eyes:
|
|
118
|
+
|
|
119
|
+
1. **Placeholder scan:** Any "TBD", "TODO", incomplete sections, or vague requirements? Fix them.
|
|
120
|
+
2. **Internal consistency:** Do any sections contradict each other? Does the architecture match the feature descriptions?
|
|
121
|
+
3. **Scope check:** Is this focused enough for a single implementation plan, or does it need decomposition?
|
|
122
|
+
4. **Ambiguity check:** Could any requirement be interpreted two different ways? If so, pick one and make it explicit.
|
|
123
|
+
|
|
124
|
+
Fix any issues inline. No need to re-review — just fix and move on.
|
|
125
|
+
|
|
126
|
+
**User Review Gate:**
|
|
127
|
+
After the spec review loop passes, ask the user to review the written spec before proceeding:
|
|
128
|
+
|
|
129
|
+
> "Spec written and committed to `<path>`. Please review it and let me know if you want to make any changes before we start writing out the implementation plan."
|
|
130
|
+
|
|
131
|
+
Wait for the user's response. If they request changes, make them and re-run the spec review loop. Only proceed once the user approves.
|
|
132
|
+
|
|
133
|
+
**Implementation:**
|
|
134
|
+
|
|
135
|
+
- Invoke the writing-plans skill to create a detailed implementation plan
|
|
136
|
+
- Do NOT invoke any other skill. writing-plans is the next step.
|
|
137
|
+
|
|
138
|
+
## Key Principles
|
|
139
|
+
|
|
140
|
+
- **One question at a time** - Don't overwhelm with multiple questions
|
|
141
|
+
- **Multiple choice preferred** - Easier to answer than open-ended when possible
|
|
142
|
+
- **YAGNI ruthlessly** - Remove unnecessary features from all designs
|
|
143
|
+
- **Explore alternatives** - Always propose 2-3 approaches before settling
|
|
144
|
+
- **Incremental validation** - Present design, get approval before moving on
|
|
145
|
+
- **Be flexible** - Go back and clarify when something doesn't make sense
|
|
146
|
+
|
|
147
|
+
## Visual Companion
|
|
148
|
+
|
|
149
|
+
A browser-based companion for showing mockups, diagrams, and visual options during brainstorming. Available as a tool — not a mode. Accepting the companion means it's available for questions that benefit from visual treatment; it does NOT mean every question goes through the browser.
|
|
150
|
+
|
|
151
|
+
**Offering the companion:** When you anticipate that upcoming questions will involve visual content (mockups, layouts, diagrams), offer it once for consent:
|
|
152
|
+
> "Some of what we're working on might be easier to explain if I can show it to you in a web browser. I can put together mockups, diagrams, comparisons, and other visuals as we go. This feature is still new and can be token-intensive. Want to try it? (Requires opening a local URL)"
|
|
153
|
+
|
|
154
|
+
**This offer MUST be its own message.** Do not combine it with clarifying questions, context summaries, or any other content. The message should contain ONLY the offer above and nothing else. Wait for the user's response before continuing. If they decline, proceed with text-only brainstorming.
|
|
155
|
+
|
|
156
|
+
**Per-question decision:** Even after the user accepts, decide FOR EACH QUESTION whether to use the browser or the terminal. The test: **would the user understand this better by seeing it than reading it?**
|
|
157
|
+
|
|
158
|
+
- **Use the browser** for content that IS visual — mockups, wireframes, layout comparisons, architecture diagrams, side-by-side visual designs
|
|
159
|
+
- **Use the terminal** for content that is text — requirements questions, conceptual choices, tradeoff lists, A/B/C/D text options, scope decisions
|
|
160
|
+
|
|
161
|
+
A question about a UI topic is not automatically a visual question. "What does personality mean in this context?" is a conceptual question — use the terminal. "Which wizard layout works better?" is a visual question — use the browser.
|
|
162
|
+
|
|
163
|
+
If they agree to the companion, read the detailed guide before proceeding:
|
|
164
|
+
`skills/brainstorming/visual-companion.md`
|