No dead code
8 battle-tested discipline skills that stop your AI coding agent from confidently shipping broken code — each with a verifiable done-criterion. Bilingual EN/中文.
npx -y skills add yli769227-jpg/agent-discipline --skill no-dead-codeAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Never assume dead code (cross-agent safety). Before deleting any symbol (function/class/variable/file), grep every caller. After adding a file, update the project manifest. When multiple agents edit in parallel, re-read the latest file before editing — don't trust a cached copy. Triggers when about to delete a symbol, add a source file, or edit a file that may be concurrently modified. 不假设 Dead Code:删任何符号前先 grep 所有调用方;新增文件后更新清单;多 agent 并行时编辑前先读最新文件;看到"像是没用"的符号先 grep 再说。 消歧:多文件接口改造的逐文件 build 节奏归 incremental-build,本 skill 只管"删/改符号前证明安全"。
SKILL.md
2.5 KB, as published. Nobody here has run it
Never Assume Dead Code / 不假设 Dead Code
"Nobody uses this" is a hypothesis, not a fact. Grep proves it; memory doesn't. "没人用这个"是假设不是事实。grep 能证明,记忆不能。
The discipline / 纪律
- Before deleting a function/variable, grep all callers across the repo. 删除函数/变量前,grep 所有调用方。
- After adding a file to the project, update the manifest (
package.json,go.mod, exports index, etc.). 新增文件后,更新项目清单(package.json、go.mod、导出索引等)。 - With agents working in parallel, re-read the latest file before editing — never rely on a cached view. 多 agent 并行时,编辑前重新读最新文件——绝不依赖缓存视图。
When this triggers / 触发时机
- About to delete a function / class / variable / file.
- About to add a source file / module.
- About to edit a file that another agent may be modifying concurrently.
- You spot a symbol that "looks unused".
Done criterion (verifiable) / 完成判据(可验证)
✅ Before the deletion, you ran a repo-wide grep for the symbol and it returned zero live callers (and you can show the search). New files are registered in the manifest. For a possibly-concurrent edit, there's a fresh Read of the file in this turn right before the edit. ⚠️ Grep found callers — those are not dead; handle them or stop. ❌ You deleted on the assumption it was unused, without searching. Restore and grep first.
Worked examples / 实战反例
Real before/after cases for this discipline live in EXAMPLES.md — read them before you act. 本纪律的真实 before/after 反例见 EXAMPLES.md —— 动手前先对照。