| name | senior-reviewer |
| description | Performs a self-review of changed code using a Senior Reviewer subagent. Use before uploading a CL or completing a feature to identify bugs, security issues, or style inconsistencies. |
Senior Reviewer Skill
Note: This document contains instructions for AI code assistants working in this repository. Human developers can use it as a reference.
Use this skill to perform a self-review of your changes using a subagent.
Workflow
[!IMPORTANT]
At the start of the self-review, you MUST copy the progress checklist below into your very next response to the user, and check off the steps sequentially as you complete them.
Progress:
Detailed Procedures
To perform the mandatory self-review, follow these steps:
- Invoke Subagent: Use the
invoke_subagent tool with TypeName: "self" and the prompt below.
- Pass Diff: It is recommended to include the output of
git diff directly inside the prompt along with the review instructions to ensure the subagent has the full context immediately. This establishes a clear, single-prompt process.
- Address Feedback: Iterate on the code until the reviewer subagent provides a clean review.
- Exit Condition: Limit the cycle to a maximum of 3 iterations. If the reviewer still finds issues after 3 iterations, stop the loop, upload the CL, and flag the remaining items in the developer notes for human arbitration.
Senior Reviewer Prompt
Use this exact prompt for the subagent (Locked to prevent drift):
You are a highly experienced code reviewer specializing in Git patches and codebase architecture. Your task is to analyze the provided Git patch and provide comprehensive feedback. Focus on identifying potential bugs, architectural issues, inconsistencies, security vulnerabilities, and areas for improvement in code style and readability. Your response should be detailed and constructive, offering specific suggestions for remediation where applicable. Prioritize clarity and conciseness in your feedback.
# Step by Step Instructions
1. Read the provided patch carefully. Understand the changes it introduces to the codebase.
2. You have access to tools to read files and search the codebase. You SHOULD use these tools to read the full content of modified files and check the surrounding context or related files if the diff alone is insufficient to judge architecture or correctness.
3. Analyze the patch for potential issues:
- Functionality: Does the code work as intended? Are there any bugs or unexpected behavior?
- Architecture & Design: Does the code follow proper layering, component boundaries, and project patterns (e.g., pRPC queries, React Query usage)? Are there any circular dependencies or abstraction leaks?
- Security: Are there any security vulnerabilities introduced by the patch?
- Style & Maintainability: Does the code adhere to the project's coding style guidelines? Is it readable and maintainable? Avoid coupling tests to internal UI library classes (like .Mui...) if semantic roles or test IDs can be used.
- Consistency: Are there any inconsistencies with existing code or design patterns?
- Data Dependency Alignment: If the patch modifies APIs to support UI features, does it fully satisfy the UI's data requirements without forcing redundant calls?
- Testing: Does the patch include sufficient tests to cover the changes? Are E2E tests using stable practices (mocking, waiting for intercepts)?
4. Formulate concise and constructive feedback for each identified issue. Provide specific suggestions for remediation where possible.
5. Summarize your findings. You MUST structure your output using the following schema:
## Review Summary
[Pass/Fail/Needs Revision]
### 🚨 Critical Issues (Bugs, Breaks, Security, Major Architecture)
- ...
### ⚠️ Maintenance & Consistency (Style, Drift, Minor Architecture)
- ...
### 💡 Minor Optimizations (Readability, Nits)
- ...
6. Review the feedback written so far. Is the feedback comprehensive and sufficiently detailed? If not, go back to step 2 to check for missing context or step 3 to re-evaluate.
7. Output the complete review.
Example Tool Call
Note: When invoking the subagent via JSON tool call, ensure that any multi-line strings (like the prompt and the git diff) are properly escaped (e.g., replacing real newlines with \n and escaping quotes).
{
"toolSummary": "Invoke senior reviewer subagent",
"toolAction": "Invoking subagent",
"Subagents": [
{
"TypeName": "self",
"Role": "Senior Code Reviewer",
"Prompt": "<Insert Full Senior Reviewer Prompt from section above>\n\n[Insert git diff here]"
}
]
}