hanselman-code-review
Adversarial dual-model code review that runs two AI models in parallel, cross-references findings, and produces a consensus severity table with fix confidence ratings. Use when asked for a thorough code review, adversarial review, dual-model review, confidence-rated review, or 'Hanselman review'.
- License 许可
- MIT
- 最近更新
- 2026-11-14
- Stars
- ★ 2.2k
- Forks
- 349
01 前言 Front Matter
- name
- hanselman-code-review
- description
- Adversarial dual-model code review that runs two AI models in parallel, cross-references findings, and produces a consensus severity table with fix confidence ratings. Use when asked for a thorough code review, adversarial review, dual-model review, confidence-rated review, or 'Hanselman review'.
02 资源文件 2
- 许可证LICENSE.md1.0 KB
- 参考文档README.md2.1 KB
03 SKILL.md 正文
Hanselman Adversarial Code Review Skill
Run a rigorous, adversarial code review using two AI models in parallel. Cross-reference their findings to separate signal from noise, producing a consensus severity table with fix confidence ratings.
When to Use
Invoke this skill when the user asks for:
- A thorough or deep code review
- An adversarial review
- A dual-model review
- A "Hanselman review"
- A confidence-rated review
- Cross-model validation of code changes
Philosophy
Single-model reviews have blind spots. Two models reviewing independently surface different classes of issues: security, correctness, and edge cases. Cross-reference their findings:
- HIGH consensus (both models flag it): strong evidence; verify the issue.
- LOW consensus (only one model flags it): may be noise; use judgment.
- Disputed (a model flags it but evidence contradicts it): investigate before acting.
Review Workflow
Step 1: Identify the Scope
Determine what code to review:
- If the user specifies files, use those.
- If the user says "review my changes", use
git difforgit diff --staged. - For a PR, use
gh pr viewandgh pr diff, pinning the exact head and base. - For a branch, diff against the base branch.
Capture the exact reviewed head and base before building the reviewer prompt. After both reviews finish, re-read the live head. If it changed, mark the review stale and rerun both reviewers on the new revision rather than copying the old verdict forward.
For a repeat review, compare the current head with the previously reviewed head. Review changed code, affected callers/tests, and unresolved or disputed findings rather than automatically repeating the full review. If the code is unchanged and only the models changed, focus both reviewers on those findings and high-risk decisions. State the delta scope and retain missing runtime-proof gates.
Step 2: Launch Two Parallel Reviews
Launch two rubber-duck agents via the app-native task tool in background
mode with different models. No standalone model CLI is required.
Agent 1: Claude Opus 5.5
task({
name: "opus-review",
agent_type: "rubber-duck",
mode: "background",
model: "claude-opus-5.5",
reasoning_effort: "high",
prompt: "<full context + code + review instructions>"
})
Agent 2: GPT-6 Astra
task({
name: "astra-review",
agent_type: "rubber-duck",
mode: "background",
model: "gpt-6-astra",
context_tier: "long_context",
reasoning_effort: "high",
prompt: "<same context + code + review instructions>"
})
Both agents receive the exact same prompt so findings are comparable. Include the full file contents or diff, project context, exact revisions, constraints, and the severity definitions below.
Step 3: Wait for Both to Complete
Use the background interval for independent work. Wait for each completion
notification, then read its result with read_agent; do not poll. Reconcile
both completed reviews before publishing a consensus.
A completed Hanselman review requires valid output from both requested models on the same revision. If either reviewer fails, is unavailable, or returns an incomplete assessment, report the review as incomplete. Preserve any completed output as advisory evidence, but do not build a consensus table or substitute a different model without the user's approval.
Step 4: Cross-Reference and Build the Consensus Table
Create a SQL table to track findings:
CREATE TABLE IF NOT EXISTS review_findings (
id TEXT PRIMARY KEY,
issue TEXT NOT NULL,
opus_severity TEXT,
astra_severity TEXT,
consensus TEXT NOT NULL,
fix_confidence INTEGER NOT NULL
);
If the session already has a findings table, inspect and reuse or migrate its schema without discarding earlier findings. Record the actual model ID that produced each review; do not relabel earlier findings as results from a different model.
For each finding:
- Check whether the other model found the same or a similar issue.
- Assign consensus: both flagged it is
HIGH; one flagged it isLOW; evidence contradicting a finding isLOW (disputed). - Verify it against the actual code, dependency contract, and tests.
- Assign fix confidence:
- 99%: trivial fix, such as a wrong flag or missing null check.
- 90-95%: straightforward fix requiring some design thought.
- 70-80%: complex fix requiring research or trade-offs.
- Below 70%: hard problem, intentional behavior, or architecture change.
Step 5: Present the Results
State the exact reviewed head and base, actual model IDs, context tiers, and reasoning effort before the finding tables. Do not describe an incomplete or stale run as clean.
Both Models Agree: HIGH consensus
| Issue | Opus 5.5 | GPT-6 Astra | Fix Confidence |
|---|---|---|---|
| Description of issue | SEVERITY | SEVERITY | XX% |
Only One Model Flagged: LOW consensus
| Issue | Opus 5.5 | GPT-6 Astra | Fix Confidence |
|---|---|---|---|
| Description of issue | SEVERITY or not flagged | SEVERITY or not flagged | XX% |
Use not flagged when a model did not identify the issue.
Step 6: Act on Findings
- Ask which findings to fix unless the user has already authorized the fixes.
- Prioritize verified HIGH consensus issues.
- Explain one-model and disputed findings before acting.
- Do not broaden the task to satisfy a reviewer. Preserve the repository's scope and proof requirements.
- Fix confidence is the coordinator's assessment, not a model vote or a replacement for runtime proof.
Review Instructions Template
Give both reviewers the same adapted prompt:
Review the following code changes for [PROJECT NAME].
This is a [LANGUAGE/FRAMEWORK] project with these constraints: [CONSTRAINTS].
Exact head: [HEAD]. Base or previously reviewed head: [BASE].
Focus on bugs, security issues, race conditions, and correctness problems.
Ignore style and formatting.
Write every review comment in simplified technical English. Use short sentences
and common words, explain necessary technical terms, and avoid jargon or
unnecessary detail.
[FULL CODE OR DIFF HERE]
For each issue found, classify severity as:
- CRITICAL: will crash, corrupt data, or create a security vulnerability
- HIGH: likely bug that will manifest in real use
- MEDIUM: edge case that could bite in specific scenarios
- LOW: minor improvement, theoretical concern, or robustness enhancement
For each issue, include:
1. What the issue is
2. Where it is (file and line/region)
3. Why it matters (impact and reachability)
4. Suggested fix
Model Selection
The default pairing is Claude Opus 5.5 (claude-opus-5.5) and
GPT-6 Astra (gpt-6-astra, context_tier: "long_context"), both with
reasoning_effort: "high". Different model families provide independent
perspectives on the same evidence.
Use the tool's supported long_context value, not an invented model name or
model-name suffix. Do not assume a numeric context-window size. Preserve the
high reasoning default unless the user requests a different effort.
If a preferred model or context tier is unavailable, report the limitation and use an available alternative only with the user's approval. Record the actual model IDs and context tiers used; do not silently fall back to an older generation.
Important Notes
- Never skip cross-referencing. The value is in the comparison, not individual reviews.
- Both requested reviewers must complete on the same exact revision. One valid review plus one failure is not a dual-model verdict.
- Log disputed findings and the reasoning for accepting or rejecting them.
- Model output is advisory input. Verify every accepted finding against the actual code, tests, and dependency behavior before acting.
- Do not fix LOW consensus issues without user authorization.
- A clean source review does not satisfy a missing Windows proof pool, current-head UI proof, or required CI check.
04 同仓库更多 Skills
network-handoff
Use before generating, changing, or reviewing networking, IPC, or cross-process handoffs, including requests, retries, deadlines, reconnect, process launch, configuration apply, cancellation, and cleanup. Establish confirmation, identity, authority, reconciliation, and producer compatibility before implementation.
retrigger-flaky-ci
Triage failed CI on a pull request or the active branch, decide whether the failures come from its changes, and rerun only failures that are unrelated. Use when asked to retrigger, rerun, or kick CI on a PR with failing checks.
technical-documentation
Write, review, or restructure Windows node documentation and agent instructions using current source, task-focused explanations, and explicit fact preservation.
pr-simplify
Simplify your own Windows-node change to its smallest complete fix while preserving distinct regressions, platform contracts, and required proof. Use after implementation before PR preparation, after large repairs, or when asked to shrink a change or remove slop.
openclaw-testing
Choose proportional OpenClaw Windows node tests, builds, packaging checks, and runtime proof, then diagnose failures without weakening required gates.
openclaw-proof-validation
Plan and collect OpenClaw Windows validation/proof: tests, rubber-duck review, UI evidence, MCP output, and gateway runtime proof.