Install
openclaw skills install @jingzhao-l/iterate-skill-slimtestFully automated multi-round code iteration with configurable N-dimension parallel review, onboarding/personalization, and a cross-assistant installer/update system with mandatory SHA256 checksum verification. v3.0 adds a dual-mode (the original iterate mode plus a defensive-programming mode via /iterate defensive) that performs normal incremental coding tasks with defensive discipline end-to-end.
openclaw skills install @jingzhao-l/iterate-skill-slimtest<goal> [rounds] [no-limit]<goal>(防御式编程模式 / Defensive-Programming Mode)面向人类读者:本文件是供 AI 助手消费的 Skill 指令。若您是开发者或浏览者,欢迎前往 GitHub 仓库 jingzhao-l/iterate-skill 阅读 README,详细了解本 Skill 及其附属生态(iterate-harness、iterate-plugin、CLI 等)。
For human readers (English): This file is a Skill manifest consumed by AI assistants. If you are a developer or a human visitor, welcome to the GitHub repository jingzhao-l/iterate-skill — read the README to learn more about this Skill and its ecosystem (iterate-harness, iterate-plugin, CLI, etc.).
中文:全自动多轮代码迭代。每轮从 N 个已启用维度并行审查整个项目(默认 9 个),原子问题直接修复,架构问题经用户批准后由子代理串行执行,验证通过后(合并与推送为 opt-in,默认关闭)循环直到零 findings 或达到轮数上限。
English: Fully automated multi-round code iteration. Each round launches N parallel dimension reviewers across the project (default 9), fixes atomic issues directly, executes architectural issues after user approval via serial sub-agents, validates, and loops until zero findings or max rounds (merge/push are opt-in and disabled by default).
v3.0 双模式 / v3.0 dual-mode:本 Skill 现为双模式——
/iterate,默认,v2 全部能力完整保留):审查 → 修复 → 验证 → 收敛闭环。/iterate defensive):面向用户让 AI 做正常增量式编程任务的场景(新增功能、修 bug、重构等),宿主 AI 从动手前到收尾从头至尾贯彻防御式编程理念(四步协议:pre-check → 最小步进编码 → 每步 post-check → invariant + iterate 收敛门禁),以 iterate 闭环收尾作为交付门禁(不收敛不交付)。Defensive-Programming Mode (v3.0, via
/iterate defensive): for the scenario where the user asks the AI to do a normal incremental coding task (add a feature, fix a bug, refactor). The host AI performs that task end-to-end with defensive discipline — a four-step protocol:pre-checkbefore touching anything → minimal-step editing (validate at the trust boundary) →post-checkafter every edit →invariant+ the iterate convergence loop as a delivery gate (no convergence, no delivery).
iterate 模式适用于以下场景:
防御式编程模式(/iterate defensive)适用于用户让 AI 做正常增量式编程任务的场景:
/iterate defensive implement user-settings page、/iterate defensive fix the null-pointer bug in parser.py、/iterate defensive refactor auth to use a middleware。纯审查模式 / review-only mode:当调用参数含 review-only 或 dry-run 时,本 Skill 只做只读健康检查,绝不修改任何文件:
approved / needs_revision 判定的最终审查报告。meta-review 同时跑硬证据门禁:逐条校验 finding 的 file/line 是否真实存在,子代理只允许锚定实际读过的真实代码,伪造路径/行号即以 EVIDENCE_VIOLATION 判 needs_revision。This Skill is appropriate when:
Defensive-Programming Mode (/iterate defensive) applies when the user asks the AI to do a normal incremental coding task:
you are asked to implement a feature, fix a bug, refactor a module, integrate an API, or add tests —
and you must do that task end-to-end with defensive discipline (pre-check → minimal-step editing →
post-check after every edit → invariant + iterate convergence as a delivery gate).
review-only / dry-run mode applies when the invocation includes review-only or dry-run:
it performs a read-only health check that never modifies files — repeated parallel review rounds until a
round finds 0 new findings (convergence), produces a review report, then meta-reviews that report
(validating internal consistency) and emits a final report with an approved / needs_revision verdict.
The meta-review also runs the hard code-evidence gate: every finding's file/line is validated against
real files on disk, so reviewers may only anchor to code they actually read — fabricated paths or invented
line numbers surface as EVIDENCE_VIOLATION and force needs_revision.
Use it for pre-release health checks, audits, or any case where you do not want the AI to touch code.
iterate 模式不适用于以下场景:
/iterate defensive(正是为"让 AI 做正常增量式编程任务"而设)。validation.commands 未配置)——防御式模式下 guard post-check / invariant 会依赖验证命令,缺失时校验退化。自 v3.0.1 起:若项目已 onboarded(存在非空 iterate.config.yaml)但 validation.commands 为空,guard pre-check 将 fail-closed(退出码 1、PASS/FAIL 为 FAIL)——因为它承诺的 post-check 必然失败,不应给出"可以开工"的绿灯;宿主 AI 收到 FAIL 应先补配置 validation.commands。全新项目(尚无配置)则正常降级放行。Do not use this Skill in iterate mode when:
/iterate defensive instead (that is exactly the incremental-coding-task scenario it serves).validation.commands. Since v3.0.1: for an onboarded project (a non-empty iterate.config.yaml exists) with empty validation.commands, guard pre-check fails closed (exit code 1) instead of handing out a misleading "clear to start" green light — configure validation.commands first. A brand-new project with no config yet still degrades gracefully (pass).调用格式 / Invocation:
/iterate <goal> [rounds] [no-limit]/iterate defensive <goal>(v3.0 新增;可用 iterate.config.yaml 的 mode: defensive 设为本次调用默认,仍可用显式 defensive 覆盖)参数通过 Agent Skills 标准占位符注入:
| 占位符 / Placeholder | 含义 / Meaning | 默认值 / Default |
|---|---|---|
$goal / $0 | 迭代目标 / Iteration goal | required |
$rounds / $1 | 最大轮数 / Max rounds | 7 |
$limit_mode / $2 | 若设为 no-limit,则最大轮数为 50(硬上限)/ Set to no-limit for hard cap 50 | — |
$mode / $3 | review-only / dry-run → 纯审查模式(反复审查直到零 findings,绝不修改文件);defensive → 防御式编程模式(按四步协议从头至尾完成增量式编程任务,iterate 闭环收尾作为交付门禁)/ review-only/dry-run → pure-review mode (never touches files); defensive → defensive-programming mode (four-step protocol on an incremental coding task, iterate loop as delivery gate) | 默认迭代模式 |
$ARGUMENTS | 用户输入的全部参数原样字符串 / Raw argument string | — |
示例 / Examples:
/iterate improve error handling/iterate improve error handling 10/iterate improve error handling no-limit/iterate review the codebase review-only(纯审查模式:只审查不改代码,反复审查到零 findings,出审查报告,再审查报告给出最终审查报告)/iterate full health check --review-only(同上,纯审查别名)/iterate defensive implement user-settings page(防御式编程模式:让 AI 正常写代码实现功能,从头至尾防御式纪律 + 收尾门禁)/iterate defensive fix the null-pointer bug in parser.py/iterate defensive: refactor auth to middleware本节仅描述防御式编程模式(
/iterate defensive)的行为。iterate 模式(/iterate)行为与 v2 完全一致,零回归。适用场景:用户让 AI 做正常增量式编程任务(新增功能、修 bug、重构、接入 API、补测试)——动手改代码、产出真实可运行结果,而非纯审查。宿主 AI 从动手前到收尾从头至尾贯彻防御式编程理念,以 iterate 闭环收尾作为交付门禁。
防御式编程是编码时的心智模型(软件工程经典定义),不是"审查-修复-收敛"流程;iterate 本身就是防御式编程的一种实现(审查环节的防御),本模式把整套心智模型前移到编码过程本身:
| 阶段 / Phase | 防御式原则 / Principle | 落地动作 / Action |
|---|---|---|
| ① 动手前 / Before | 最小化假设 + 前置条件 | 声明"我假设什么成立"(目标范围、文件存在、git 干净、依赖就绪);跑 iterate guard pre-check <paths...> 做确定性前置校验;FAIL 则先处理(恢复干净起点)再动手,绝不带病开工 |
| ② 动手时 / During | 信任边界验证 + 最小步进 | 每次只做最小步进修改;写入前验证目标路径在允许范围、命令在 validation.commands 精确白名单内;对外部输入在进入代码的边界处加校验;保持修改原子性(可回滚) |
| ③ 动手后 / After | fail-fast + 后置条件 | 每次改动后跑 iterate guard post-check [module...](精确执行配置的验证命令);FAIL 则立即修复或回滚,记录假设是否被证伪;不通过不进入下一步 |
| ④ 收尾 / Delivery | 不变量守护 + 收敛门禁 | iterate invariant 检查项目级不变量(invariants.ensure 文件断言 + invariants.commands);随后跑 9 维度审查 → 修复 → 验证 → 收敛(即 v2 完整 iterate 闭环)作为交付门禁——不收敛不交付 |
防御式理念必须靠 CLI 确定性校验落地(prompt 指令不可靠)。宿主 AI 在防御式模式下按下表调用:
| 命令 / Command | 时机 / When | 输出 / Output | 契约 / Contract |
|---|---|---|---|
iterate guard pre-check [paths...] | 动手前 | PASS/FAIL + 逐项结果 | 目标存在、git 干净、依赖 manifest 就绪、验证命令配置安全、每个验证命令对应的可执行工具在 PATH 上(shell 内建除外);退出码 0 = 可以开工,1 = 禁止开工 |
iterate guard post-check [module...] | 每次改动后 | PASS/FAIL + 逐项结果 | 精确执行 validation.commands.<module>(运行时唯一权威白名单);退出码 0 = 本次改动安全,1 = 必须先修复或回滚 |
iterate invariant | 收尾交付前 | PASS/FAIL + 违反项明细 | 校验 invariants.ensure 文件断言 + invariants.commands;ensure 只接受项目根目录内的相对路径(拒绝绝对路径与越出项目根的 ../ 逃逸);无 invariants 段时退化为 validation.commands;退出码 0 = 不变量成立,1 = 存在违反项 |
iterate invariant 不通过,不得交付,必须继续修复直到收敛。guard / invariant 结果)、残留风险与豁免。若某项不变量被有意豁免,在交付总结中列明违反项与豁免理由(仅作为报告小节记录,不写入配置——配置里不存在豁免键,schema 拒绝未知字段)。满足以下全部条件:
原子问题不进入用户审批流程,由主模型直接修复。
An issue is atomic when all of the following are true:
Atomic issues are fixed directly by the main model without user approval.
满足以下任一条件:
架构问题必须经用户批准后才能执行,由子代理串行完成。
An issue is architectural when any of the following is true:
Architectural issues require user approval and are executed by sub-agents serially.
关键原则 / Key Principle:原子问题和架构问题同样重要,都必须修复。区别仅在于是否需要用户批准以及由谁执行。
本节描述 iterate 模式(
/iterate)的完整闭环,与 v2 完全一致。 防御式编程模式(/iterate defensive)的执行请见上文「防御式编程模式」一节:其收尾阶段(第 ④ 步)即复用本节完整 iterate 闭环作为交付门禁,其余各步(① 动手前 / ② 动手时 / ③ 动手后)在编码过程中注入防御式纪律。
Step 0 — Onboarding Check
└─ Locate project root → check ITERATE.md → drift detection → (onboard if needed)
Setup
└─ Extract goal → load config → read project context (ITERATE.md → CLAUDE.md → …) → create isolated branch/worktree
Loop (round = 1 .. max_rounds)
├─ Phase 0: Dimension Planning (route goal → dimension_sets | ad-hoc redefine, bounded record)
├─ Phase 1: N-dimension parallel review (N = enabled dimensions count, default 9)
├─ Phase 2: Atomic fixes (direct)
├─ Phase 3: Architectural fixes (approval → serial sub-agents)
├─ Phase 4: Record round results
└─ Phase 5: Validate → merge → push
Summary
每次调用 /iterate 时,首先执行 onboarding 检查。Onboarding 是为当前项目生成定制化知识库(ITERATE.md)和项目级配置(iterate.config.yaml 中的 onboarding 段)的过程。
ui-ux 维度,无 specs/ 的项目不需要 spec-compliance——onboarding 避免空转浪费算力。ITERATE.md 记录项目概述、技术栈、模块地图、审查注意点,供后续每轮审查参考。定位项目根目录 / Locate project root
ITERATE.md 或 iterate.config.yaml 的目录 > 包含 .git 的目录。ITERATE.md / iterate.config.yaml 的目录为准;若无明确唯一候选,用 AskUserQuestion 让用户确认审查范围,避免误审到无关子项目。检查 onboarding 状态 / Check onboarding status
ITERATE.md。