reviewing-code-perfectly
Reviewing Code with PERFECT Methodology
Structured PR review applying 7 principles in strict priority order to maximize review value while reducing cognitive load. Based on Daniil Bastrich's PERFECT methodology.
Quick Start
reviewing-code-perfectly <PR-ID or PR-URL>
- Fetch PR data via
ghCLI - Analyze changes against each PERFECT principle in order
- Produce structured review with pass/fail per principle
Inputs
- PR ID (number): e.g.,
42 - PR URL: e.g.,
https://github.com/org/repo/pull/42
Workflow
Step 1: Gather PR Data
# Check out PR code into an isolated worktree
REVIEW_DIR=$(pr-review-worktree setup <PR-ID>)
# Get PR description, title, and metadata
gh pr view <PR-ID> --json title,body,files,additions,deletions,baseRefName,headRefName,url,state,reviewDecision
# Get the full diff
gh pr diff <PR-ID>
# List changed files
gh pr view <PR-ID> --json files --jq '.files[].path'
Step 2: Read Changed Files
For each changed file, read the full file from $REVIEW_DIR (not just the diff) to understand context. Use $REVIEW_DIR/<file-path> for all Read calls. Use Grep and Glob within $REVIEW_DIR to find related code when needed.
Step 3: Load Language Skills
Examine the file extensions of all changed files and load relevant language/framework skills for domain-specific review guidance. Use the language-skill-mapping to determine which skills apply.
For each matched skill, invoke it using the Skill tool so its domain expertise is available when applying the PERFECT principles. If multiple languages are present, load all matching skills.
The loaded skills inform your review in several ways:
- Form: Language idioms, conventions, and anti-patterns
- Edge Cases: Language-specific gotchas (e.g., nil handling in Elixir, async pitfalls in TypeScript)
- Reliability: Language-specific performance and security patterns
- Clarity: Naming conventions and code organization standards for the language
- Evidence: Language-specific testing patterns and coverage expectations
Step 4: Apply PERFECT Principles
Evaluate the PR against each principle in strict priority order. Stop and report blocking issues at the earliest principle that fails critically. Later principles still get reviewed but are lower priority.
For detailed guidance on each principle, see perfect-principles.md.
Priority order:
- Purpose — Does the code solve the stated task?
- Edge Cases — Are edge cases handled?
- Reliability — No performance or security issues?
- Form — Aligns with design principles?
- Evidence — Tests pass and cover changes?
- Clarity — Code communicates intent clearly?
- Taste — Personal preferences (non-blocking only)
Step 5: Check CI/Test Status
# Check CI status
gh pr checks <PR-ID>
# If tests can be run locally
# Identify test command from project config and run relevant tests
Step 6: Produce Review Output
Step 7: Clean Up Worktree
pr-review-worktree cleanup "$REVIEW_DIR"
Output Format
# PERFECT Review: PR #<ID> — <PR Title>
**PR**: <URL>
**Author**: <author>
**Base**: <base-branch> <- <head-branch>
**Files changed**: <count> (+<additions> -<deletions>)
---
## 1. Purpose
**Verdict**: PASS | FAIL | NEEDS DISCUSSION
<Understanding of the task from PR description/linked ticket>
<How the implementation approaches the task>
<Any gaps between task requirements and implementation>
### Findings
- **[file:line]**: <finding with reasoning>
---
## 2. Edge Cases
**Verdict**: PASS | CONCERN | FAIL
### Findings
- **[file:line]**: <edge case description, why it matters, proposed handling>
---
## 3. Reliability
**Verdict**: PASS | CONCERN | FAIL
### Findings
- **[file:line]**: <performance or security concern with reasoning>
---
## 4. Form
**Verdict**: PASS | CONCERN | FAIL
### Findings
- **[file:line]**: <design principle concern with concrete argument and alternative>
---
## 5. Evidence
**Verdict**: PASS | CONCERN | FAIL
<CI status, test coverage assessment>
### Findings
- **[file:line]**: <test gap or test quality issue>
---
## 6. Clarity
**Verdict**: PASS | CONCERN
### Findings
- **[file:line]**: <clarity issue with suggested improvement>
---
## 7. Taste
**Verdict**: N/A (non-blocking)
### Suggestions (non-blocking)
- **[file:line]**: <personal preference, clearly marked as opinion>
---
## Summary
| Principle | Verdict |
|-----------|---------|
| Purpose | PASS/FAIL |
| Edge Cases | PASS/CONCERN/FAIL |
| Reliability | PASS/CONCERN/FAIL |
| Form | PASS/CONCERN/FAIL |
| Evidence | PASS/CONCERN/FAIL |
| Clarity | PASS/CONCERN |
| Taste | N/A |
**Recommendation**: APPROVE / REQUEST CHANGES / NEEDS DISCUSSION
**Key blocking issues** (if any):
1. <issue summary with file reference>
**Top suggestions** (non-blocking):
1. <suggestion summary>
Guidelines
Feedback Quality
- Describe clearly what is wrong and why
- Support every finding with concrete arguments
- Propose alternatives (at least at a high level)
- Never use vague statements like "this is bad" or "this could be better"
- Distinguish blocking issues from non-blocking suggestions
Review Ethos
- Just because you would write it differently does not mean it is bad
- Focus on constructive, actionable feedback
- Code review is about the code, not the author
- Taste items are explicitly non-blocking — the author may decline them
- Never approve with just "LGTM" — always demonstrate understanding of the changes
Scope Boundaries
- Review only code changes in the PR diff
- Skip generated files (lock files, compiled output, snapshots)
- Skip binary assets
- Do not review project process or team conventions — focus on the code
Severity Levels
| Level | Meaning | Blocks merge? |
|---|---|---|
| FAIL | Critical issue — bugs, security, task not solved | Yes |
| CONCERN | Significant issue — should fix, risks if not | Depends on context |
| PASS | No issues found for this principle | No |
| N/A | Not applicable (used for Taste) | No |
More from bnadlerjr/dotfiles
slicing-elephant-carpaccio
Breaks features into ultra-thin vertical slices using Elephant Carpaccio methodology. Use when planning new features, breaking down epics, slicing work across layers, or when a task spans multiple components. Produces an ordered backlog of thin slices, each independently working, testable, and demoable. Handles single-repo, monorepo, and multi-repo architectures.
14receiving-code-review
Guides technical evaluation of code review feedback before implementation. Use when receiving PR comments, review suggestions, GitHub feedback, or when asked to address reviewer feedback. Emphasizes verification and reasoned pushback over blind agreement.
13breaking-down-stories
Breaks down user stories into small, actionable tasks. Use when decomposing user stories, planning sprint work, creating task lists from tickets, or when the user mentions story breakdown, task decomposition, or sprint planning.
12mui
Material-UI component library patterns including sx prop styling, theme integration, responsive design, and MUI-specific hooks. Use when working with MUI components (@mui/material), styling with sx prop, theme customization, or MUI utilities. Supports v5, v6, and v7.
1applying-swiss-design
Applies Swiss/International Typographic Style principles to create clear, functional output. Use when designing interfaces, data visualizations, documentation, CLI output, or any output where clarity matters. Recognizes requests like "make it cleaner", "reduce clutter", "too busy", "improve readability", "visual hierarchy", "simplify the layout".
1coding-workflow
Use when user asks to build a feature, implement something new, or make significant code changes. Recognizes requests like "build", "implement", "create a new feature", "add functionality", "develop", "I need to build X", "let's implement", "new feature request", "make these changes". Orchestrates a four-stage workflow (Research → Brainstorm → Plan → Implement) using the appropriate thought pattern skill at each stage.
1