opencode/skills/adversarial-code-review/SKILL.md
Review code through hostile perspectives to find bugs, security issues, and unintended consequences the author missed. Use when reviewing PRs, auditing codebases, or before critical deployments.
npx skillsauth add third774/dotfiles adversarial-code-reviewInstall 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.
Core Principle: Review as if you're trying to break the code. Deliberately adopt hostile perspectives—each reveals issues the others miss.
This is not about finding fault. It's about finding problems before users do.
| Mode | Trigger | Focus | | -------------------------- | -------------------------------------- | ---------------------------------- | | Diff-Focused (default) | No explicit instruction, PR review | What changed? What could break? | | Audit | "audit", "holistic", "codebase review" | Broader scope, systematic coverage |
When in doubt, use diff-focused mode. Audit mode requires explicit request.
Review through each lens deliberately. Don't blend them—switching perspectives forces deeper analysis.
| Lens | Core Question | Reveals | | ----------------------- | ------------------------------------- | -------------------------------------------------------------- | | Malicious User | "How would I exploit this?" | Input validation gaps, injection vectors, privilege escalation | | Careless Colleague | "How would this break if used wrong?" | API misuse, unclear contracts, error handling gaps | | Future Maintainer | "What will confuse me in 6 months?" | Implicit assumptions, missing context, temporal coupling | | Ops/On-Call | "How will this fail at 3am?" | Observability gaps, recovery paths, failure modes | | Data Integrity | "What happens to state?" | Race conditions, partial failures, consistency violations | | Interaction Effects | "What does this change elsewhere?" | Unintended side effects, behavioral changes, contract breaks |
Assume the user is actively trying to break or exploit the system.
For deep security reviews, see references/security-lens-detail.md.
Assume another developer will use this code without reading documentation.
Assume you'll revisit this code in 6 months with no memory of writing it.
Assume this will fail in production at the worst possible time.
Assume multiple things will try to modify state simultaneously.
Assume this change has consequences beyond its immediate scope.
Copy this checklist when starting a review:
Adversarial Review Progress:
- [ ] Step 1: Determine mode (diff-focused or audit)
- [ ] Step 2: Understand the change/code purpose
- [ ] Step 3: Apply lenses (prioritize by risk, ~5 min each):
- [ ] Malicious User
- [ ] Careless Colleague
- [ ] Future Maintainer
- [ ] Ops/On-Call Engineer
- [ ] Data Integrity
- [ ] Interaction Effects
- [ ] Step 4: Filter findings through Impact Filter
- [ ] Step 5: Classify severity (Must Fix / Should Fix / Consider)
- [ ] Step 6: Limit "Consider" items to max 2
- [ ] Step 7: Identify at least one positive
- [ ] Step 8: Format report
Not all lenses are equally important for all code. Prioritize:
| Code Type | Priority Lenses | | -------------------- | --------------------------------------- | | User input handling | Malicious User, Data Integrity | | API/public interface | Careless Colleague, Interaction Effects | | Background jobs | Ops/On-Call, Data Integrity | | Business logic | Future Maintainer, Interaction Effects | | Database operations | Data Integrity, Ops/On-Call |
Severity matches actual risk, not theoretical worst-case
Every "Must Fix" requires demonstration or clear reasoning
Alternative suggestions are optional, not mandated
Acknowledge at least one thing done well
Every potential finding must pass this filter. Score 2+ to report:
□ Likely to occur (probability)
□ Impactful if it occurs (severity)
□ Non-obvious to the author (added value)
If a finding scores 0-1, don't report it. You're adding noise, not value.
| Tier | Definition | Action | Examples | | -------------- | ----------------------------------------------- | ------------------------------ | -------------------------------------------------------------- | | Must Fix | Breaks correctness, security, or data integrity | Block merge | SQL injection, race condition causing data loss, auth bypass | | Should Fix | Likely problems but not immediately broken | Fix before or soon after merge | Missing error handling, unclear naming, no tests for edge case | | Consider | Style, optimization, theoretical concerns | Max 2 per review | Could be more idiomatic, minor perf optimization |
Limit "Consider" comments to 2 maximum. More than that:
If you have many "Consider" items, pick the 2 most valuable and drop the rest.
The Test: "Would a reasonable senior engineer disagree with me here?"
If yes → Probably not worth commenting.
Structure findings clearly:
## Summary
[1-2 sentence overview of the review]
### What's Done Well
- [Specific positive observation]
### Must Fix
#### [Issue Title]
**Location:** `file.ts:45-52`
**Lens:** [Which lens found this]
**Issue:** [Clear description of the problem]
**Impact:** [What happens if not fixed]
**Suggestion:** [Optional - how to fix]
### Should Fix
[Same format as Must Fix]
### Consider
[Brief bullet points only - max 2 items]
Stop the review and escalate when:
| Trigger | Action |
| ----------------------------------------------- | ------------------------------------------------------------------ |
| Security-critical code (auth, crypto, payments) | See references/security-lens-detail.md, consider external review |
| 3+ "Must Fix" issues found | Stop reviewing. Escalate for fundamental redesign discussion. |
| You don't understand the code | Don't guess. Request walkthrough before reviewing. |
| Architectural concerns | Flag for design discussion, don't try to "fix" in review |
When explicitly requested to audit (not just review changes):
Before starting, clarify:
For large codebases, don't review everything. Sample strategically:
git log --since="3 months ago" --name-onlyAudit-Specific Steps:
- [ ] Define scope and primary concerns with requester
- [ ] Identify high-risk areas for focused review
- [ ] Sample strategically (don't boil the ocean)
- [ ] Track coverage (what was reviewed vs skipped)
- [ ] Note systemic patterns across multiple files
For systematic edge case generation by input domain, see references/edge-case-domains.md.
Don't start reviewing until you understand:
Reviewing without understanding produces shallow, unhelpful feedback.
Don't try to apply all lenses simultaneously. You'll miss things.
Do this:
Not this:
Not everything is critical. Reserve "Must Fix" for actual blockers.
If everything is urgent, nothing is urgent.
After applying all lenses, step back:
The goal isn't to find as many issues as possible. It's to find the issues that matter before they reach users.
Quality over quantity. Impact over volume. Trust over thoroughness.
data-ai
Extract captions and transcripts from YouTube videos for agent context. Tries manual subtitles, then auto-generated, then falls back to audio transcription via Whisper. Use when a user provides a YouTube URL and wants to understand, summarize, reference, or search video content.
tools
Official skill for XcodeBuildMCP. Use when doing iOS/macOS/watchOS/tvOS/visionOS work (build, test, run, debug, log, UI automation).
development
Write behavior-focused tests following Testing Trophy model with real dependencies, avoiding common anti-patterns like testing mocks and polluting production code. Use when writing new tests, reviewing test quality, or improving test coverage.
data-ai
Create professional Mermaid diagrams with proper styling and visual hierarchy. Use when creating flowcharts, sequence diagrams, state machines, class diagrams, or architecture visualizations.