simplify-code
Simplify, clean up, and refactor existing code in any mainstream language (JS/TS, Python, Java, Go, Rust, C#, C/C++, PHP, SQL, Bash, and more) while preserving behavior and public APIs. Use whenever the user asks to simplify, tidy, refactor, de-nest, deduplicate, remove dead code
# Simplify Code Make code easier to read and change without changing what it does. The target is the *smallest readable equivalent*: fewer concepts, duplicated knowledge, nesting levels, and pointless hops — not the fewest characters. Small safe steps beat big rewrites, because each step can be checked on its own. ## Golden rules Rules 1–2 outrank everything else in this skill, including the checklists in `references/`. Users ask for cleanup expecting to merge it without re-testing the world; a silent behavior change betrays that trust. 1. **Preserve behavior.** Keep outputs, side effects
When to use
Community skill by linkxzhou. Source: https://github.com/linkxzhou/simplify-code
Examples
Step 0 — Mode and scope
- Do: pick the mode and fix the scope (Golden rule 6): the code the user named; if none, the code changed in this session or the working diff. Read ap
Step 1 — Understand the contract
- Do: state inputs, outputs, side effects, errors, and edge cases; identify the public surface (`export`, `pub`, `public`, `__all__`, package entry po
Step 2 — Baseline and safety net
- Do: run the existing tests, linters, build, and type checker and record the results. For risky repo changes without coverage, add small characteriza