|
1 | | -<script setup> |
2 | | -import { onMounted } from 'vue' |
| 1 | +# Code Slob Cleanup Documentation |
3 | 2 |
|
4 | | -onMounted(() => { |
5 | | - // Try to preserve the hash for deep links |
6 | | - const hash = window.location.hash || '#getting-started'; |
7 | | - window.location.replace("https://github.com/Jazz23/CodeSlobCleanup/blob/main/docs/README.md" + hash); |
8 | | -}) |
9 | | -</script> |
| 3 | +Welcome to the documentation for the **Code Slob Cleanup** project. This project provides an automated toolchain and a packaged skill for coding agents, designed to identify, refactor, and rigorously verify Python code to remove "code slob"—subtle technical debt, unnecessary verbosity, and complexity often introduced by AI coding agents or rapid development. |
10 | 4 |
|
11 | | -# Redirecting... |
| 5 | +## Getting Started |
12 | 6 |
|
13 | | -If you are not redirected automatically, please [click here](https://github.com/Jazz23/CodeSlobCleanup/blob/main/docs/README.md#getting-started). |
| 7 | +### Installation |
| 8 | + |
| 9 | +#### Simply run `curl -LsSf https://raw.githubusercontent.com/Jazz23/CodeSlobCleanup/refs/heads/main/install.sh | sh`. |
| 10 | + |
| 11 | +During the first run, a `code-slob-cleanup.json` file will be auto-generated in your project root to manage exclusions and track edits for potential reverts. During the cleanup process, a temporary directory `.code-slob-tmp` will be created. It is recommended to add this to your `.gitignore` file. |
| 12 | + |
| 13 | +For manual installation: |
| 14 | + |
| 15 | +- You must have [uv](https://docs.astral.sh/uv/getting-started/installation/) and Python installed. |
| 16 | +- Copy [skills/code-slob-cleanup](https://github.com/Jazz23/CodeSlobCleanup/tree/main/skills/code-slob-cleanup) into your agent's `skills` directory. |
| 17 | + |
| 18 | +### Usage |
| 19 | + |
| 20 | +There are multiple workflows you can trigger with natural language. Below is a comprehensive list of example prompts to utilize Code Slob Cleanup: |
| 21 | + |
| 22 | +- **"Clean up my code"** -> The agent will ask you what slob identifiers to target and how many files you want to clean up (in order of slob score). |
| 23 | +- **"Clean up code in the `src/helpers` folder"** -> The agent will only cleanup the `src/helpers` folder. |
| 24 | +- **"Revert cleanup changes made to the 'verify_user' function"** -> The agent will look at the commit it originally modified and revert the function. |
| 25 | +- **"Clean up global variables only"** -> The agent will skip other code slob identifiers and only look for global variables. |
| 26 | +- **"Remove all code that is not covered by `test_e2e.py`"** -> A Python script will run your provided test script to identify all code that is not covered by the test script and remove it. |
| 27 | +- **"Accessing --help remotely"** -> See [remote_help.md](remote_help.md) for how to set up the tool suite on any machine. |
| 28 | + |
| 29 | +### Exclusions |
| 30 | + |
| 31 | +See [exclusions](exclusions.md) for how to specify functions, files, or folders to ignore during the cleanup process. |
| 32 | + |
| 33 | +### Slob Identifiers |
| 34 | + |
| 35 | +- Cyclomatic complexity |
| 36 | +- Lines of code (LoC) |
| 37 | +- Global variables |
| 38 | +- Public methods/classes that could be private |
| 39 | +- Dead code (code not covered by a provided test) |
| 40 | + |
| 41 | +## How It Works |
| 42 | + |
| 43 | +Code Slob Cleanup identifies, tests, and applies code refactorings in a rigorous multi-stage workflow. |
| 44 | + |
| 45 | +1. **Scanner**: Detects "slob" candidates using static analysis (complexity, LoC) and semantic analysis using your agent. |
| 46 | +2. **Verifier**: Ensures that refactoring does not break functionality using [Hypothesis](https://hypothesis.readthedocs.io/) for property-based testing. |
| 47 | +3. **Refactor** Applies refactored code to the codebase if verification passes. |
| 48 | + |
| 49 | +## Documentation Sections |
| 50 | + |
| 51 | +- [**Workflow Guide**](workflow.md): A detailed walkthrough of the 5-phase cleanup lifecycle. |
| 52 | +- [**Exclusions**](exclusions.md): How to control the cleanup scope. |
| 53 | +- [**Scripts Reference**](scripts.md): Documentation for the various Python scripts that power the toolchain. |
0 commit comments