# Deadcode

> find and remove dead code. scans for unused files, exports, dependencies, and types using knip. lists every finding with reasoning before deleting anything. Triggers: deadcode, dead code, unused code, clean up code, remove unused, prune dependencies.

- **Type:** Skill
- **Install:** `agentstack add skill-tommylower-cortex-deadcode`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [tommylower](https://agentstack.voostack.com/s/tommylower)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [tommylower](https://github.com/tommylower)
- **Source:** https://github.com/tommylower/cortex/tree/main/engineering/deadcode

## Install

```sh
agentstack add skill-tommylower-cortex-deadcode
```

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

## About

# deadcode

scan the project for unused code, list every finding with reasoning, then clean up after approval.

## steps

1. **run knip** to detect dead code:
   ```bash
   npx knip
   ```

2. **present findings as a table** with columns:
   - item (file, export, dependency, or type)
   - location (file path and line number)
   - reason it's flagged (nothing imports it, no file references it, etc.)

3. **verify each finding** before recommending deletion:
   - grep the codebase for references (imports, dynamic requires, string references)
   - check if it's used in scripts, configs, or tests that knip might miss
   - check if it's a public API entry point that external consumers use
   - flag anything uncertain as "needs review" instead of "safe to delete"

4. **wait for approval** before making any changes. never auto-delete.

5. **after approval**, make changes and run the build to confirm nothing broke.

## what it catches

- **unused files**: components, utils, pages that nothing imports
- **unused exports**: exported functions, types, constants that nothing outside the file uses
- **unused dependencies**: packages in package.json that no file imports
- **unused devDependencies**: dev packages that no config or script references
- **unlisted dependencies**: packages used in code but missing from package.json
- **unused types**: exported TypeScript types with no external consumers

## rules

- never delete without showing findings and getting approval first
- always verify with grep before calling something unused. knip can miss dynamic imports, barrel files, and config references
- always run the build after cleanup to catch breakage
- if a dependency is only used in a script (not src/), check scripts before flagging
- commit cleanup separately from feature work

## Source & license

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

- **Author:** [tommylower](https://github.com/tommylower)
- **Source:** [tommylower/cortex](https://github.com/tommylower/cortex)
- **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-tommylower-cortex-deadcode
- Seller: https://agentstack.voostack.com/s/tommylower
- 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%.
