plan-before-code
Skill2 starsChanged 50 days agoMITView on GitHub
动手写代码前触发:先把实现方案写成计划(目标/步骤/风险/验证)给用户确认;小任务压缩成三句话。Keywords: plan, 计划
4 other projects use a version of this.
Adopted by
Most recently taken up by
- milad-raeisi/senior-skillstheir own version, first seen Nov 22, 2026
- youcisla/Agent-Foundrytheir own version, first seen Nov 16, 2026
- Diligence-AI/org-skillstheir own version, first seen Oct 13, 2026
- aprameyak/coding-skillstheir own version, first seen Oct 2, 2026
Other versions4 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 4
- milad-raeisi/senior-skills★ 4same name
- aprameyak/coding-skills★ 2same name
- youcisla/Agent-Foundry★ 1same name
- Diligence-AI/org-skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository8 other files it gives its agents.
- clarify-firstSkill
- debug-like-detectiveSkill
- refactor-small-stepsSkill
- retrospectiveSkill
- review-five-axesSkill
- tdd-red-greenSkill
- using-agent-craftSkill
- write-chinese-docsSkill
The file
Files
这是什么
一句话:动手写代码之前,先把"打算怎么做"写下来,给用户看一眼。
AI 最常见的翻车现场:用户说"加个功能",AI 吭哧吭哧写了 300 行,方向错了,全白写。不是代码写得烂,是方向一开始就没对齐。
这个 skill 规定的动作很简单:写代码之前,先写计划。计划不需要长,但必须回答四个问题:做什么、怎么做、有啥风险、怎么验证。用户点头了,再动手。
何时用
- 任务预计超过 30 行代码改动
- 要动多个文件,或者要新建模块
- 涉及技术选型(用哪个库、走哪种方案)
- 用户说"帮我实现 XX 功能",你心里没有现成答案
- 你自己对怎么做心里没底——没底就更要写下来
工作流
第一步:先读代码,再写计划
不读代码就写计划,等于闭眼开车。先做这三件事:
- 找到相关的现有代码,读一遍。搞清楚现在是怎么实现的。
- 找到类似功能的实现(项目里大概率有),看看惯例。
- 确认依赖:要用的库项目里有没有?版本对不对?
读完之后,你对"现状"有把握了,才有资格写"方案"。
第二步:写计划,固定格式
计划用下面这个格式,一项都不能少:
目标(一句话)
例:给 todo-app 的任务列表加一个"导出 CSV"按钮。
步骤(编号,每步说清楚改哪个文件、加什么)
- 在
frontend/src/components/TaskList.tsx加导出按钮,放在工具栏右侧。- 后端
app/routers/export.py新增/export/csv接口,复用现有的任务查询逻辑。- 前端调用接口,用 Blob 下载文件,文件名带日期。
注意:每一步都要具体到文件和函数名。写"后端加个接口"等于没写。
风险点(至少想 1 个,诚实写)
- 数据量上万条时,一次性拼字符串可能内存爆炸 → 用流式写入。
- CSV 里如果有逗号和换行,要按 RFC 4180 转义,不然 Excel 打开会串列。
想不出风险点?那就说明你还没想清楚,回去想。风险点是计划里最值钱的部分。
验证方法(怎么证明做对了)
- 点导出按钮,文件能下载,行数和页面显示一致。
- 用 Excel 打开,中文不乱码,逗号字段没串列。
- 跑一遍现有测试,没挂。
第三步:小任务压缩成三句话
改动不超过 30 行的小任务,不用写完整计划,但三句话不能少:
- 做什么(一句话)
- 怎么改(改哪个文件、加什么)
- 怎么验(跑什么、点哪里)
"怎么验"不许省略。小任务翻车,十次有九次是没想清楚怎么验。
第四步:发给用户确认
把计划贴给用户,等他说"可以"再动手。
用户改方向?改计划,不直接改代码。计划是方向盘,代码是油门,方向没对齐就踩油门,越快错得越远。
用户说"不用计划,直接写"?可以,但你要把计划压缩成三句话发出来。不是不信任用户,是给自己留个检查点。
第五步:动手时严格按计划走
做到一半发现计划有问题:停下来,更新计划,重新确认,再继续。
不许"顺手"扩大范围。"顺手把旁边的函数也重构了"是返工和 bug 的最大来源。想做的别的东西,记下来,做完再说。
第六步:做完对照计划打勾
逐项打勾。计划里有没做的,标出来,说原因。是用户中途砍了,还是你忘了?诚实写下来。
示例
用户:"给任务列表页加个导出 CSV 按钮。"
AI(错误示范):直接开始写代码,写完发现用户要的是定时自动导出,不是手动按钮。
AI(正确示范):
AI:"计划如下:
目标:任务列表页加手动"导出 CSV"按钮。
步骤:
- 前端
TaskList.tsx工具栏加按钮。 - 后端新增
/export/csv接口,复用任务查询。 - 前端 Blob 下载,文件名
tasks-2026-10-12.csv。
风险点:
- 上万条数据时内存问题 → 后端流式写入。
- CSV 转义 → 按 RFC 4180 处理逗号和换行。
验证:点按钮下载,行数对得上,Excel 打开不乱码。
确认吗?另外问一句:你要的是手动点按钮导出,还是定时自动发邮件?"
用户:"手动就行。" AI:"好,开工。"
边界
- 计划不是论文:超过一屏就是写嗨了,砍。计划是用来对齐方向的,不是用来展示你想得多全面的。
- 不替用户决定产品方向:计划里只写"怎么做",不写"做什么"——"做什么"是 clarify-first 的事。
- 计划里不许出现裸奔的"大概""可能":每个不确定后面必须跟验证方法。"可能内存爆炸"后面必须跟"用 10 万条数据压测验证"。
- 和 clarify-first 的分工:需求不清楚时,先走 clarify-first 把需求问清楚,再走这个 skill 写计划。顺序别反。
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

