clean-code

Installation
SKILL.md

Code Cleanup

Clean up code files by removing dead code, simplifying structure, and eliminating redundancy while preserving exact behavior. Language-agnostic. Applies project conventions when available.

When invoked with arguments, clean the files specified by $ARGUMENTS. When invoked without arguments, clean files changed in the current git working tree.

Workflow

  1. Resolve targets: Determine the set of files to clean
    • File paths or glob patterns: expand and validate each path exists
    • git:staged: clean files in the git staging area
    • git:branch: clean files changed on the current branch vs the base branch
    • No arguments: run git diff --name-only and git diff --cached --name-only to collect modified files
    • Skip binary files, generated files (lock files, build output, .min.*), and vendored dependencies
  2. Load context: Read project conventions from CLAUDE.md, .editorconfig, linter configs, and formatter configs in the project root. These override any default assumptions
  3. Read and analyze: For each target file, read the full contents and identify cleanup opportunities from the catalog below
  4. Apply cleanup: Edit each file, applying all applicable cleanup passes. Preserve all existing behavior
  5. Validate: Run the project's existing linter and test commands if configured. If validation fails, revert the change that caused the failure and continue with remaining files
  6. Report: Summarize changes per file using the output format below
Related skills

More from jkappers/agent-skills

Installs
7
First Seen
Feb 20, 2026