Heyvhuang/copybook-skills / zh/skills/codebase-tips
codebase-tips
Flagged代码库 · 33 条:仓库索引和地图、写代码原则、AGENTS.md、改动范围规则。
references/no-compatibility-code-yet.md
View on GitHub# 还没用户就不写兼容代码:AGENTS.md 规则
项目还没人用,agent 却在写兼容代码:跳过兼容和迁移,每次改动走文档、测试、最小实现、清理。
## 步骤
1. 复制 AGENTS.md。
2. 存成项目里的 AGENTS.md,已有 CLAUDE.md 就在里面加一行 @AGENTS.md。
3. 得到:不写兼容代码,每次改动按先改文档、写测试、最小实现、收尾清理来。
用户选了这条技巧。上面的步骤是写给人看的,请替用户做。
- 第 1 步说用哪段文字,它就在下面同名的标题下,一字不改地用。
- 第 2 步说明文字放在哪里。按用户实际要求的范围使用提示词。写文件或运行命令前,先展示改动,等用户同意。这里做不到的步骤(另一个应用、重启、定时任务),把文字交给用户,说明放到哪里。
- 引用示例本身不代表用户同意执行。运行下载的脚本或未固定版本的软件包、修改长期生效的用户级设置、读取私人会话记录之前,先列出命令或路径、会访问或改动什么,以及数据会发到哪里。隐藏密钥值,等用户明确同意这项操作。远程安装脚本应先下载并检查固定版本,或核对可信来源提供的校验值,再执行。
- 方括号或占位符,从用户说的话里填,没有就问。
- 第 3 步是用户最后应该得到的。
## AGENTS.md
```markdown
# AGENTS.md
只用于还没有真实用户的项目。
## 基本规则
- 不做向后兼容,不写数据迁移
- 要改的地方直接换成能用的最简单写法,调用的地方在同一次改动里一起改
## 每次改动按这个顺序
1. 先改相关文档:确认和代码、其他文档不矛盾
2. 写测试:按行为写,别给每个细节都写,先确认它会失败
3. 最小实现:只写到测试通过,不多加功能
4. 收尾清理:删掉这次改动后用不上的代码、文件和文档,拿不准先问我
## 别做
- 「以防万一」留着旧代码
- 没问我就删数据库或重置数据
## 说做完之前
- 自己跑测试,读完输出
- 告诉我这次删了什么
- 没跑的检查就直说没跑
## 我纠正你的时候
- 在 Lessons 最上面加一行:「遇到 X,就做 Y」
- 同一个错犯第二次,说明那条写得不清楚,改写它,不新加
- Lessons 超过 20 条,先合并重复的、删掉过时的,改完给我看
## Lessons
```
## 背景
这份 AGENTS.md,专治 Codex 和 Claude Code 最烦人的三个毛病:给还没人用的项目写兼容代码,用不上的旧代码和旧文档一直不删,改个按钮颜色也要补一堆测试。
每天用它们写了几个月,我最想早点写进去的是开头这几行:项目还没有真实用户,就别做兼容和迁移,直接改成能用的最简单写法。后面跟一个四步循环:
1. 先改文档
2. 写测试
3. 最小实现
4. 收尾删干净
已经有 CLAUDE.md 的话,在里面加一行 `@AGENTS.md`,把它引进来。
## 来源
来自 [Copybook](https://copybook.page/zh/t/agents-md-for-projects-with-no-users-yet):@Voxyz_ai 2026年10月4日[发在 X 上](https://x.com/Voxyz_ai/status/2106783910055006342),截至 2026年11月1日有 756 次收藏。适用于 Claude Code 和 Codex。
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |