cleanse
Scope
If the user specified files or directories, review those. If not, ask what they'd like you to review before proceeding.
Goal
Make this code trivially easy to pick up cold. Someone opening this file in six months should understand what it does in seconds. All changes should preserve the original functionality and behavior.
What to look for
Read the target code carefully, then apply these passes in order. Make changes directly — don't list suggestions.
1. Flatten control flow
Nested conditionals are the single biggest readability killer. Flatten them.
- Convert if/else chains to early returns and guard clauses. Put the bail-out condition at the top, happy path below.
- When a function has a single meaningful path wrapped in a conditional, invert the condition and return early.
More from andrewgleave/skills
writing-for-interfaces
>
420critical-reasoning
Apply critical rationalist epistemology (Popper, Deutsch) to evaluate reasoning, identify errors, and refine understanding. Use when the user explicitly requests help with reasoning - phrases like "help me think this through", "does this make sense", "any flaws in this", "what am I missing", "critique this", "is this reasoning sound", "stress test this idea", "devil's advocate", or any request to evaluate arguments, identify logical problems, or improve thinking. Also use when errors in reasoning are significant enough to materially affect the user's goals, even if not explicitly requested.
625-steps
>
13navvy
>
10cleanser
>
2simplify
>
1