rewrite-plan
它能做什么
这个智能体会为重写代码制定详细的计划。它把工作拆分成更小的步骤,并明确每个部分由谁负责,从而确保改动既安全又便于审查。
适用场景
- ✓当你需要有条理地重写代码的某些部分时。
- ✓当你开始一个需要多个修改步骤的大型项目时。
- ✓为了确保代码改动安全,不会破坏项目时。
技能链接
https://github.com/nexu-io/open-design/blob/main/plugins/_official/atoms/rewrite-plan/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“为我网站的身份验证模块制定一份重写计划,并明确每个文件的职责归属。”
每周 5 个新技能,1 分钟读完。
工作原理
它会分析现有的代码和设计,制定一份路线图。路线图会列出任务、执行人以及相关风险,确保一切都按步骤逐一完成。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Rewrite plan
Spec §20.3 / §21.3.2: scenario 4 (design → deliverable production code) requires a contract-shaped rewrite plan before the agent starts editing files. The plan is the audit trail every subsequent stage references; without it the patch path slides into "refactor everything that looks wrong" and the build breaks in unreviewable ways.
Inputs
code/index.jsonfromcode-import.token-map/*.jsonfromtoken-map.- The active design system DESIGN.md (already in prompt).
- The user's tune intent (typically a short brief).
Output
project-cwd/
└── plan/
├── plan.md # human-readable narrative
├── ownership.json # { file: '...', layer: 'leaf' | 'shared' | 'route' | 'shell' }
├── steps.json # ordered { id, files[], rationale, risk: 'low' | 'medium' | 'high' }[]
└── meta.json # { generatedAt, atomDigest, tokenMapDigest }
steps.json is the input patch-edit reads one entry per
iteration. ownership.json is the source of truth for "which
files belong to a single component vs. shared infrastructure";
patch-edit refuses to touch a shell-tier file unless the
matching step has risk: 'high' and the user explicitly confirmed.
Convergence
The atom completes when plan.md is non-empty AND steps.json
contains at least one step.
Anti-patterns the prompt fragment forbids
- Plans that include "rewrite the whole component library" as a single step. Break into per-component steps.
- Plans that don't classify ownership.
- Plans that don't list a
build-teststep at the end.
Status
Implemented by the daemon runner in
apps/daemon/src/plugins/atoms/rewrite-plan.ts. It classifies ownership and
writes plan.md, steps.json, and ownership.json.
常见问题
为什么重写代码之前要先做计划?
有了计划,智能体就不会试图“一次性修好所有问题”,因为那样很可能会以难以理解的方式破坏项目。计划能确保改动可控、安全。
什么是“归属边界”(ownership boundaries)?
它规定了哪些代码属于某个特定组件,哪些是通用代码。这有助于理清分工,避免冲突。
如果某个步骤风险太高怎么办?
计划会标出高风险步骤。对于这些步骤,智能体在做任何改动之前都会请你明确确认,确保你知情并同意。
详情
作者的原始描述
Author a long-running multi-file rewrite plan that subsequent patch-edit + diff-review + build-test stages will execute, with explicit ownership boundaries and patch-safety guarantees.
repo: nexu-io/open-design
热度
- GitHub 星标
- 101k
- 排名
- #988
- 许可证
- Apache-2.0
- 更新时间
- 2026/10/15
评论
- …