improve-loop
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseImprove Loop
Improve Loop
A non-interactive, autonomous-safe sibling of .
It does ONE deepening per invocation and is built to be called repeatedly by
or . Where the interactive skill asks "which to explore?" and runs ,
this skill auto-selects the safest candidate and defers every design decision.
/improve-codebase-architecture/goal/loop/grillingVocabulary is the deep-module language exactly: module, interface,
implementation, depth, seam, adapter, leverage, locality. Run that skill for the terms.
/codebase-design非交互式、自主安全的 同类 skill。
每次调用仅执行一次深化操作,专为由 或 重复调用而设计。交互式 skill 会询问“探索哪个目标?”并运行 ;此 skill 则自动选择最安全的候选项,并推迟所有设计决策。
/improve-codebase-architecture/goal/loop/grilling术语体系与 的 deep-module 语言完全一致:module、interface、implementation、depth、seam、adapter、leverage、locality。运行该 skill 查看这些术语。
/codebase-designHard safety invariants (never violate)
硬性安全不变量(绝不违反)
- Never ,
merge, or open a PR. Work only on an isolated branch viapush.wt - One candidate per invocation. Keep diffs reviewable.
- TDD or abort — with one exception. For new or changed behavior: write a failing test first, then make it pass; if you cannot make it red or reach green, revert and stop. Deletion exception: a behavior-preserving removal of dead code (proven by a no-callers search across the repo) is verified by the full suite staying green after you remove the code and its tests — not by a red-green cycle.
- Verify before acting. Re-read the real files to confirm every sub-agent claim before editing. (Past runs: claims were wrong as often as right.) A claim you can't confirm = skip.
- Edit code ONLY for Class-A. Class-B → a design doc, no code. Class-C → memory only.
- Commit discipline. Stage only files you touched this run; commit on the branch
(verify the branch by reading it with ; never
git rev-parse --abbrev-ref HEAD); nevermain; rungit commit -aand confirm it matches before committing.git diff --cached --name-only - Respect ADRs. A candidate that conflicts with an ADR is Class-B or C, never A.
- Dedup. Read the architecture-review backlog memory; skip completed candidates.
- No corner-cutting. Every artifact — HTML report, design doc, tests, the review
fan-out itself — meets its full spec; never substitute a lighter version for a specified
one (e.g. a one-line card list for a diagrammed report, or reused stale candidates for a
real review unless explicitly told the candidates are current). Short on budget → narrow the scope (fewer candidates / cycles) at full depth, never the full scope at reduced quality. If you cannot meet an artifact's spec, say so in the result block rather than shipping a degraded one silently.
Explore
- 绝不 、
merge或创建 PR。 仅通过push在隔离分支上工作。wt - 每次调用只处理一个候选项。 确保 diff 易于审查。
- TDD 或中止——仅有一个例外。 对于新增或变更的行为:先编写失败的测试,再让测试通过;如果无法先让测试变红或最终变绿,则回滚并停止。 删除例外: 对死代码进行保持行为的删除(必须通过全仓库无调用方搜索来证明)时,验证方式是移除代码及其测试后完整测试套件仍保持绿色,而不是执行红-绿循环。
- 行动前先验证。 编辑前重新读取真实文件,确认 sub-agent 的每项说法。(以往运行中,这些说法错误的次数与正确的次数一样多。)无法确认的说法 = 跳过。
- 仅可为 Class-A 编辑代码。 Class-B → 写设计文档,不写代码。Class-C → 仅写入 memory。
- 提交纪律。 仅暂存本次运行修改的文件;在分支上提交(通过读取 验证分支;绝不能是
git rev-parse --abbrev-ref HEAD);绝不使用main;运行git commit -a,确认结果与本次修改一致后再提交。git diff --cached --name-only - 尊重 ADR。 与 ADR 冲突的候选项归为 Class-B 或 C,绝不归为 A。
- 去重。 读取架构评审待办 memory;跳过已完成的候选项。
- 不得偷工减料。 每项产物——HTML 报告、设计文档、测试、评审 fan-out 本身——都必须完全满足其完整规范;绝不能以简化版本替代指定版本(例如,用一行卡片列表替代带图示的报告,或在未明确说明候选项为最新数据时,将过时的候选项复用于真正的 评审)。预算不足时,应以完整深度缩小范围(减少候选项或评审轮次),绝不能以降低质量覆盖全部范围。如果无法满足某项产物的规范,应在结果块中说明,而不是静默交付降级版本。
Explore
Pipeline (one pass)
流水线(单次执行)
-
Review. Run the review phase of(its parallel
/improve-codebase-architecturefan-out over the codebase). Skip the "which to explore?" question. HTML report (attended-mode): emit the candidate set as a self-contained HTML report to the OS temp dir, then — if a human invoked this run interactively —Exploreit and print its path. Headless (open//goal) runs write the file but do not open a browser; their result stays the printed/scheduleblock.IMPROVE-LOOP RESULTReport quality bar — non-negotiable, do NOT cut corners. The report MUST match the/improve-codebase-architecturescaffold exactly — Tailwind + Mermaid via CDN, editorial styling. EVERY candidate gets its ownHTML-REPORT.mdwith ALL of: (a) a before/after diagram as the centerpiece — Mermaid for graph-shaped relations, hand-built<article>/SVG for editorial visuals (mass diagram, call-graph collapse, cross-section); mix the patterns, don't make every card identical; (b) one-sentence Problem and one-sentence Solution; (c) Wins bullets in glossary terms; (d) a badge row: recommendation strength + autonomy class (A/B/C) + status (done / on-branch / pending); (e) an ADR or "why B" callout where relevant. End with a loop-view / top-recommendation section. A flat list of cards with one-line descriptions and no before/after diagram is the cut-corner failure mode and is NOT acceptable. If short on budget, cover fewer candidates at full depth — never all of them shallowly.div -
Verify claims. For each candidate, re-read the cited files. Apply the deletion test. Drop anything you can't confirm.
-
Classify by autonomy (rubric below): A / B / C.
-
Dedup against backlog memory; drop done candidates.
-
Act on the single highest-value Class-A candidate:
- ; reproduce whatever setup the worktree lacks (deps, generated artifacts) rather than falling back to working inline.
wt switch --create refactor/<slug> - Write a failing test through an existing interface (red). Implement (green).
- Run the full verify suite. Green → commit on the branch. Red you can't fix → revert the branch and stop.
-
If no Class-A: write a design doc for the top Class-B under(the friction in glossary terms, the design forks, and a recommended deepening). Do not edit code.
docs/architecture/<slug>.md -
Record what happened to the backlog memory (so the next pass dedups it).
-
Print the result block (below) so theevaluator can judge from the transcript.
/goal
-
评审。 运行的评审阶段(对代码库执行并行
/improve-codebase-architecturefan-out)。跳过“探索哪个目标?”这个问题。 HTML 报告(attended-mode): 将候选项集合作为自包含 HTML 报告输出到操作系统临时目录;然后——如果本次运行由人类交互触发——使用Explore打开并打印其路径。无头(open//goal)运行只写入文件,但不打开浏览器;结果保留为打印出的/schedule块。IMPROVE-LOOP RESULT报告质量标准——不可妥协,绝不偷工减料。 报告必须与的/improve-codebase-architecture脚手架完全一致——通过 CDN 使用 Tailwind + Mermaid,并采用编辑风格。每个候选项都必须拥有自己的HTML-REPORT.md,且包含以下全部内容: (a) 以前后对比图为核心——图形关系使用 Mermaid,编辑型视觉(mass diagram、call-graph collapse、cross-section)则手工构建<article>/SVG;应混合不同模式,不要让每张卡片都完全相同; (b) 一句话的 Problem 和一句话的 Solution; (c) 使用术语表词汇的 Wins 项目符号; (d) 一行徽章:推荐强度 + 自主性类别(A/B/C) + 状态(done / on-branch / pending); (e) 相关时提供 ADR 或“为何为 B”的提示框。 最后加入 loop-view / 首选推荐部分。 只有一行描述、没有前后对比图的扁平卡片列表属于偷工减料,不可接受。预算不足时,应以完整深度覆盖更少候选项——绝不能让所有候选项都流于浅层。div -
验证说法。 对每个候选项,重新读取所引用的文件。应用删除测试。丢弃任何无法确认的候选项。
-
按自主性分类(规则见下文):A / B / C。
-
与待办 memory 去重;丢弃已完成的候选项。
-
处理价值最高的单个 Class-A 候选项:
- ;补齐 worktree 缺失的任何设置(依赖、生成产物),而不是改为在当前检出目录中直接工作。
wt switch --create refactor/<slug> - 通过现有 interface 编写失败测试(红)。实现(绿)。
- 运行完整验证套件。绿色 → 在分支上提交。红色且无法修复 → 回滚分支并停止。
-
如果没有 Class-A: 为最高价值的 Class-B 编写设计文档,路径为(使用术语表词汇描述摩擦点、设计分支和推荐的深化方案)。不要编辑代码。
docs/architecture/<slug>.md -
记录本次处理结果到待办 memory,供下一轮去重。
-
打印结果块(见下文),以便评估器根据转录文本进行判断。
/goal
Autonomy classification
自主性分类
Class A — auto-implement. ALL of:
- Deletion test is a clear vanish (dead code / pure dedup), or a behavior-preserving extraction of existing inline logic into a pure function whose inputs are already fixed by the call site.
- No new interface/seam shape to design — you relocate, dedup, or delete; you don't decide what an interface should look like.
- Local (≲3 files), reversible, testable through an existing interface.
- Touches no ADR.
- Borderline → treat as B. When unsure, do NOT auto-edit.
Class B — design doc, skip code. Any of: needs an interface or state-emission decision;
more than one reasonable design; reopens/touches an ADR; cross-module seam.
Class C — log only. Speculative, value unclear, or ADR-conflicting without strong reason.
Class A — 自动实现。 必须满足全部条件:
- 删除测试的结果明确为 vanish(死代码或纯粹去重),或者是将现有内联逻辑行为保持地提取为纯函数,其输入已由调用点固定。
- 无需设计新的 interface/seam 形态——只做迁移、去重或删除;不决定 interface 应是什么样。
- 局部(≲3 个文件)、可逆、可通过现有 interface 测试。
- 不涉及 ADR。
- 临界情况 → 按 B 处理。 不确定时,绝不自动编辑。
Class B — 设计文档,跳过代码。 出现以下任一情况:需要决定 interface 或状态输出方式;存在多个合理设计;重新讨论或触及 ADR;跨 module seam。
Class C — 仅记录。 推测性的、价值不明确,或在没有充分理由的情况下与 ADR 冲突。
Output contract (required, last lines of every run)
输出契约(必需,每次运行的最后几行)
IMPROVE-LOOP RESULT
- did: <slug> on branch refactor/<slug> | design-doc docs/architecture/<slug>.md | none
- suite: <pass>/<total> green | reverted (could not reach green)
- remaining auto-safe (A) candidates: <comma list, or "none">/goal/goalremaining auto-safe (A) candidates: noneIMPROVE-LOOP RESULT
- did: <slug> on branch refactor/<slug> | design-doc docs/architecture/<slug>.md | none
- suite: <pass>/<total> green | reverted (could not reach green)
- remaining auto-safe (A) candidates: <comma list, or "none">/goal/goalremaining auto-safe (A) candidates: noneUsage
用法
Attended, in-session:
/goal Repeatedly run the improve-loop skill. Each cycle implement the single highest-value
auto-safe deepening test-first on its own wt branch and PRINT the IMPROVE-LOOP RESULT block.
Never merge, push, or open a PR; design-heavy candidates get a doc and are skipped. Revert and
stop if a cycle can't reach green. Met when a cycle prints "remaining auto-safe (A) candidates:
none", or after 5 cycles.Unattended weekly (recommended — produces review-ready branches you merge yourself):
/schedule weekly claude -p "/goal <the condition above>"Mode default is propose-safe: auto-implement Class-A to branches (never merged),
design-doc Class-B, log Class-C. For propose-only (no code at all), tell the loop to
treat every candidate as Class-B and emit only design docs.
Composes with: (vocabulary), (red-green), /
(isolation), (only when a human later picks up a Class-B doc).
codebase-designtddworktrunkwtgrilling有人值守的会话内运行:
/goal Repeatedly run the improve-loop skill. Each cycle implement the single highest-value
auto-safe deepening test-first on its own wt branch and PRINT the IMPROVE-LOOP RESULT block.
Never merge, push, or open a PR; design-heavy candidates get a doc and are skipped. Revert and
stop if a cycle can't reach green. Met when a cycle prints "remaining auto-safe (A) candidates:
none", or after 5 cycles.无人值守的每周运行(推荐——生成可供审查的分支,由你自行合并):
/schedule weekly claude -p "/goal <the condition above>"默认模式是 propose-safe:自动将 Class-A 实现到分支上(绝不合并),为 Class-B 生成设计文档,仅记录 Class-C。若采用 propose-only(完全不写代码),则让循环将每个候选项视为 Class-B,并且只输出设计文档。
与以下 skill 组合使用:(术语体系)、(红-绿)、/(隔离)、(仅当人类后续接手 Class-B 设计文档时)。
codebase-designtddworktrunkwtgrilling