Skip to content
Back to skills

Dead Code

ASecurity

Use when the user wants unused code found: 'find dead code', 'what can I delete', 'unused functions or exports', 'is X still used anywhere'. Not for what a diff affects (use codebase:impact) or risky frequently changed code (use codebase:hotspots).

  • 4 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 2, 2026
ai-agentsbashgit

Works with

  • cli
  • mcp

Security analysis

A100/100

Pro scans all 4 files and shows the line behind each finding

Scanned December 2, 2026

npx -y skills add jskswamy/skills --skill dead-code --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Dead Code?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Dead Code
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/jskswamy-dead-code/badge)](https://www.skillsdirectory.com/skills/jskswamy-dead-code)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: dead-code
description: "Use when the user wants unused code found: 'find dead code', 'what can I delete', 'unused functions or exports', 'is X still used anywhere'. Not for what a diff affects (use codebase:impact) or risky frequently changed code (use codebase:hotspots)."
argument-hint: "[<path>]"
metadata:
  short-description: "Find code nothing uses, with each candidate verified. [<path>]"
---

# Codebase Dead Code Skill

Find symbols nothing in the codebase uses, and verify each candidate before reporting it. Derived from the current code on every run; nothing is saved and nothing is deleted.

## Argument Parsing

| Argument | Type | Default | Description |
|----------|------|---------|-------------|
| `<path>` | string | whole repo | Restrict to symbols defined under this path. |

Examples:
```
/codebase:dead-code
/codebase:dead-code scripts/lib
```

## Execution Flow

## Codebase Transport

Prefer MCP first. If its tools are absent or the server is unreachable, automatically try the CLI without asking:

```bash
command -v codebase-memory-mcp
codebase-memory-mcp cli --json list_projects
```

Set `codebase_transport` to `mcp` or `cli`. All tool calls below use that transport. For CLI calls, pipe the same JSON arguments to `codebase-memory-mcp cli --json <tool>` via stdin; inspect `isError` and read the result from `content[]` text. Use each tool's `--help` for supported flags and output formats. Query and indexing errors are not transport failures: report them accurately, not as missing MCP. On a later MCP connection failure, retry through CLI. Preserve project selection, index settings, and consent rules; do not install anything automatically.

### Step 0: Check Availability

Resolve the transport above. If neither MCP nor CLI works, continue with source inspection only and label the whole answer as such.

### Step 0b: Check Index Freshness

Read `references/freshness.md` and follow it.

### Step 1: Resolve the Project

Call `list_projects` and match the project whose `root_path` equals `git rev-parse --show-toplevel` (or whose `name` equals that path with the leading `/` stripped and `/` replaced by `-`). Never match by directory basename. Strip or reject `'`, `"`, `\\`, and control characters from any argument before putting it in a Cypher string.

### Step 2: Find and Verify Candidates

Read `references/candidates.md` and follow it.

### Step 3: Present Results

Two lists: `likely dead` (symbol, `file:line`, kind, why it looks unused) and `unsure: <reason>` (with where the string reference was found). Then a one-line total and the offer from the reference. Give `file:line` for every symbol or file named. Label any part that came from source inspection. Do not dump raw MCP JSON.

### Step 4: Offer a Shareable Copy

Read `references/share.md` and follow it.

Files in this skill

  • SKILL.md2.8 KB
  • references/candidates.md2 KB
  • references/freshness.md3.4 KB
  • references/share.md1.4 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.