你的第一个 greenfield 项目
这篇教程从空目录走到一张真实构建 card。你会写六个规划产物,每个被审两次——一次是没法讲价的脚本,一次是当批评家的模型。
先装 skill:安装与首次运行。
时间:一到两小时,看你在 Scope gate 对自己多老实。
你要走的流水线
Section titled “你要走的流水线”Idea -> Research -> Scope -> PRD -> ADR -> Contract -> Cards -> Build -> Review -> Deploy -> Verify-live -> Retro|------------------ 规划(flow/ 下的文件) ------------------| |------- 交付(cards/ 里) -------|规划是 stage 00 到 05,落在 flow/ 下的文件。交付在 cards/ 里。六个规划 gate 全过、或挂着诚实记录的 debt 之前,切不了 card。
第 1 步——先定“完成”长什么样
Section titled “第 1 步——先定“完成”长什么样”/flow project-type web项目类型决定 harness 最后要什么证据:web 要上线部署 URL,cli 要真实调用加预期输出和 exit code,library 要可导入的公开 API 加跑起来的示例,skill 要装好的、达到自定完成定义的 skill。默认 web。现在定,省得 contract 写错形状。
第 2 步——定谁写产物
Section titled “第 2 步——定谁写产物”/flow mode teachteach 模式(默认)你写每个规划产物,agent 只守门。work 模式 agent 采访你一次,自己起草 stage 00 到 05,只在 scope 签字处停下。gate 两边绑得一样;唯一区别是谁的手在键盘上。
学 harness,第一个项目留在 teach。你会看到每个 gate 到底在查什么。
第 3 步——stage 00,idea
Section titled “第 3 步——stage 00,idea”/flow nextrunner 建 flow/00-idea.md,gate 挂,因为模板满是 [FILL] 标记和没打的框。打开文件写三句话 pitch:谁有这个痛,他们今天怎么凑合,你打算换什么做法。真满足的框打勾。再跑 /flow next。
脚本通过之后,agent 施加刚完成的 stage 的语义挑战。这是脚本做不到的一半:如果你的“问题”是穿着问题衣服的方案,或 pitch 讲的是功能而不是疼的人,它会顶回来。
在这里毙掉项目是有效产出。 stage 00 毙掉弱想法花一小时。同一个想法 contract 之后再毙,花一星期。
第 4 步——stage 01,research
Section titled “第 4 步——stage 01,research”flow/01-research.md 填已经有什么:竞品、你看过的线上系统、你真查过的价格。这个 stage 的规则是先看——证据,不凭感觉。
这里的语义 gate 异常锋利,因为编造的调研是最好写、最难被脚本抓住的东西。没来源的引用、没打开过的竞品、没链接的市场数字——等着被问哪来的。
stage 真不合身——比如内部工具没有公开市场——别编。记 debt,老实跳过:
/flow debt add "skip 01-research" "internal tool, no public market" "before public release"/flow skip 01-research --reason "internal tool, no public market"skip 只有 open debt 行点名了正是这个 stage、且理由不是 security-class,才往前走。
第 5 步——stage 02 到 04,scope、PRD、ADR
Section titled “第 5 步——stage 02 到 04,scope、PRD、ADR”- Scope(
flow/02-scope.md)是项目通常得救或完蛋的地方。功能老实评级;语义 gate 盯着注水,C 级功能因为你想做被写成 B 级。 - PRD(
flow/03-prd.md)把活下来的 scope 变成编号功能需求。这里写的每个FRn日后必须被 card 认领、被 contract 接口服务——这条 trace 机械可审计。 - ADR(
flow/04-adr.md)记架构决策,重要的是否掉了什么、为什么。
每个跑完跑 /flow next。没定的东西挂 ## Open decisions 标题下当 - [ ] bullet;同一个 gate 扫描器数这些 bullet,没定的决策卡 stage,直到你定下来或有意识地挪走。
第 6 步——stage 05,contract
Section titled “第 6 步——stage 05,contract”flow/05-contract.md 是接缝,是唯一永远不能跳过的 stage。代码一行没有先写接口:web 项目写方法、路径、auth、请求 shape、响应 shape;CLI 写命令、flag、输出 shape、exit code。
从这里规则绝对:后端照着 contract build,UI 从 contract 消费。shape 错了,先改 contract,再改代码。这会儿拿 null 或 stub 把 shape 顶住,真值晚点发没关系。
gate 通过你会看到:
PASS: stage 05-contract gate clean. Planning is COMPLETE.All planning stages passed (or were debt-skipped). Run '/flow card' to create build cards.第 7 步——切第一张 card
Section titled “第 7 步——切第一张 card”/flow card写出 cards/C-001.md。card 是一次 scoped 构建会话:allowed-files 清单、它实现的需求、你真会跑的 ## Verify 块、描述用户可见证据的 ## Independent test、开头空着的 ## Evidence 节。
开工前跑 /flow recall——读回 open debt、上次 retro、上张 card 的 scope、promote 过的 playbook,开局先看到以前的痛。
第 8 步——构建,然后证明
Section titled “第 8 步——构建,然后证明”只建 card allowed-files 清单点名的东西。然后:
/flow check C-001## Evidence 空着 card 就挂,代码再完美、测试再绿也一样:
[x] status is 'done' but ## Evidence is empty (paste world-state proof: URL/curl/DB row)FAIL: C-001 has gate violations (above).贴真实证据——web 项目贴上线 URL 加实际 curl 输出,CLI 贴真实调用和 exit code——再 check:
PASS: C-001 is valid (status: done).你学到了什么
Section titled “你学到了什么”- 六个规划 gate,每个机械判一次、语义判一次。
- 毙掉和诚实的 debt 跳过都是一等结果。
- contract 先于代码写好,是唯一不能跳过的 stage。
- “Tests pass” 是中途;完成是世间的证据。
- 创建与检查 card,日常循环。
- stage 流水线,每个 stage 在防什么。
- 完成意味着世间的证据,第 8 步为什么严。