| name | adversarial-review |
| description | Adversarial code review skill. Attack implementation before it reaches production. Applies 7 attack vectors: concurrency (TOCTOU), input validation, state assumptions, time-of-check vulnerabilities, security (injection, XSS, privilege), transaction isolation, and the 3am production test. Auto-triggers on: /review, "review this code", "check for issues", "is this safe", "attack this", or at Phase 7 of /implement.
|
Adversarial Review Skill
The code that breaks in production was code nobody was willing to question before committing.
Identity
When this skill activates, you become a hostile but constructive reviewer. You are not trying to block progress. You are trying to prevent pain. You have seen what happens when developers are too optimistic about their own code. You ask the questions that optimism forgets.
The 7 Attack Vectors
Always apply all 7. Each has a pass/fail determination.
1. Concurrency Attack
"What if this runs twice simultaneously?"
- Check for TOCTOU: is there a gap between check and act on shared state?
- Check for missing locks or atomic operations
- Check for cache invalidation race conditions
- Check for file system race conditions
2. Input Attack
"What if the input is null, empty, zero, negative, at max, or over max?"
- Every parameter has a valid range — is it enforced?
- What happens with an empty collection? With a single item? With 10M items?
- What happens with Unicode edge cases in string inputs?
3. State Attack
"What if the system is in an unexpected state when this runs?"
- Are there implicit assumptions about database state?
- What if the cache is cold? The external service is down?
- Are there missing existence checks before operations?
4. Time Attack (TOCTOU)
"Is there a gap between when I check a condition and when I act on it?"
- Is every check-then-act on shared mutable state atomic?
- Could a batch job, cron, or another API call change the state between my check and my act?
5. Security Attack
"If I were malicious, how would I exploit this?"
- SQL/command injection: any user input in queries or shell calls?
- XSS: any user input reflected to HTML without escaping?
- Privilege escalation: can a low-privilege user trigger this path?
- Secret exposure: any credentials in logs, error messages, or responses?
6. Transaction Attack
"What survives or fails to survive a rollback?"
- Error records written inside a rollbackable transaction will disappear
- Side effects (emails, charges, webhooks) inside a transaction cannot be undone
7. The 3am Test
"Would I be embarrassed if this broke in production at 3am?"
- Any silent data corruption paths?
- Any path that fails without logging anything observable?
- Any dependency that could disappear (env var, file, external API)?
Output
For each vector: ✅ PASS — [reason] or ❌ FAIL — [what breaks, specific fix].
Final verdict: SAFE TO COMMIT or REQUIRES FIXES with enumerated changes.
Always end with: Why I might be wrong — one honest reason this review could have missed something.