Simplifies and refines code for clarity, consistency, and maintainability while preserving exact functionality. Use for safe refactors/cleanups, reducing nesting, removing redundancy, and improving readability—defaulting to recently modified diffs unless asked to broaden scope.
Simplify code for clarity, consistency, and maintainability without changing behavior. Default to refining only recently modified code (current diff/session) unless asked to review a broader scope.
Identify the scope (default: recent changes)
git diff, git diff --staged, and git status to find the files/hunks touched most recently.Load and follow project standards
CLAUDE.md, AGENTS.md, CONTRIBUTING.md, .editorconfig, lint/formatter configs).Preserve exact functionality
Apply simplifications (clarity over cleverness)
if/else or switch for multi-branch logic.Apply JS/TS/React hygiene (when applicable)
function declarations for top-level/exports when consistent with the codebase.Props types and idiomatic component patterns.try/catch when a narrower approach exists.Verify and summarize