بنقرة واحدة
adversarial-review
// Rigorous code review of completed implementation before committing. Use for features, refactors, and critical-path changes — not trivial changes (this is expensive).
// Rigorous code review of completed implementation before committing. Use for features, refactors, and critical-path changes — not trivial changes (this is expensive).
Build Ruby CLI tools with Thor and Zeitwerk. Use for new Ruby CLI gems, adding commands, refactoring, or 'Thor CLI', 'command-line tool in Ruby'.
Read, send input to, or spawn other tmux panes, windows, and sessions - including agents (Claude Code, Codex), REPLs, and TUIs running in them. Use when the user references another pane, window, or agent.
Convert markdown to PDF using Chrome. Triggers on 'markdown to pdf', 'render to pdf', 'pdf from markdown', 'print this markdown'.
Fetch secrets and create/manage 1Password items via CLI. Use when needing API keys, tokens, or credentials, or storing new secrets. Ask for the op://Vault/Item/field reference, not the secret itself.
Assess and improve codebase architecture via layered analysis and guided restructuring. Triggers on architecture review, structural assessment, design patterns, modularity, coupling, framework alignment.
Write clean, modular bash scripts with proper error handling. Triggers on 'write a script', 'bash script', 'shell script', or 'automate with bash'.
| name | adversarial-review |
| description | Rigorous code review of completed implementation before committing. Use for features, refactors, and critical-path changes — not trivial changes (this is expensive). |
| argument-hint | [files/dirs] [--pr] |
Automated critique-fix loop using fresh-eyes reviewer subagents. Each round, a new subagent reviews the code cold — no knowledge of why decisions were made, no attachment to the implementation. The main agent fixes Critical and Suggestion findings, then a fresh reviewer checks again. Loop stops when only Nitpicks remain or after 3 rounds.
implement → /simplify → /adversarial-review → /finalize → commit/simplify + /finalize instead/code-review insteadParse $ARGUMENTS to determine what to review:
git diff and git diff --cached to get staged + unstaged changes--pr flag: review the full branch diff — run git diff main...HEAD (try master if main doesn't exist)If the diff is empty, tell the user there's nothing to review and stop.
Before dispatching the reviewer, collect two things:
Collect the diff based on the input mode above. This is what the reviewer will critique.
Search the project for convention docs the reviewer should know about. Look for:
project/guides/, docs/, .cursor/rules/, AGENTS.md.rubocop.yml, .eslintrc.*, .prettierrc, standardrb config, etc.)Budget: Keep convention context to ~5K tokens. Include CLAUDE.md files and lint configs. Do NOT include full implementation guides, feature docs, or READMEs — the reviewer is reviewing code quality, not feature completeness. If convention material exceeds the budget, prioritize CLAUDE.md files first, then lint configs.
Use the Agent tool to spawn a reviewer:
subagent_type: general-purposedescription: "Adversarial code review — round N"prompt: the full reviewer prompt below, with {conventions} and {diff} replaced with the actual contentYou are a senior developer doing a cold code review. You have never seen this
code before. You have no context on why decisions were made. You did not write
any of this. Review with completely fresh eyes.
## Project Conventions
{conventions}
## Code to Review
{diff}
## Review Criteria
Be opinionated. Review for:
- **Correctness:** bugs, logic errors, edge cases, race conditions
- **Security:** injection, auth bypass, data exposure, OWASP top 10
- **DRY:** duplicated logic that should be extracted
- **Modularity:** classes/methods doing too much, unclear boundaries
- **Testability:** code that's hard to test, missing test coverage
- **Simplicity:** over-engineering, unnecessary abstractions, premature generalization
- **Architecture:** does it conform to the project's established patterns and conventions?
- **Naming:** unclear or misleading names
- **Error handling:** swallowed errors, missing edge cases
## Output Format
Return findings as a list. Each finding MUST have:
- **Severity:** Critical | Suggestion | Nitpick
- **Location:** file path and line range
- **Issue:** what's wrong
- **Fix:** specific, concrete recommendation
Severity definitions:
- **Critical** = bugs, security issues, data loss risk, broken functionality
- **Suggestion** = improvements that meaningfully affect quality, maintainability, or conformance
- **Nitpick** = style preferences, minor naming quibbles, cosmetic issues
Be thorough but honest about severity. Don't inflate Nitpicks to Suggestions.
If the code is solid, say so — an empty findings list is a valid result.
When the reviewer subagent returns:
Use your judgment. If a finding is wrong or would break something, skip it and note why. The reviewer has fresh eyes but lacks your conversation context — you know things it doesn't.
After applying fixes:
Present a summary when done:
## Adversarial Review Complete
**Rounds:** N of 3
**Result:** [Clean — only nitpicks remain | Capped — N issues remain after 3 rounds]
### Round 1
- [Critical] file.rb:12-15 — description (FIXED)
- [Suggestion] file.rb:30 — description (FIXED)
- [Nitpick] file.rb:45 — description
### Round 2
- [Nitpick] file.rb:32 — description
### Remaining Nitpicks
- file.rb:45 — description
- file.rb:32 — description
If the first round returns no findings at all, report that the code passed clean and stop.
/simplify + /finalize instead.