Back to the catalog

code-slob-cleanup

A coding agent skill that automatically identifies, refactors, and verifies Python code to remove technical debt ('code slob') introduced by

Open source Open in the app JSON README (API)

About

A coding agent skill that automatically identifies, refactors, and verifies Python code to remove technical debt ('code slob') introduced by AI agents or rapid development. Uses static analysis and Hypothesis property-based testing to safely apply and verify refactorings.

Details

Kind
Plugins
Topic
Developer tools
Publisher
jazz23
Origin
gemini
Category
ferramentas
Version
1.0.0
Stars
1
Forks
1
Last push
2026-04-15T16:20:02Z
Repository state
ativo
Language
Python
License
MIT
Added
2026-08-30 14:13:39
Updated
2026-08-30 14:13:39
Origin id
jazz23/codeslobcleanup

README

# Overview
"Code Slob" refers to the subtle technical debt, unnecessary verbosity, and over-complexity often introduced by AI coding agents or rapid development. While functional, "slob" code is harder to maintain and prone to future regressions. The **Code Slob Cleanup** project builds an automated toolchain—packaged as a coding agent skill—to identify, refactor, and rigorously verify Python code to remove this debt.

Currently, the project only supports python codebases.

# Installation

Linux/Mac Auto Install/Uninstall/Update for Gemini/Claude/Codex:
```bash
curl -LsSf https://raw.githubusercontent.com/Jazz23/CodeSlobCleanup/refs/heads/main/install.sh | sh
```

Gemini CLI:
```bash
gemini extensions install https://github.com/Jazz23/CodeSlobCleanup
```

# How to use

Click [here](https://jazz23.github.io/CodeSlobCleanup/) for a guide on how to use Code Slob Cleanup.

# Core Objectives
1.  **Automated Identification**: Detect refactoring targets using static analysis metrics (Cyclomatic Complexity, LoC, nesting depth) and semantic analysis via the agent to identify redundant logic.
2.  **Safe Refactoring**: Employs your agent to perform code transformations such as function decomposition, visibility enforcement (Converting public to private), and dead code removal.
3.  **Rigorous Verification**: Ensure behavioral equivalence using **Property-Based Testing**: Leveraging **Hypothesis** to verify `Original(input) == Transformed(input)` across thousands of inputs.
4.  **Autonomous Self-Correction**: Integrate verification feedback directly into the refactoring loop, allowing the agent to "fix its own fixes" based on counter-examples found during testing.

# Architecture
The system follows an iterative loop:
*   **Scanner**: Traverses the codebase and finds code slob.
*   **Refactor Agent**: Analyzes flagged code and generates a cleaned-up version.
*   **Verifier**: An isolated orchestrator executes Hypothesis tests, and benchmarks performance.
*   **Feedback Loop**: If verification fails, the failing test cases are fed back to your agent for a retry.
*   **Committer**: Applies the change if verification passes and performance is not regressed.

# Technologies
*   **Language**: Python 3.14+
*   **Package Management**: `uv` (PEP 723 for standalone scripts)
*   **Testing**: Hypothesis (Property-based), Pytest
*   **Benchmarking**: Matplotlib/Numpy for performance comparison

More