|
| 1 | +--- |
| 2 | +name: code-reviewer |
| 3 | +description: |
| 4 | + Use this skill to review code. It supports both local changes (staged or working tree) |
| 5 | + and remote Pull Requests (by ID or URL). It focuses on correctness, maintainability, |
| 6 | + and adherence to project standards. |
| 7 | +--- |
| 8 | + |
| 9 | +# Code Reviewer |
| 10 | + |
| 11 | +This skill guides the agent in conducting professional and thorough code reviews for both local development and remote Pull Requests. |
| 12 | + |
| 13 | +## Workflow |
| 14 | + |
| 15 | +### 1. Determine Review Target |
| 16 | +* **Remote PR**: If the user provides a PR number or URL (e.g., "Review PR #123"), target that remote PR. |
| 17 | +* **Local Changes**: If no specific PR is mentioned, or if the user asks to "review my changes", target the current local file system states (staged and unstaged changes). |
| 18 | + |
| 19 | +### 2. Preparation |
| 20 | + |
| 21 | +#### For Remote PRs: |
| 22 | +1. **Checkout**: Use the GitHub CLI to checkout the PR. |
| 23 | + ```bash |
| 24 | + gh pr checkout <PR_NUMBER> |
| 25 | + ``` |
| 26 | +2. **Preflight**: Execute the project's standard verification suite to catch automated failures early. |
| 27 | + ```bash |
| 28 | + npm run preflight |
| 29 | + ``` |
| 30 | +3. **Context**: Read the PR description and any existing comments to understand the goal and history. |
| 31 | +
|
| 32 | +#### For Local Changes: |
| 33 | +1. **Identify Changes**: |
| 34 | + * Check status: `git status` |
| 35 | + * Read diffs: `git diff` (working tree) and/or `git diff --staged` (staged). |
| 36 | +2. **Preflight (Optional)**: If the changes are substantial, ask the user if they want to run `npm run preflight` before reviewing. |
| 37 | +
|
| 38 | +### 3. In-Depth Analysis |
| 39 | +Analyze the code changes based on the following pillars: |
| 40 | +
|
| 41 | +* **Correctness**: Does the code achieve its stated purpose without bugs or logical errors? |
| 42 | +* **Maintainability**: Is the code clean, well-structured, and easy to understand and modify in the future? Consider factors like code clarity, modularity, and adherence to established design patterns. |
| 43 | +* **Readability**: Is the code well-commented (where necessary) and consistently formatted according to our project's coding style guidelines? |
| 44 | +* **Efficiency**: Are there any obvious performance bottlenecks or resource inefficiencies introduced by the changes? |
| 45 | +* **Security**: Are there any potential security vulnerabilities or insecure coding practices? |
| 46 | +* **Edge Cases and Error Handling**: Does the code appropriately handle edge cases and potential errors? |
| 47 | +* **Testability**: Is the new or modified code adequately covered by tests (even if preflight checks pass)? Suggest additional test cases that would improve coverage or robustness. |
| 48 | + |
| 49 | +### 4. Provide Feedback |
| 50 | + |
| 51 | +#### Structure |
| 52 | +* **Summary**: A high-level overview of the review. |
| 53 | +* **Findings**: |
| 54 | + * **Critical**: Bugs, security issues, or breaking changes. |
| 55 | + * **Improvements**: Suggestions for better code quality or performance. |
| 56 | + * **Nitpicks**: Formatting or minor style issues (optional). |
| 57 | +* **Conclusion**: Clear recommendation (Approved / Request Changes). |
| 58 | + |
| 59 | +#### Tone |
| 60 | +* Be constructive, professional, and friendly. |
| 61 | +* Explain *why* a change is requested. |
| 62 | +* For approvals, acknowledge the specific value of the contribution. |
| 63 | + |
| 64 | +### 5. Cleanup (Remote PRs only) |
| 65 | +* After the review, ask the user if they want to switch back to the default branch (e.g., `main` or `master`). |
0 commit comments