swe-workflow
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSWE Workflow
SWE 工作流
The idiomatic software-engineer workflow: clarify the idea → spec it → slice it → triage it → ship it. Five stages, each with a dedicated skill and a durable artifact that feeds the next.
标准的软件工程师工作流:明确想法 → 制定规格 → 拆分任务 → 分类处理 → 交付上线。共五个阶段,每个阶段都有专属技能,且会生成可复用的成果物供下一阶段使用。
The workflow
工作流
┌────────────────────── SPEC LAYER (mattpocock) ──────────────────────┐
│ │
│ 0. How is this repo set up? │
│ /setup-matt-pocock-skills ──► AGENTS.md, docs/agents/ │
│ (one-time: tracker, triage labels, doc layout — │
│ wires this repo's conventions into the chain) │
│ │
│ 1. What do I want? │
│ /grill-with-docs ──► CONTEXT.md, ADRs │
│ (resolve domain language; capture decisions) │
│ │
│ 2. What features does this break into? │
│ /to-features ──► FEATURES.md │
│ (read CONTEXT.md + ADRs → user-facing features; │
│ strike through, don't delete, on ship) │
│ │
│ 3. What does done look like? │
│ /to-prd ──► PRD (auto-labeled `ready-for-agent`) │
│ (Problem / Solution / User Stories / │
│ Implementation Decisions / Testing Decisions / Scope) │
│ │
│ 4. What are the units of work? │
│ /to-issues ──► N tracer-bullet issues │
│ (vertical slices, all auto-labeled `ready-for-agent` │
│ — /triage NOT in the critical path) │
│ │
└──────────────────────────────────────────────────────────────────────┘
│
(Agent grabs ONE `ready-for-agent` issue)
│
▼
┌────────── EXECUTION LAYER (worktree + planning-with-files) ──────────┐
│ │
│ 5. How do I plan each unit? │
│ Fetch issue (per tracker) ──► worktree + branch + seed files │
│ (task_plan.md, findings.md, progress.md from AC) │
│ │
│ /planning-with-files:plan ──► interview → refine the plan │
│ (sharpens phases, key questions, decisions to make) │
│ │
│ 6. How do I ship each unit? │
│ /planning-with-files:start ──► implement → commit │
│ (outer loop: phases, decisions, errors, findings) │
│ (apply karpathy-guidelines for code quality) │
│ │
│ /tdd ──► red → green → refactor (per code-producing phase) │
│ (inner loop: one failing test → one minimal fix) │
│ │
│ progress.md highlights ──► PR body / closing comment │
│ (the session log IS the PR narrative — don't rewrite) │
│ │
│ Teardown ──► git worktree remove + branch -d if merged │
│ │
└──────────────────────────────────────────────────────────────────────┘┌────────────────────── SPEC LAYER (mattpocock) ──────────────────────┐
│ │
│ 0. How is this repo set up? │
│ /setup-matt-pocock-skills ──► AGENTS.md, docs/agents/ │
│ (one-time: tracker, triage labels, doc layout — │
│ wires this repo's conventions into the chain) │
│ │
│ 1. What do I want? │
│ /grill-with-docs ──► CONTEXT.md, ADRs │
│ (resolve domain language; capture decisions) │
│ │
│ 2. What features does this break into? │
│ /to-features ──► FEATURES.md │
│ (read CONTEXT.md + ADRs → user-facing features; │
│ strike through, don't delete, on ship) │
│ │
│ 3. What does done look like? │
│ /to-prd ──► PRD (auto-labeled `ready-for-agent`) │
│ (Problem / Solution / User Stories / │
│ Implementation Decisions / Testing Decisions / Scope) │
│ │
│ 4. What are the units of work? │
│ /to-issues ──► N tracer-bullet issues │
│ (vertical slices, all auto-labeled `ready-for-agent` │
│ — /triage NOT in the critical path) │
│ │
└──────────────────────────────────────────────────────────────────────┘
│
(Agent grabs ONE `ready-for-agent` issue)
│
▼
┌────────── EXECUTION LAYER (worktree + planning-with-files) ──────────┐
│ │
│ 5. How do I plan each unit? │
│ Fetch issue (per tracker) ──► worktree + branch + seed files │
│ (task_plan.md, findings.md, progress.md from AC) │
│ │
│ /planning-with-files:plan ──► interview → refine the plan │
│ (sharpens phases, key questions, decisions to make) │
│ │
│ 6. How do I ship each unit? │
│ /planning-with-files:start ──► implement → commit │
│ (outer loop: phases, decisions, errors, findings) │
│ (apply karpathy-guidelines for code quality) │
│ │
│ /tdd ──► red → green → refactor (per code-producing phase) │
│ (inner loop: one failing test → one minimal fix) │
│ │
│ progress.md highlights ──► PR body / closing comment │
│ (the session log IS the PR narrative — don't rewrite) │
│ │
│ Teardown ──► git worktree remove + branch -d if merged │
│ │
└──────────────────────────────────────────────────────────────────────┘Parallel concern: /triage
/triage并行环节:/triage
/triage/triageneeds-infoready-for-agentready-for-humanwontfix/to-prd/to-issuesready-for-agentSee REFERENCE.md for the full state machine and per-state outputs.
/triageneeds-infoready-for-agentready-for-humanwontfix/to-prd/to-issuesready-for-agent完整状态机及各状态输出可查看REFERENCE.md。
Design philosophy
设计理念
This is a chain of small skills, not a framework. Three principles guard against drifting into framework opacity:
- Own the process. "Process" here means deciding what goes into context at each stage. Every skill in the chain is a markdown file you can read, edit, swap, or skip — there is no opaque orchestrator.
- Every artifact is observable. PRDs, issues, AGENT-BRIEFs, ,
task_plan.md,findings.md— all human-readable markdown, allprogress.md-able at any point.cat - Ephemeral state is intentional. Per-issue worktrees and planning files die when the PR ships. Deliberate defense against spec/plan drift accumulating into a "ball of mud" over time.
Operating maxim (Matt Pocock, after surveying ~2000 AI coding course participants on framework dissatisfaction): "a good framework hands a lot of control over to the user and is easy to observe." If a proposed addition reduces either, reject it — even if it's borrowed from a framework that looks useful.
Concrete commitments derived from these principles:
- Instructions-only, no scripts. Deterministic operations are documented as instructions the agent runs, not wrapped in scripts. Every script reintroduced would move the chain toward the opacity Matt's surveyed users rejected.
- Transparent markdown all the way down. Six chain stages plus as a parallel concern — every link is a markdown skill you can read, edit, or replace without touching code. None of them opaque. The direct test of the operating maxim above.
/triage
Engineering-side, by design. The mattpocock toolchain assumes features come from product thinking (user needs, business goals) that lives outside this skill ecosystem. Stage 2 () is the deliberate seam: features get enumerated here (read from + ADRs), but discovered elsewhere — in user interviews, product strategy, sales conversations, whatever your team uses. This toolchain has no opinion on that.
/to-featuresCONTEXT.mdSee REFERENCE.md for the comparison with spec-kit / BMAD / GSD.
这是一个小型技能链,而非框架。以下三大原则可避免陷入框架的不透明性:
- 掌控流程:此处的“流程”指决定每个阶段需要纳入哪些上下文信息。链中的每个技能都是可阅读、编辑、替换或跳过的markdown文件——不存在不透明的编排器。
- 所有成果物可观测:PRD、需求、AGENT-BRIEFs、、
task_plan.md、findings.md——所有文件均为人类可读的markdown格式,随时可通过progress.md命令查看。cat - 临时状态是有意设计的:每个需求对应的worktree和规划文件会在PR合并后删除。这是为了防止规格/规划偏差随时间积累成“一团乱麻”。
操作准则(Matt Pocock在调查约2000名AI编码课程参与者对框架的不满点后提出):*“优秀的框架会将大量控制权交给用户,且易于观测。”*如果某项新增功能会降低控制权或可观测性,即使它来自看似有用的框架,也要拒绝。
基于上述原则的具体承诺:
- 仅含指令,无脚本:确定性操作以Agent执行的指令形式记录,而非封装在脚本中。每引入一个脚本都会使技能链向Matt调查用户所排斥的不透明性靠拢。
- 全程使用透明markdown:六个核心阶段加并行环节——每个环节都是markdown技能文件,无需修改代码即可阅读、编辑或替换。所有环节均透明可见,这是对上述操作准则的直接验证。
/triage
专为工程侧设计:mattpocock工具链假设功能源自外部的产品思考(用户需求、业务目标),而非本技能生态系统。第2阶段()是刻意设置的衔接点:功能在此处被枚举(从+ADRs读取),但发现于外部——用户访谈、产品策略、销售对话,或团队使用的任何其他渠道。本工具链对此不做限制。
/to-featuresCONTEXT.md与spec-kit / BMAD / GSD的对比可查看REFERENCE.md。
Where to enter the chain
工作流入口选择
Don't always start at stage 1 — jump to where the chain actually breaks.
| Entry signal | Start at |
|---|---|
Fresh repo, no | 0 |
| Vocabulary fights, fuzzy terms, no glossary yet | 1 |
| Domain understood, features not yet enumerated | 2 |
| Feature picked, no PRD yet for this one | 3 |
| PRD exists but is one mega-issue | 4 |
Picked a | 5 |
| 6 |
| External issue filed by a user, needs classification | (parallel: |
无需总是从第1阶段开始——直接跳转到工作流的缺失环节即可。
| 触发信号 | 起始阶段 |
|---|---|
全新仓库,尚无 | 0 |
| 存在术语歧义、模糊表述,尚无术语表 | 1 |
| 已理解业务领域,尚未枚举功能 | 2 |
| 已选定功能,尚未为此功能编写PRD | 3 |
| 已有PRD,但仅对应一个大型需求 | 4 |
已选定 | 5 |
| 6 |
| 用户提交外部需求,需要分类处理 | (并行环节: |
When is it done?
完成标准
The mirror image of "Where to enter the chain" — four levels of "done", four signals:
| Level | Done when | Recorded in |
|---|---|---|
| Phase | TDD cycle green + logged | |
| Issue | All phases ticked, PR merged | tracker status (closed/merged) |
| Feature | All issues from its PRD merged | |
| Project | (no native concept — judgment call) | — |
A feature's completion is mechanical: walk from the PRD to its child issues (via the parent reference writes), confirm all closed, then strike through the line:
/to-issuesFEATURES.md- [x] ~~user-can-reset-password~~ — ~~A user can reset...~~ (shipped: #42, #43, #44)Software projects rarely "complete" — features keep getting added. If you need a hard milestone, layer on your tracker's mechanism (, Linear cycles, release tags) and define "project complete" as that milestone closing. See REFERENCE.md for per-tracker completion queries.
gh milestone与“工作流入口选择”相对应——有四个层级的“完成”标准及对应信号:
| 层级 | 完成条件 | 记录位置 |
|---|---|---|
| 阶段 | TDD循环执行成功并记录 | |
| 需求 | 所有阶段均完成,PR已合并 | 跟踪系统状态(已关闭/已合并) |
| 功能 | 其PRD对应的所有需求均已合并 | |
| 项目 | (无原生定义——需自行判断) | — |
功能的完成状态是机械判定的:从PRD追溯到其子需求(通过写入的父引用),确认所有需求均已关闭,然后在中为对应行添加删除线:
/to-issuesFEATURES.md- [x] ~~user-can-reset-password~~ — ~~A user can reset...~~ (shipped: #42, #43, #44)软件项目很少真正“完成”——功能会持续新增。如果需要明确的里程碑,可借助跟踪系统的机制(、Linear周期、发布标签),将“项目完成”定义为该里程碑关闭。各跟踪系统的完成查询方式可查看REFERENCE.md。
gh milestoneStages 5-6: worktree + planning-with-files
第5-6阶段:worktree + planning-with-files
The skill is instructions-only — there are no scripts. The agent performs each step manually, adapting to the team's issue tracker.
该技能仅含指令——无脚本。Agent需手动执行每个步骤,以适配团队的需求跟踪系统。
Bootstrap
初始化
-
Pick the tracker. See Tracker selection below.
-
Fetch the issue per— extract title, body, labels, AGENT-BRIEF.
trackers/<name>.md -
Derive paths:
- slug = title → lowercase → non-alphanumerics replaced with → truncate to 40 chars
- - branch = (Linear's
issue-<id>-<slug>passes through literally)TEAM-123 - worktree =
../<repo>-issue-<id>/
- slug = title → lowercase → non-alphanumerics replaced with
-
Create the worktree:
git worktree add ../<repo>-issue-<id> -b issue-<id>-<slug> -
in and seed three planning files:
cdFile Contents task_plan.mdGoal = title; Phases = AC checkboxes. Structured fields only (hook re-injection risk). findings.mdRaw issue body + AGENT-BRIEF pasted verbatim. Safe sink for external content. progress.mdInitial session log entry with bootstrap timestamp. -
Invoketo refine seeds via interview (Stage 5). Sharpens phases, surfaces key questions, captures decisions to make.
/planning-with-files:plan -
Invoketo execute (Stage 6) — outer loop runs phases;
/planning-with-files:startis the inner loop for code-producing phases. During implementation, refer to/tddfor code quality — surgical changes, simplicity first, no speculative abstractions, surfaced assumptions./andrej-karpathy-skills:karpathy-guidelines
-
选择跟踪系统:详见下方跟踪系统选择。
-
获取需求:按照中的说明操作——提取标题、内容、标签、AGENT-BRIEF。
trackers/<name>.md -
生成路径:
- slug = 标题 → 转为小写 → 非字母数字字符替换为→ 截断至40字符
- - branch = (Linear的
issue-<id>-<slug>格式直接保留)TEAM-123 - worktree =
../<repo>-issue-<id>/
- slug = 标题 → 转为小写 → 非字母数字字符替换为
-
创建worktree:
git worktree add ../<repo>-issue-<id> -b issue-<id>-<slug> -
进入目录并生成三个规划文件:
文件 内容 task_plan.md目标=标题;阶段=验收标准复选框。仅包含结构化字段(避免提示注入风险)。 findings.md原需求内容+AGENT-BRIEF原文粘贴。作为外部内容的安全存储区。 progress.md初始会话日志条目,包含初始化时间戳。 -
调用:通过访谈优化初始文件(第5阶段)。细化阶段、梳理关键问题、记录待做决策。
/planning-with-files:plan -
调用:执行实现(第6阶段)——外层循环执行各阶段;
/planning-with-files:start是代码生成阶段的内层循环。实现过程中,参考/tdd保证代码质量——精准修改、优先简洁、避免过度抽象、明确假设。/andrej-karpathy-skills:karpathy-guidelines
Tracker selection
跟踪系统选择
Priority order:
- env var (explicit override)
$SWE_WORKFLOW_TRACKER - line in
tracker=<name>at the repo root.swe-workflow.conf - Auto-detect from project signals:
- directory →
.scratch/(mattpocock'slocal-markdownconvention).scratch/<feature>/ - github remote + installed →
ghgithub - gitlab remote + installed →
glabgitlab - directory →
.linear/linear - set →
$MULTICA_WORKSPACE_ID(no project-level signal — Multica config is user-level)multica
- Still ambiguous → ask the user.
Per-tracker fetch commands and conventions: . To add a new tracker, write a new doc following the same shape — nothing else changes.
trackers/<name>.md优先级顺序:
- ****环境变量(显式覆盖)
$SWE_WORKFLOW_TRACKER - 仓库根目录中的
.swe-workflow.conf行tracker=<name> - 根据项目信号自动检测:
- 存在目录 →
.scratch/(mattpocock的local-markdown约定).scratch/<feature>/ - GitHub远程仓库且已安装→
ghgithub - GitLab远程仓库且已安装→
glabgitlab - 存在目录 →
.linear/linear - 已设置→
$MULTICA_WORKSPACE_ID(无项目级信号——Multica配置为用户级)multica
- 存在
- 仍无法确定 → 询问用户。
各跟踪系统的获取命令及约定:。如需添加新跟踪系统,只需按照相同格式编写新文档——无需修改其他内容。
trackers/<name>.mdInner loop: /tdd
for code-producing phases
/tdd内层循环:代码生成阶段的/tdd
/tdd/planning-with-files:start/tddtask_plan.mdMark phase in_progress → /tdd (red → green → refactor) → log to progress.md → Mark phase completeNot every phase needs — exploration, config tweaks, and infra changes skip it. See REFERENCE.md for the full nuances (multiple cycles per phase, decision/error capture, when 's own planning step duplicates vs. complements the issue-level plan).
/tdd/tdd/planning-with-files:start/tddtask_plan.md标记阶段为in_progress → /tdd(红 → 绿 → 重构) → 记录到progress.md → 标记阶段为complete并非所有阶段都需要——探索、配置调整、基础设施变更可跳过。完整细节(每个阶段多轮循环、决策/错误记录、自身规划步骤与需求级规划的重复或互补场景)可查看REFERENCE.md。
/tdd/tddTeardown (after PR merges)
清理(PR合并后)
From the main checkout (NOT inside the worktree):
bash
undefined从主仓库目录(NOT worktree内部)执行:
bash
undefinedVerify no uncommitted changes
验证无未提交变更
git -C ../<repo>-issue-<id> status --porcelain
git -C ../<repo>-issue-<id> status --porcelain
Remove worktree
删除worktree
git worktree remove ../<repo>-issue-<id>
git worktree remove ../<repo>-issue-<id>
Delete branch only if merged into the default branch
仅当分支已合并到默认分支时删除
default_branch=$(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@')
git branch --merged "$default_branch"
| grep -qE "^[[:space:]]**?[[:space:]]*issue-<id>-<slug>$"
&& git branch -d "issue-<id>-<slug>"
| grep -qE "^[[:space:]]**?[[:space:]]*issue-<id>-<slug>$"
&& git branch -d "issue-<id>-<slug>"
undefineddefault_branch=$(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@')
git branch --merged "$default_branch"
| grep -qE "^[[:space:]]**?[[:space:]]*issue-<id>-<slug>$"
&& git branch -d "issue-<id>-<slug>"
| grep -qE "^[[:space:]]**?[[:space:]]*issue-<id>-<slug>$"
&& git branch -d "issue-<id>-<slug>"
undefinedCritical handoff rules
关键交接规则
- PRD uses the glossary from stage 1. If introduces terms that conflict with
to-prd, loop back toCONTEXT.md./grill-with-docs - Issues are tracer bullets, not horizontal layers. Each is a thin vertical slice (schema → API → UI → tests). "Backend issue" + "frontend issue" is a smell — re-slice.
- Only issues enter execution.
ready-for-agentauto-applies the label on chain-created issues;/to-issuesapplies it to external issues (user reports, etc.). Either way, stage 5 reads from the label, not the source./triage - One issue = one worktree = one . Filesystem isolation for parallel AFK agents. No exceptions.
task_plan.md - Strike through, don't delete. When a feature ships, strike it through in with a shipped reference — never delete. Preserves institutional memory; prevents quiet scope drift.
FEATURES.md
- PRD使用第1阶段的术语表。如果引入的术语与
to-prd冲突,需回到CONTEXT.md环节。/grill-with-docs - 需求是垂直切片,而非横向分层。每个需求都是薄的垂直切片( schema → API → UI → 测试)。“后端需求”+“前端需求”是不良实践——需重新拆分。
- 仅需求可进入执行阶段。
ready-for-agent会为工作流内创建的需求自动添加该标签;/to-issues会为外部需求(用户报告等)添加该标签。无论哪种情况,第5阶段均读取该标签,而非需求来源。/triage - 一个需求 = 一个worktree = 一个。通过文件系统隔离实现多Agent并行工作。无例外。
task_plan.md - 添加删除线,而非删除内容。功能交付后,在中为对应行添加删除线并标注交付引用——切勿删除。保留团队记忆;避免隐性范围偏差。
FEATURES.md
Don't double-track
避免重复跟踪
| Lives in… | Don't also put in… |
|---|---|
| PRD (immutable arch decisions) | |
| AGENT-BRIEF (durable contract) | |
| The issue (don't litter the spec with build noise) |
| A hand-written PR summary (the log IS the summary) |
| 存储位置… | 请勿同时存入… |
|---|---|
| PRD(不可变架构决策) | |
| AGENT-BRIEF(持久化约定) | |
| 需求(勿在规格文件中混入构建噪音) |
| 手写PR摘要(日志即为摘要) |
Security boundary
安全边界
planning-with-filestask_plan.mdtask_plan.md- Raw issue bodies, fetched docs, web content → only.
findings.md - gets only structured fields the executor wrote (Goal, Phases from AC, Decisions, Errors).
task_plan.md
The bootstrap procedure (Stages 5-6) enforces this split.
planning-with-filestask_plan.mdtask_plan.md- 原始需求内容、获取的文档、网页内容 → 仅存入。
findings.md - 仅包含执行者编写的结构化字段(目标、验收标准中的阶段、决策、错误)。
task_plan.md
初始化流程(第5-6阶段)强制遵循此划分规则。
When to skip this skill
何时跳过该技能
- Single-file edits (no spec, no plan needed)
- Bug fixes where the AGENT-BRIEF is one paragraph — just do it, skip stage 5 bootstrap
- Exploration / prototypes — use the skill instead
prototype
- 单文件编辑(无需规格、无需规划)
- AGENT-BRIEF仅为一段文字的bug修复——直接处理,跳过第5阶段初始化
- 探索/原型开发——使用技能替代
prototype
Further reading
延伸阅读
- REFERENCE.md — per-stage detail, HITL vs AFK execution, gotchas
- Source skills: ,
grill-with-docs,to-prd,to-issues(mattpocock/skills),triage(OthmanAdi/planning-with-files)planning-with-files
- REFERENCE.md — 各阶段细节、人机协作 vs 无人值守执行、常见问题
- 源技能:、
grill-with-docs、to-prd、to-issues(mattpocock/skills),triage(OthmanAdi/planning-with-files)planning-with-files