|
| 1 | +--- |
| 2 | +name: simplify |
| 3 | +description: Review recently changed code for reuse, simplicity, efficiency, and appropriate abstraction, then apply safe behavior-preserving cleanup. Use when the user invokes $simplify or asks to simplify or refine recent changes. Do not use for correctness review. |
| 4 | +--- |
| 5 | + |
| 6 | +# Simplify |
| 7 | + |
| 8 | +Review the target the user names. Otherwise inspect tracked and untracked |
| 9 | +changes with `git status --short --untracked-files=all`, then read the relevant |
| 10 | +diffs and new files. If there is no changed code, report that and stop. |
| 11 | + |
| 12 | +Check four things: |
| 13 | + |
| 14 | +1. Reuse existing helpers instead of duplicating logic. |
| 15 | +2. Reduce unnecessary control flow, state, indirection, and comments. |
| 16 | +3. Remove avoidable work or allocation when the benefit is clear. |
| 17 | +4. Keep behavior at the right abstraction level for the surrounding code. |
| 18 | + |
| 19 | +Use code graph tools for relationships and reuse discovery. Read the diff and |
| 20 | +the minimum surrounding code needed to validate each cleanup. Do not broaden |
| 21 | +the task into bug hunting, feature work, or unrelated refactoring. |
| 22 | + |
| 23 | +Apply only changes that preserve intended behavior and make the code plainly |
| 24 | +simpler. Leave uncertain or subjective suggestions unapplied and report them. |
| 25 | +Keep edits inside changed code unless a directly reused helper requires a |
| 26 | +small adjacent update. |
| 27 | + |
| 28 | +Run focused tests and relevant lint checks after editing. Invoke |
| 29 | +`$cpp-style-review` after C++ changes and `$python-style-review` after Python |
| 30 | +changes. Review the final diff and revert any cleanup that adds complexity or |
| 31 | +changes behavior. Do not commit or open a pull request unless asked. |
| 32 | + |
| 33 | +Report the cleanups applied, verification results, and any suggestions left |
| 34 | +for the user. |
| 35 | + |
| 36 | +<!-- vim: set ff=unix fenc=utf8 et sw=4 ts=4 sts=4 tw=79: --> |
0 commit comments