dead-code

A code-cleanup command that finds unused code in TypeScript, Bash, Kotlin, and Swift projects. Dead code is code that no longer runs or is needed.

In plain words
What is it for?
Use it to scan one language, a specific folder or module, or all supported code. It can identify unused variables, functions, files, and other code for removal.
Why use it?
Unused code makes a project harder to understand and maintain, and can leave misleading files or functions behind. The command checks findings against an allowlist so known exceptions are not treated as mistakes.

Command for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/kaeawc/auto-mobile/dead-code
Clone the repo
git clone --depth 1 https://github.com/kaeawc/auto-mobile

Made for: Claude Code.

Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,308 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.01308
Opus 5 $0.00000 $0.00654
Sonnet 5 $0.00000 $0.00262
Haiku 4.5 $0.00000 $0.00131

Measured 2d ago against content hash f9d8cb5c2059, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

dead-code scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/commands/dead-code.md · 119 lines

How it starts

The opening of the file, as written. The whole thing — 119 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Dead Code Cleanup

Detect and remove dead code across TypeScript, Bash, Kotlin, and iOS/Swift codebases.

Arguments

The user may specify a target scope as arguments: $ARGUMENTS

Supported scopes:

  • ts / typescript — TypeScript dead code (ts-prune + knip)
  • bash / shell — Unused variables, functions, and files in shell scripts
  • kotlin / android — Unused Kotlin code in android/ (plus a specific module like android/control-proxy)
  • swift / ios — Unused Swift code in ios/ (plus a specific package like ios/control-proxy)
  • all — Run all of the above
  • No argument or empty — Default to all

The user may also specify a subdirectory or module (e.g., kotlin android/ide-plugin, swift ios/control-proxy).

Instructions

Step 1: Determine scope

Parse $ARGUMENTS to determine which language(s) and optional subdirectory to scan. If ambiguous, ask the user.

Step 2: Run detection for each target

TypeScript
  1. Run the existing detection scripts:
    bun run dead-code:ts:prune
    bun run dead-code:ts:knip
    
  2. Cross-reference results against dead-code-allowlist.json — items already allowlisted with valid reasons are false positives.
  3. For each flagged item, grep the codebase to verify it is truly unused (check src/, test/, scripts/, barrel index.ts re-exports, and namespace imports like import * as).
  4. Classify each as DEAD (zero references, safe to remove) or FALSE POSITIVE (used in tests, public API, barrel re-export, namespace import, etc.).
Bash / Shell
  1. Run shellcheck on all .sh files in the target directory (default: scripts/):
    shellcheck scripts/*.sh
    
  2. Focus on SC2034 (unused variables) and SC2317 (unreachable code).
  3. Also look for script files in scripts/ that are never referenced from package.json, other scripts, CI workflows (.github/workflows/), or documentation.
Kotlin / Android
  1. Identify the Gradle module(s) to scan (default: all modules under android/).
  2. Run Android lint if available:
    cd android && ./gradlew :<module>:lintDebug 2>&1
    
  3. Grep for unused imports, classes, and functions using IDE-style heuristics:
    • Find all public/internal class and function declarations
    • Search for references to each across the module and its dependents
    • Flag any with zero external references (excluding the defining file)
  4. Check for unused Gradle dependencies in build.gradle.kts files.

Read the full file on GitHub · 119 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 119 lines · 0 tokens per session scan A f9d8cb5c2059

Subscribe to this mod's changes

dead-code is a command published in the GitHub repository kaeawc/auto-mobile (45 stars, last pushed 2d ago), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 1,308 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.