# Clean Code > A repository-aware agent skill that refactors legacy code for readability and maintainability WITHOUT changing its observable behavior. Clean Code enforces a behavior-preserving sequence: establish the boundary, lock current behavior with retained characterization tests, apply an API versioning gate, design the smallest useful refactor, implement in small verified batches, verify, then report evidence. It favors precise names and locality over abstraction, and refuses to equate "clean" with more files, interfaces, or patterns. ## Routing entry point - File: SKILL.md - Frontmatter: name="clean-code", description (behavior-preserving refactor trigger), version="1.0.0", license=MIT - Implicit routing triggers: "clean up", "simplify", "rename", "untangle", "restructure", "reduce technical debt", "refactor without changing behavior", "legacy cleanup". ## Install - Clone: `git clone https://github.com/cskwork/clean-code.git` - Project scope (Codex): `cp -r clean-code /.agents/skills/clean-code/` - User scope (Codex): `cp -r clean-code $HOME/.agents/skills/clean-code/` - Other Agent Skills-compatible clients: place the complete `clean-code` directory in the client's skills directory; keep SKILL.md at the skill root. - Compatibility note: requires repository access + the ability to run the project's own tests and verification commands. ## Non-negotiable rules - No production change before retained characterization tests pass on unchanged code. - Characterization tests are kept as permanent regression tests. - Never combine a refactor with a bug fix, feature change, dependency upgrade, or formatting pass. - API versioning is an explicit decision gate (preserve v1 in place OR add side-by-side v2), asked once. - Verification distinguishes: passing / pre-existing failures / new failures / commands not run. ## Links - [SKILL.md (entry point)](https://github.com/cskwork/clean-code/blob/main/SKILL.md) - [Raw SKILL.md](https://raw.githubusercontent.com/cskwork/clean-code/main/SKILL.md) - [README](https://github.com/cskwork/clean-code/blob/main/README.md) - [REFERENCES.md](https://github.com/cskwork/clean-code/blob/main/REFERENCES.md) - [Landing page](https://cskwork.github.io/clean-code/) - [Agent Skills specification](https://agentskills.io/)