Prompt file imported from dagarre00/claude-code-template (
.claude/commands/project/adversary.md). Fill in{{arguments}}before use. Copyright stays with the author.
/project:adversary
Argument: {{arguments}}
The argument sets what gets reviewed (step 1):
- Base ref (
develop,against main,HEAD~3) → review<ref>...HEAD. - Lens (
concurrency only,error handling) → an emphasis added to the full 8-category sweep (never a narrowing of it), noted in the report.
A leading fast or handoff sets the dispatch mode (subagent-dispatch § Dispatch mode) and is stripped first. Empty → standard sweep over the unshipped change.
State at invocation
Branch: !git branch --show-current
git status --short
You run an adversarial diff review using finding-disposition § Diff round. The read-only adversary raises findings using adversarial-review; you dispose of them.
Preconditions
- A non-empty diff exists (dirty tree, unreviewed branch commits, or
<ref>...HEAD). - On a
feat/*,fix/*, orchore/*branch — or ondeveloponly for a release review (against main), whose approved fixes cut afix/<slug>branch in step 3.
Steps
-
Scope the review to the whole cycle — one review per cycle, never one per case:
- Base ref →
<ref>...HEAD. - Dirty tree → account for every path (rule 21), commit on the current branch (
wip: <what> — for adversary reviewif not a finished case), and review<sha-before>...HEAD. - Clean tree with unreviewed commits →
<sha-before-cycle>..HEAD, where<sha-before-cycle>is the commit just before the cycle's first case commit (itsdocs(<slug>): plan reviewcommit when there is one).
- Base ref →
-
Dispatch
adversarypersubagent-dispatchwith the commit range, entity slug(s), case IDs, test command fromdocs/wiki/commands.md, and optional lens — never the plan,.handoff/, or intent summary. Verifygit diff --stat <range>is non-empty first. -
Dispose of every finding per
finding-disposition § Diff round: Filed by default, Fixed only for human-approvedcritical/majoritems (via a singlehuman-checkpointand adeveloperdispatch per fix), or Rejected with a one-sentence reason. Optionally dispatchtriagefor a second opinion. Each round commitsdocs(<slug>): adversary round Nwith--allow-empty, stagingdocs/wiki/todos.md.- Release review fix: never commit code on
develop. Cutfix/<slug>(feature-branching § Starting work) before dispatchingdeveloperfor an approved fix, complete the review and round commits there, and open a PR todevelopviapr-create.
- Release review fix: never commit code on
-
Re-review only if a fix landed, over the fix commits alone (max 3 rounds).
-
Log, commit and push per
log-and-commit.md— kindadversary, fieldsCommit reviewed,Findings: <N> (<C> critical, <M> major, <m> minor),Disposition: <Fi> filed, <Fx> fixed, <R> rejected. Stagedocs/wiki/log.mdin the final round's commit (the round no re-review follows), never in an earlier one, so a re-review's range never carries it. -
Report findings by severity (leading with any
critical/majorfiled rather than fixed), queued todo locations, approved fixes, and rejections with reasons.
Failure modes
- No findings and no
Checked:line → re-dispatch once demanding it. - Adversary modifies files or git state → void round, restore tree, report.
- Finding contradicts the entity spec → Reject citing the Behavior case, or recommend
/project:interviewif the spec is wrong. - Open findings at round 3 cap → gate/file
critical/major, listminor/nitas unfiled (reason: round cap), and stop.
What you do NOT do
- No adversary edits and no author context in the brief.
- No whole-repo audit (out-of-diff issues go under
## Out of scope). - No merging or PRs (except a release review's
fix/*PR in step 3).
