# No Dead Code

> >-

- **Type:** Skill
- **Install:** `agentstack add skill-yli769227-jpg-agent-discipline-no-dead-code`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [yli769227-jpg](https://agentstack.voostack.com/s/yli769227-jpg)
- **Installs:** 0
- **Category:** [AI & ML](https://agentstack.voostack.com/c/ai-and-ml)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [yli769227-jpg](https://github.com/yli769227-jpg)
- **Source:** https://github.com/yli769227-jpg/agent-discipline/tree/main/skills/no-dead-code

## Install

```sh
agentstack add skill-yli769227-jpg-agent-discipline-no-dead-code
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Never Assume Dead Code / 不假设 Dead Code

> "Nobody uses this" is a hypothesis, not a fact. Grep proves it; memory doesn't.
> "没人用这个"是假设不是事实。grep 能证明,记忆不能。

## The discipline / 纪律

1. Before deleting a function/variable, grep **all** callers across the repo.
   删除函数/变量前,grep **所有**调用方。
2. After adding a file to the project, update the manifest (`package.json`, `go.mod`, exports index, etc.).
   新增文件后,更新项目清单(`package.json`、`go.mod`、导出索引等)。
3. 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](./EXAMPLES.md) — read them before you act.
本纪律的真实 before/after 反例见 [EXAMPLES.md](./EXAMPLES.md) —— 动手前先对照。

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [yli769227-jpg](https://github.com/yli769227-jpg)
- **Source:** [yli769227-jpg/agent-discipline](https://github.com/yli769227-jpg/agent-discipline)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-yli769227-jpg-agent-discipline-no-dead-code
- Seller: https://agentstack.voostack.com/s/yli769227-jpg
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
