Code Review
You need to 1) check the compliance of a set of code changes with the given rules and 2) propose refactors and solutions for them.
The rules are in docs/jonasland-rules.md
Workflow#
First, if the user hasn't already told you, you must find out which changes. Provide options to user:
- compared to parent branch
- unstaged changes
- last commit
- something else
Optionally ask the user if they want to limit to only changes in some folder.
Second, in parallel with subagents do a map / reduce:
- Check adherence to each of the rules.
- Look at each rule individually.
- An issue must be specifically quoted with offending code and why it's a violation.
- Produce suggestions for fixes / refactors.
- Each subagent must produce multiple different options for how to fix each issue, alongside a recommendation and reasoning.
Then take all the findings and combine them into a high level report. Write it to a markdown file in the repo called _code-review-[slug].md and pick a slug that's appropriate. These files are intentionally local scratch artifacts and should stay git-ignored.
Leave a section # Plan (TODO) empty at the end.
Then ask many detailed questions of the user with detailed options and recommendations. Don't use the question ask tool.
Then fill in the # Plan section and ask for confirmation once more, before remediating the findings.
Style#
- Always give labeled options and propose the recommended / default one
- When asking multiple questions, number them. So the user can say 1a 2b 3b 4c etc