cleanup-code

Refactor code to improve quality while preserving behavior and APIs.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/FrozenPandaz/config-claude --skill cleanup-code
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cleanup-code
Source: https://github.com/FrozenPandaz/config-claude/tree/main/skills/cleanup-code
Command: npx skills add https://github.com/FrozenPandaz/config-claude --skill cleanup-code

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

You are a specialized code cleanup assistant that analyzes and refactors code to improve quality, readability, and maintainability while strictly preserving its behavior.

Core Features & Use Cases

  • Safe cleanups: remove unused variables/imports, simplify complex logic, and rename for clarity
  • Preserve APIs and tests: avoid changing return types or public interfaces
  • Document changes: explain what was cleaned and why, and maintain test compatibility

Quick Start

Analyze a file and propose a safe cleanup for 'src/main.js', ensuring behavior stays identical after changes.

Frequently Asked Questions about cleanup-code

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I refactor code while preserving its behavior?

Refactoring code while preserving behavior involves safe cleanups like removing unused variables, renaming for clarity, and simplifying logic without altering return types, algorithms, or public APIs. The cleanup-code Skill analyzes your codebase and proposes changes that maintain test compatibility and performance characteristics, ensuring your refactored code behaves identically to the original.

What code quality improvements can I make without breaking tests?

Safe code quality improvements include removing unused imports and variables, renaming variables for readability, simplifying complex conditionals, and breaking up long functions. These cleanups enhance maintainability and readability while strictly preserving API contracts and test compatibility, so your test suite continues to pass without modification.

Can I remove unused code from my codebase safely?

Yes, removing unused code is a safe cleanup that improves maintainability without changing behavior. The cleanup-code Skill identifies unused variables, imports, and dead code, then proposes removals that preserve public interfaces and test results, letting you eliminate technical debt confidently.

How do I simplify complex code logic without changing what it does?

Simplify complex logic by refactoring conditionals, breaking long functions into smaller ones, and renaming unclear variables for clarity. The cleanup-code Skill analyzes your code to propose conservative simplifications that maintain identical return values, loop behavior, and performance, ensuring refactored code works exactly as before.

What's the difference between refactoring and rewriting code?

Refactoring improves code quality, readability, and maintainability while strictly preserving behavior and APIs. Rewriting replaces entire sections with new logic. Code cleanup focuses on refactoring: safe, conservative changes like removing dead code and renaming variables that keep algorithms, return types, and test compatibility intact.

How do I know my refactored code won't break existing functionality?

Code cleanup enforces preservation of API contracts, test compatibility, and conservative changes—no modifications to return types, loop behavior, or performance. Your existing tests should pass without changes after cleanup, confirming that refactored code maintains identical behavior and compatibility with dependent code.