claude-pilot: Skill for Claude Code

.claude/skills/code-cleanup/SKILL.md

code-cleanup is a skill for Claude Code from changoo89/claude-pilot. It costs 31 tokens per session (1,456 once invoked), scanned A, original, MIT.

A code-cleanup workflow finds unused imports, variables, and files, then removes them using Knip or standard linting tools. Dead code is code that is no longer used but remains in the project.

In plain words
What is it for?
It is for scanning a repository or selected path, removing unused imports, and finding or deleting files with no references.
Why use it?
It helps reduce leftover code after refactoring and makes it easier to see what the project actually depends on.

Skill for Claude Code

Written for Claude Code: installed under .claude/. Also seen: positional $N argument.

This is changoo89/claude-pilot's own configuration. It tells Claude Code how to work on claude-pilot itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything claude-pilot configures →

Part of the claude-pilot plugin — 32 skills, 11 commands, 14 agents, 2 MCP servers shipped together

Reuse

Borrowing it

Nothing to install: this file belongs to changoo89/claude-pilot. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/changoo89/claude-pilot/main/.claude/skills/code-cleanup/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/changoo89/claude-pilot

Made for: Claude Code.

Or install claude-pilot, the plugin that ships this one along with the rest of its 32 skills, 11 commands, 14 agents, 2 MCP servers.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for code-cleanup

README.md
[![agentmods](https://agentmods.dev/badge/skills/changoo89/claude-pilot/code-cleanup/github.svg)](https://agentmods.dev/skills/changoo89/claude-pilot/code-cleanup)
Your own site
<a href="https://agentmods.dev/skills/changoo89/claude-pilot/code-cleanup"><img src="https://agentmods.dev/badge/skills/changoo89/claude-pilot/code-cleanup/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for code-cleanup

Your own site · 80×15
<a href="https://agentmods.dev/skills/changoo89/claude-pilot/code-cleanup"><img src="https://agentmods.dev/badge/skills/changoo89/claude-pilot/code-cleanup.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 31 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,456 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00031 $0.01456
Opus 5.5 $0.00012 $0.00582
Sonnet 5.5 $0.00006 $0.00291
Haiku 4.5 $0.00003 $0.00146

Measured 2mo ago against content hash 6ba0f88cc75b, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

code-cleanup 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 2mo 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/skills/code-cleanup/SKILL.md · 201 lines

How it starts

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

SKILL: Code Cleanup

Purpose: Dead code detection and removal using knip (recommended) or ESLint/TypeScript fallback Target: Coder Agent, cleanup commands


⚠️ EXECUTION DIRECTIVE

IMPORTANT: Execute ALL steps IMMEDIATELY and AUTOMATICALLY.

Core Philosophy: Auto-apply Low/Medium risk | High-risk: User confirmation | Safe flags: --dry-run, --apply | Verification after each batch


Quick Start

When to Use This Skill

  • Remove unused import statements
  • Detect and delete dead files (zero references)
  • Clean up codebase after refactoring

Usage

MODE="${1:-files}"  # imports|files|all
SCOPE="${2:-repo}"  # repo|path=...

.cleanup-ignore Support

Create .cleanup-ignore file in project root:

# Core infrastructure
**/auth/**
**/database/**
**/*.config.*

# Entry points
**/index.ts
**/main.ts

# Generated files
**/generated/**
**/*.gen.ts

Loading order: Read .cleanup-ignore → Apply patterns → Exclude protected files


Step 1: Detect Dead Code

Detection Tools

Recommended: knip

npx knip                    # Full analysis
npx knip --reporter compact # Concise output
npx knip --fix              # Auto-fix safe issues

Fallback: Standard tooling

grep -r "import.*from" src/ --include="*.ts"  # Unused imports
find src/ -name "*.ts" -exec grep -l "{}" \;   # Dead files

Dead File Detection Procedure

EXCLUDE="--glob '!*.test.ts' --glob '!*.spec.ts' --glob '!index.ts'"
rg --files $EXCLUDE src/ | while read file; do
  refs=$(rg -c "from.*['\"]$file" src/ || echo 0)
  [ "$refs" -eq 0 ] && echo "$file: 0 references"
done

Step 2: Risk Classification (4-Level)

Risk File Types Action
SAFE Tests (*.test.*), mocks, fixtures auto-remove
CAUTION Utils, helpers, internal modules auto-remove + prompt
WARNING Components, services, hooks tests pass first
DANGER Auth, database, config, API routes require --force

Read the full file on GitHub · 201 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 2mo ago First seen · 201 lines · 31 tokens per session scan A 6ba0f88cc75b

Subscribe to this mod's changes

code-cleanup is a skill published in the GitHub repository changoo89/claude-pilot (20 stars, last pushed 8mo ago), licensed MIT. It adds 31 tokens to every session and 1,456 once invoked, about $0.0001 per session on Opus 5.5. 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.

Related

Other skills, from other repositories

ai-ml-development

AI and machine learning development with PyTorch, TensorFlow, and LLM integration. Use when building ML models, training pipelines, fine-tuning LLMs, or implementing AI features.

travisjneuman/.claude · 43 tokens

case-interview-practice

Interactive consulting case interview practice with structured frameworks, feedback mechanisms, and progressive difficulty. Use when preparing for management consulting interviews, case competitions, or business problem-solving exercises.

travisjneuman/.claude · 39 tokens

performance-engineering

Web Vitals, bundle optimization, CDN, caching, and load analysis. Use when diagnosing slow pages or APIs, reducing bundle size, or designing caching and performance budgets.

travisjneuman/.claude · 38 tokens

finance

Financial analysis expertise for financial modeling (DCF, LBO, M&A), valuation, financial statement analysis, capital allocation, treasury management, and corporate finance decisions. Use when building financial models, analyzing statements, or making investment decisions.

travisjneuman/.claude · 48 tokens

i18n-localization

Internationalization and localization for global applications. Use when adding multi-language support, handling regional formats, or preparing apps for global markets.

travisjneuman/.claude · 32 tokens

leadership

Executive leadership expertise for decision-making, change management, crisis management, stakeholder management, team building, and organizational leadership. Use when leading teams, managing change, navigating crises, or developing leadership skills.

travisjneuman/.claude · 42 tokens