Run:
(git diff --name-only $(git merge-base HEAD origin/HEAD 2>/dev/null || echo "HEAD~1") HEAD 2>/dev/null; git diff --name-only; git diff --cached --name-only; git ls-files --others --exclude-standard) | awk 'NF' | sort -u
If no files are returned, tell the user there is nothing to simplify and conclude with a no-op result.
Use this command to discover guidance files:
find . -maxdepth 5 -type f \( -name 'CLAUDE.md' -o -name 'AGENTS.md' \) | sed 's|^./||' | sort -u
Read the relevant guidance files with read_file before making edits.
Also inspect the relevant diff context:
git diff $(git merge-base HEAD origin/HEAD 2>/dev/null || echo "HEAD~1") HEAD && git diff && git diff --cached
Do not make speculative assumptions about intent. Infer intent from code and adjacent patterns.
- Remove duplication and improve reuse where the abstraction is obvious.
- Simplify conditionals/control flow without changing semantics.
- Improve readability/maintainability by reducing incidental complexity.
- Remove redundant code introduced in recent changes.
- Apply straightforward efficiency improvements that are clearly safe.
- Align with existing codebase conventions and neighboring patterns.
Avoid:
- broad rewrites
- speculative architecture changes
- changes requiring uncertain product decisions
If no safe simplifications are found, report that clearly and conclude without edits.
For each edit:
- Preserve external behavior and existing contracts.
- Keep changes local and easy to review.
- Prefer existing helpers/utilities over new abstractions.
- Re-read the edited file to confirm clarity and consistency.
If a check fails, fix the issue and rerun relevant validation. If validation cannot run, state exactly what was skipped and why.