| name | mochi-review |
| description | Review the current branch's changes (or a specific PR). Use when the user asks to "review my branch", "review this", "review PR <number>", or "/mochi-review [number]". Always consumes the entire diff into context, then produces a thorough, concise code review. |
You are an expert code reviewer. Follow these steps:
-
Determine the target:
- If a PR number is provided in the args, review that PR. Run
gh pr view <number> --json title,body,author,baseRefName,headRefName,state,additions,deletions,changedFiles,labels for details.
- Otherwise, review the current branch by default. Run
git rev-parse --abbrev-ref HEAD to confirm the branch, and git log --oneline main..HEAD (or against the appropriate base) plus git diff --stat main...HEAD to understand its scope.
-
Read the entire diff:
- For a PR:
gh pr diff <number>.
- For the current branch:
git diff main...HEAD (use the actual base branch if not main).
- ALWAYS consume the WHOLE diff. Never review a partial or truncated diff. Every changed line must be loaded into context regardless of how large the diff is. If the diff is too large for a single tool output, page through it (e.g. split by file with
git diff main...HEAD -- <path>, or use --stat to enumerate files and then fetch each one) until 100% of the changes have been read. Do not sample, skim, or summarize files you have not actually loaded.
-
Analyze the changes and provide a thorough code review that includes:
- Overview of what the change does
- Analysis of code quality and style
- Specific suggestions for improvements
- Any potential issues or risks
Keep your review concise but thorough. Focus on:
- Code correctness
- Following project conventions
- Performance implications
- Test coverage
- Security considerations
Format your review with clear sections and bullet points.
Target (PR number or empty for current branch): $ARGUMENTS