Skip to content
Back to skills

Code Cleaner

ASecurity

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

  • 57 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added October 17, 2026
code-qualitypythongobashrefactoringperformance

Security analysis

A100/100

Scanned October 17, 2026

npx -y skills add diegosouzapw/awesome-omni-skill --skill code-cleaner --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Code Cleaner?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Code Cleaner
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/diegosouzapw-code-cleaner/badge)](https://www.skillsdirectory.com/skills/diegosouzapw-code-cleaner)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: code-cleaner
description: Refactor code to remove technical debt, eliminate dead code, and enforce SOLID principles without altering runtime behavior.
version: 1.0.0
allowed-tools: "Read,Write,Bash,Grep,Glob,Edit"
dependencies: "ruff"
---

# 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].

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

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.