code-cleaner

Refactor code to remove technical debt, eliminate dead code, and enforce SOLID principles without altering runtime behavior.

16 stars

Best use case

code-cleaner is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Refactor code to remove technical debt, eliminate dead code, and enforce SOLID principles without altering runtime behavior.

Teams using code-cleaner should expect a more consistent output, faster repeated execution, less prompt rewriting, better workflow continuity with your supporting tools.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.
  • You already have the supporting tools or dependencies needed by this skill.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/code-cleaner/SKILL.md --create-dirs "https://raw.githubusercontent.com/diegosouzapw/awesome-omni-skill/main/skills/development/code-cleaner/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/code-cleaner/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How code-cleaner Compares

Feature / Agentcode-cleanerStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Refactor code to remove technical debt, eliminate dead code, and enforce SOLID principles without altering runtime behavior.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# Code Cleaner Standards

You are a Principal Software Engineer acting as the "Code Janitor." Your mandate is to enforce strict code hygiene to prevent "software rot" [6].

## The "Two Hats" Protocol
You must strictly adhere to the "Two Hats" metaphor (Martin Fowler) [7]:
1.  **Refactoring Hat:** You restructure code. You NEVER add functionality.
2.  **Feature Hat:** You add functionality. You NEVER restructure.
**CURRENT MODE:** You are wearing the **Refactoring Hat**. Do not change observable behavior.

## Execution Workflow

### Step 1: Automated Sanitation
Before applying manual refactoring reasoning, run the deterministic cleanup script to handle whitespace, unused imports, and standard linting.
- **Action:** Run `python {baseDir}/scripts/run_ruff.py`
- **Note:** This uses `ruff`, a high-performance linter that replaces black/isort [8].

### Step 2: Static Analysis (The "Tree Shake")
Analyze the codebase for "Zombie Code" using the rules defined in the reference file.
- **Action:** Read the reference rules: `Read({baseDir}/references/cleanup_rules.md)`
- **Task:** Identify and delete unused endpoints, shadowed variables, and unreachable branches (Tree Shaking) [9].

### Step 3: Structural Refactoring
Apply SOLID principles to decompose "God Classes" and complex methods.
- **Metric:** Flag any function > 50 lines or file > 200 lines.
- **Action:** Extract methods or classes. Ensure high-level modules (Business Logic) do not depend on low-level modules (DB/UI) [10].

### Step 4: Resource Hygiene
For Python applications, ensure Garbage Collection (GC) is tuned for high throughput.
- **Check:** Look for `gc.freeze()` or `gc.set_threshold` in the startup logic.
- **Fix:** If missing in a high-load app, suggest adding GC tuning to prevent latency spikes [11].

--------------------------------------------------------------------------------

Related Skills

ruff-recursive-fix

28865
from github/awesome-copilot

Run Ruff checks with optional scope and rule overrides, apply safe and unsafe autofixes iteratively, review each change, and resolve remaining findings with targeted edits or user decisions.

detecting-aws-credential-exposure-with-trufflehog

4032
from mukul975/Anthropic-Cybersecurity-Skills

Detecting exposed AWS credentials in source code repositories, CI/CD pipelines, and configuration files using TruffleHog, git-secrets, and AWS-native detection mechanisms to prevent credential theft and unauthorized account access.

ruff

26
from TerminalSkills/skills

Lint and format Python with Ruff. Use when a user asks to set up Python linting, replace flake8/black/isort, configure code quality rules, or speed up Python code formatting.

Ruff

25
from ComeOnOliver/skillshub

## Overview

Data Cleaner

16
from diegosouzapw/awesome-omni-skill

Use this skill when the user needs to analyze, clean, or prepare datasets. Helps with listing columns, detecting data types (text, categorical, ordinal, numeric), identifying data quality issues, and cleaning values that don't fit expected patterns. Invoke when users mention data cleaning, data quality, column analysis, type detection, or preparing datasets.

campaign-cleaner-automation

16
from diegosouzapw/awesome-omni-skill

Automate Campaign Cleaner tasks via Rube MCP (Composio). Always search tools first for current schemas.

macos-cleaner

16
from diegosouzapw/awesome-omni-skill

Analyze and reclaim macOS disk space through intelligent cleanup recommendations. This skill should be used when users report disk space issues, need to clean up their Mac, or want to understand what's consuming storage. Focus on safe, interactive analysis with user confirmation before any deletions.

bgo

10
from diegosouzapw/awesome-omni-skill

Automates the complete Blender build-go workflow, from building and packaging your extension/add-on to removing old versions, installing, enabling, and launching Blender for quick testing and iteration.

Coding & Development

code-commenting

16
from diegosouzapw/awesome-omni-skill

Comprehensive code commenting methodology for Python projects. Use when user asks to add comments, annotations, or documentation to Python code files. Provides structured approach with module docstrings, class/function documentation, section separators, and inline comments.

code-audit

16
from diegosouzapw/awesome-omni-skill

Perform a human-assisted code audit. Use when asked to audit, review architecture, document a codebase, or create technical documentation with diagrams.

code-assistant

16
from diegosouzapw/awesome-omni-skill

Expert coding assistant for writing, reviewing, and debugging code across multiple languages

code-architecture-analyzer

16
from diegosouzapw/awesome-omni-skill

智能代码架构解读和分析工具。当用户请求分析项目架构、生成架构文档、识别设计模式、分析依赖关系、评估代码质量、或理解复杂项目结构时使用此skill。适用于接手新项目、代码审查、重构规划、技术选型评估等场景。