Code Review Guidelines
Purpose
Code review catches bugs, ensures maintainability, and builds team knowledge. This skill provides a structured, objective, empathetic framework for reviewing code without causing friction. The goal is to improve the codebase while growing the team.
When to use
- Evaluating a Pull Request or Merge Request
- Providing constructive feedback to peers
- Ensuring code quality and architectural standards are met
- Building new team members' skills through feedback
When NOT to use
- Nitpicking personal coding style (use linters/formatters)
- Blocking on subjective preferences
- Reviewing without understanding context
Inputs required
- Pull request with code changes
- PR description explaining the why
- Linked ticket with context
- Test coverage (unit/integration tests)
Workflow
- Understand the Goal: Read the PR description and linked ticket FIRST. Understand WHY the change exists before reading code.
- Review Architecture: Check structural integrity and design. Does it fit the codebase? Are new dependencies justified? Is it the right abstraction level?
- Review Logic: Check for correct error handling, edge cases, off-by-one errors, and security implications.
- Check Tests: Verify new logic is covered by unit/integration tests that test actual behavior (not just code coverage).
- Consider Performance: Check for obvious performance issues (N+1 queries, memory leaks, synchronous blocking in async code).
- Provide Feedback: Leave comments that explain the WHY. Differentiate between blocking requests and suggestions (use "Nit:" or "Note:").
- Be Constructive: Phrase feedback as questions when possible ("Have you considered...?"). Assume positive intent.
Rules
- MUST assume positive intent; critique the code, not the author
- MUST automate style and formatting checks via Linters/Formatters (do NOT argue over spacing in PR)
- MUST approve immediately if code improves the codebase, even if not perfect
- MUST provide context and links when referring to standards or patterns
- MUST distinguish between blocking requests and optional suggestions
- MUST NOT block on personal coding style preferences
- MUST NOT require unrelated changes (keep scope focused)
Anti-patterns
- Gatekeeping: Blocking PRs over personal style preferences or "I would have done it differently"
- Rubber Stamping: Approving large PRs without reading or thinking
- Scope Creep: Asking the author to fix unrelated legacy code nearby
- Vague Comments: "This is bad" or "Improve this" without explanation
- Late Requests: Requesting major architectural changes after code is already implemented
- Tone Issues: Comments that feel dismissive or condescending
Failure conditions
- PR blocked without clear explanation
- Security or correctness issue missed
- No tests for new logic
- Feedback based on personal preference, not code quality
- Author feels disrespected or attacked
Validation checklist
Output format
- Feedback structure: Problem + context + suggestion
- Tone: Constructive, curious, respectful
- Clarity: Blocking requests vs. optional suggestions clearly marked
- Actionability: Comments are specific and actionable
- Decision: Clear approval, changes requested, or comment
Security considerations
- Security issues MUST be flagged as blocking
- SQL injection, XSS, authentication bypasses MUST be caught
- Secrets/credentials MUST NEVER be committed (catch before merge)
- Permission checks MUST be enforced
- Data exposure MUST be reviewed
Agent execution notes
- Agent MAY: Leave constructive feedback, ask clarifying questions, suggest improvements
- Agent MUST NEVER: Block on style/preference, be dismissive, miss security issues, approve without reading
- Agent MUST ASK: When context is missing, when architectural impact is unclear
- Agent MUST VALIDATE: Tests are present, no security holes, code improves codebase
Example
❌ Anti-pattern (Vague, dismissive, scope creep):
"This code is bad"
"Why are you doing it this way?"
"Also, can you fix the bug in the file next to this?"
"Blocked - needs improvement"
"LGTM" (without reading)
✅ Correct pattern (Constructive, specific, respectful):
✅ Good catch on the edge case - this prevents the race condition we had in production.
💭 Question: In the validateEmail function, what happens if the email service is down?
Have you considered adding a timeout or fallback behavior?
🔒 Security: Double-check that user input is sanitized before the database query.
📝 Nit: This comment could be clearer - what does "process the thing" mean?
✅ The test coverage looks good. I especially like the edge case tests.
🚀 Approved! This is a clear improvement to the codebase. Nice work.
1---2name: code-review-guidelines3description: When asynchronously reviewing peer code before merging into the main branch.4license: MIT5---67# Code Review Guidelines89## Purpose10Code review catches bugs, ensures maintainability, and builds team knowledge. This skill provides a structured, objective, empathetic framework for reviewing code without causing friction. The goal is to improve the codebase while growing the team.1112## When to use13- Evaluating a Pull Request or Merge Request14- Providing constructive feedback to peers15- Ensuring code quality and architectural standards are met16- Building new team members' skills through feedback1718## When NOT to use19- Nitpicking personal coding style (use linters/formatters)20- Blocking on subjective preferences21- Reviewing without understanding context2223## Inputs required24- Pull request with code changes25- PR description explaining the why26- Linked ticket with context27- Test coverage (unit/integration tests)2829## Workflow301. **Understand the Goal**: Read the PR description and linked ticket FIRST. Understand WHY the change exists before reading code.312. **Review Architecture**: Check structural integrity and design. Does it fit the codebase? Are new dependencies justified? Is it the right abstraction level?323. **Review Logic**: Check for correct error handling, edge cases, off-by-one errors, and security implications.334. **Check Tests**: Verify new logic is covered by unit/integration tests that test actual behavior (not just code coverage).345. **Consider Performance**: Check for obvious performance issues (N+1 queries, memory leaks, synchronous blocking in async code).356. **Provide Feedback**: Leave comments that explain the WHY. Differentiate between blocking requests and suggestions (use "Nit:" or "Note:").367. **Be Constructive**: Phrase feedback as questions when possible ("Have you considered...?"). Assume positive intent.3738## Rules39- MUST assume positive intent; critique the code, not the author40- MUST automate style and formatting checks via Linters/Formatters (do NOT argue over spacing in PR)41- MUST approve immediately if code improves the codebase, even if not perfect42- MUST provide context and links when referring to standards or patterns43- MUST distinguish between blocking requests and optional suggestions44- MUST NOT block on personal coding style preferences45- MUST NOT require unrelated changes (keep scope focused)4647## Anti-patterns48- **Gatekeeping**: Blocking PRs over personal style preferences or "I would have done it differently"49- **Rubber Stamping**: Approving large PRs without reading or thinking50- **Scope Creep**: Asking the author to fix unrelated legacy code nearby51- **Vague Comments**: "This is bad" or "Improve this" without explanation52- **Late Requests**: Requesting major architectural changes after code is already implemented53- **Tone Issues**: Comments that feel dismissive or condescending5455## Failure conditions56- PR blocked without clear explanation57- Security or correctness issue missed58- No tests for new logic59- Feedback based on personal preference, not code quality60- Author feels disrespected or attacked6162## Validation checklist63- [ ] PR description explains the why (not just what)64- [ ] Tests cover new logic65- [ ] No obvious performance issues66- [ ] Error handling is correct67- [ ] Edge cases are considered68- [ ] Security implications reviewed (if applicable)69- [ ] Code follows established patterns in the codebase70- [ ] Dependencies are justified71- [ ] Comments explain complex logic72- [ ] No scope creep (focused on this change)7374## Output format75- **Feedback structure**: Problem + context + suggestion76- **Tone**: Constructive, curious, respectful77- **Clarity**: Blocking requests vs. optional suggestions clearly marked78- **Actionability**: Comments are specific and actionable79- **Decision**: Clear approval, changes requested, or comment8081## Security considerations82- Security issues MUST be flagged as blocking83- SQL injection, XSS, authentication bypasses MUST be caught84- Secrets/credentials MUST NEVER be committed (catch before merge)85- Permission checks MUST be enforced86- Data exposure MUST be reviewed8788## Agent execution notes89- Agent MAY: Leave constructive feedback, ask clarifying questions, suggest improvements90- Agent MUST NEVER: Block on style/preference, be dismissive, miss security issues, approve without reading91- Agent MUST ASK: When context is missing, when architectural impact is unclear92- Agent MUST VALIDATE: Tests are present, no security holes, code improves codebase9394## Example9596**❌ Anti-pattern (Vague, dismissive, scope creep):**97```98"This code is bad"99"Why are you doing it this way?"100"Also, can you fix the bug in the file next to this?"101"Blocked - needs improvement"102"LGTM" (without reading)103```104105**✅ Correct pattern (Constructive, specific, respectful):**106```107✅ Good catch on the edge case - this prevents the race condition we had in production.108109💭 Question: In the validateEmail function, what happens if the email service is down?110 Have you considered adding a timeout or fallback behavior?111112🔒 Security: Double-check that user input is sanitized before the database query.113114📝 Nit: This comment could be clearer - what does "process the thing" mean?115116✅ The test coverage looks good. I especially like the edge case tests.117118🚀 Approved! This is a clear improvement to the codebase. Nice work.119```