skills/review-code/SKILL.md
Review current branch changes vs main. Use when user types /review-code or asks for a code review of their changes.
npx skillsauth add jamesc/skills review-codeInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
A three-pass code review that progressively deepens analysis. Each pass uses a different lens to catch issues the previous pass missed.
Key Philosophy: Complete improvements during review rather than deferring to future PRs. If something can be done well in <2 hours, implement it now. The goal is to ship excellent code the first time.
/review-code # Review current branch vs main
/review-code BT-123 # Find PR for Linear issue, checkout, review
/review-code #225 # Checkout PR #225, review
When a Linear issue or PR number is provided:
gh pr list --repo jamesc/beamtalk --search "BT-123" --json number,headRefNamegh pr checkout <number>Not every PR needs 3 passes. Auto-scale based on change size and type:
# Count changed lines (additions + deletions)
git --no-pager diff --shortstat $(git merge-base HEAD origin/main)..HEAD
| Change Size | Criteria | Passes | Rationale | |-------------|----------|--------|-----------| | Small | <50 lines changed, or docs/skills/config only | Pass 1 only | Surface review is sufficient | | Medium | 50-300 lines, touches 1-2 components | Pass 1 + Pass 2 | Cross-component checks needed | | Large | >300 lines, touches 3+ components, or new features | All 3 passes | Full review with adversarial |
Always run all 3 passes for:
| Component | Files | Risk |
|-----------|-------|------|
| REPL server | beamtalk_repl_server.erl, beamtalk_repl.erl | TCP listener, accepts connections, spawns per-client processes |
| REPL eval | beamtalk_repl_eval.erl | Compiles & executes user code, file I/O |
| Workspace persistence | beamtalk_workspace_meta.erl | Reads/writes files from user paths |
| Atom creation | beamtalk_object_class.erl, beamtalk_repl_eval.erl | list_to_atom from user input (DoS risk) |
| File path handling | beamtalk_repl_eval.erl, CLI file loading | Path traversal, unsanitized user paths |
| Process spawning | beamtalk_actor.erl, beamtalk_repl.erl | Resource exhaustion, unbounded process creation |
The user can override: /review-code --deep forces all 3 passes regardless of size.
The fast pass — read the diff line by line, catch surface issues.
Identify the base branch:
git fetch origin main
git merge-base HEAD origin/main
Get the diff and changed files:
git --no-pager diff --stat $(git merge-base HEAD origin/main)..HEAD
git --no-pager diff $(git merge-base HEAD origin/main)..HEAD
Review each changed file against the Review Guidelines below.
DDD compliance check: For each new or renamed module/type/function:
docs/beamtalk-ddd-model.md?Test coverage check:
tests/e2e/cases/*.bt)Implement fixes: For anything that can be done in <2 hours:
docs/beamtalk-ddd-model.md for new domain conceptsVerify tests pass after any changes:
just test
Pass 1 summary: Report findings using the severity levels (🔴🟡🔵✅).
Zoom out from the diff. Think about how these changes interact with the rest of the system.
Read surrounding code: For each changed file, read the unchanged code around it. Understand the full module, not just the diff:
# For each significantly changed file, read the whole thing
cat <file>
Cross-component analysis: Trace the data flow across component boundaries:
Edge case analysis: For each algorithm or logic change, systematically check:
Contract verification: Check that implicit contracts between layers are maintained:
#beamtalk_error{} consistently across codegen and runtimeState0, State1, etc.)Documentation cross-reference: Check if changes require updates to:
docs/beamtalk-language-features.md — language syntax changesdocs/beamtalk-architecture.md — system design changesdocs/beamtalk-ddd-model.md — domain model changesexamples/*.bt — new features need examplesAGENTS.md — workflow or convention changesImplement fixes from Pass 2 findings, re-run CI if changes made.
Use CodeRabbit AI and a different model family to challenge the design with fresh eyes.
Run CodeRabbit review (if the coderabbit:review plugin is installed):
Invoke the /coderabbit:review skill with committed --base main:
/coderabbit:review committed --base main
This runs the CodeRabbit CLI locally against committed changes and produces findings grouped by severity.
Launch adversarial model review using the task tool with a model from a different family than your own. If you're Claude, use GPT; if you're GPT, use Claude:
Launch via task with agent_type: "general-purpose" and model: "gpt-5.2-codex" (or model: "opus" if you're a GPT model):
You are a skeptical senior engineer reviewing a PR. Your job is to find
issues the original reviewer missed. Be adversarial but constructive.
Review this diff: <paste diff or key files>
Focus on:
1. ASSUMPTIONS: What assumptions is this code making that might not hold?
2. FUTURE FRAGILITY: What would break this in 6 months?
3. SCALING: If this codebase 10x'd, would this approach still work?
4. MISUSE: How could a user or developer misuse this?
5. TESTING GAPS: What scenarios aren't tested?
DO NOT comment on: style, formatting, naming conventions, or anything cosmetic.
ONLY flag issues that could cause bugs, data loss, or significant maintenance burden.
REPL verification (for user-facing changes only — skip for infra-only):
beamtalk repl:load examples/counter.btTriage findings from CodeRabbit and the adversarial review. For each:
Bug label + urgent priority. Never drop security findings.Final CI run if any changes were made in Pass 3:
just ci
(Use just test for quick iteration during the review; only run full just ci here at the final gate.)
Create follow-up issues: Anything found during review that isn't fixed in this PR must get a Linear issue — findings should never be just "noted" and forgotten.
Always create an issue for:
Bug + urgent priority. Never let security issues be silently dropped.Don't create issues for:
The bar for "fix it now" is still high — prefer implementing over deferring. But if you defer, track it.
Final summary:
## Code Review Summary
### Pass 1: Diff Review
- [x] Fixed: [description] (file:line)
- [x] Added: [tests/docs] for [feature]
- ✅ DDD compliance: [status]
### Pass 2: System Review
- [x] Fixed: [cross-component issue]
- [x] Verified: [contract between X and Y]
- ✅ Documentation: [updated/already current]
### Pass 3: Adversarial Review
- [x] Fixed: [assumption that was wrong]
- ⚠️ Noted: [theoretical concern, not acting]
- ✅ REPL verified: [what was tested]
### Issues Created
- 🔴 BT-XXX: [security finding — urgent]
- BT-YYY: [deferred improvement]
- BT-XXX: [only for substantial architectural work]
### Assessment
- **Ready to merge:** Yes/No
- **Strengths:** [key positive aspects]
- **Remaining concerns:** [any blocking issues]
Bug + urgent priority immediately.Follow CLAUDE.md Essential Rules, docs/agents/expanded.md, and docs/development/architecture-principles.md. Key checks:
docs/beamtalk-ddd-model.md)#beamtalk_error{} records, OTP logger, -spec declarations, license headers-D warnings, no unwrap() on user input, Document/docvec! for codegen:: annotationstools
Find the next logical piece of work. Use when user types /whats-next or asks what they should work on next, or wants recommendations for the next task.
development
Use when navigating code, finding references, looking up definitions, understanding types, or tracing call hierarchies in TypeScript, Rust, or Beamtalk (.bt) files. Prefer LSP over Grep/Glob for any navigation task where symbol semantics matter.
data-ai
Find and update Linear issues that need labels, blocking relationships, or metadata. Use when user says '/update-issues' with criteria like 'no labels', 'missing agent-ready', 'needs size', etc.
data-ai
Sync modified skills and agents back to the repo and create a PR. Use when user types /sync-skills or wants to save in-session skill improvements.