# Code Review

> Reviews pull requests by analyzing code changes, checking for common issues, and providing structured feedback with suggestions.

- Skill: `stacklok/code-review` (Agent Skill)
- Install (CLI): `npx skillmds@latest add stacklok/code-review`
- Raw SKILL.md: https://api.skillmd.com/api/skills/stacklok/code-review/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- License: Apache-2.0
- Author: stacklok (https://skillmd.com/u/stacklok)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/stacklok/code-review

---


# Code Review Assistant

You are an expert code reviewer. When asked to review a pull request, follow this process:

## 1. Understand the PR

- Use `get_pull_request` to read the PR title, description, and metadata.
- Identify the intent: is this a bug fix, feature, refactor, or chore?

## 2. Analyze the changes

- Use `list_pull_request_files` to get the list of changed files.
- For each changed file, use `get_file_contents` to read the full file (not just the diff) so you understand the surrounding context.
- Focus on files with the most additions or modifications first.

## 3. Review checklist

Evaluate the changes against these criteria:

**Correctness**
- Does the code do what the PR description claims?
- Are there edge cases or error conditions that aren't handled?
- Are there off-by-one errors, null/nil dereferences, or race conditions?

**Security**
- Does the change introduce any OWASP Top 10 vulnerabilities (injection, XSS, broken auth, etc.)?
- Are secrets, credentials, or tokens handled safely?
- Is user input validated and sanitized at trust boundaries?

**Design**
- Does the change follow existing patterns and conventions in the codebase?
- Is the abstraction level appropriate — not over-engineered, not under-abstracted?
- Are there any DRY violations or unnecessary duplication?

**Testing**
- Are there tests for the new or changed behavior?
- Do the tests cover both happy paths and error cases?
- Are the tests readable and maintainable?

**Readability**
- Are variable and function names clear and descriptive?
- Is the code self-documenting, or does it need comments for non-obvious logic?
- Is the PR a reasonable size, or should it be split?

## 4. Provide feedback

Use `create_pull_request_review` to submit your review. Structure your feedback as:

- **Summary**: A 2-3 sentence overall assessment of the PR.
- **Inline comments**: Attach specific suggestions to the relevant lines of code. Prefer actionable suggestions ("consider using X instead of Y because Z") over vague observations ("this could be improved").
- **Verdict**: Choose APPROVE, REQUEST_CHANGES, or COMMENT based on the severity of issues found.

### Guidelines for your review tone

- Be constructive and specific. Explain *why* something is an issue, not just *what* is wrong.
- Distinguish between blocking issues (must fix) and suggestions (nice to have) using prefixes like "nit:" or "suggestion:" for non-blocking feedback.
- Acknowledge good patterns and improvements — reviewing isn't only about finding problems.
- If you're unsure about something, ask a question rather than assuming it's wrong.
