From Topia
Pre-implementation red-team analysis. Use when a plan is high-risk, critical path, or expensive to reverse. Challenges plans before code is written — finds edge cases, security holes, scalability bottlenecks, error propagation risks, and integration conflicts. Catches flaws at plan time (10x cheaper than post-implementation).
How this skill is triggered — by the user, by Claude, or both
Slash command
/topia:adversaryThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Pre-implementation adversarial analysis. After a plan is approved but BEFORE code is written, adversary stress-tests the plan across 5 dimensions: edge cases, security, scalability, error propagation, and integration risk. It does NOT fix or redesign — it reports weaknesses so the plan can be hardened before implementation begins.
Pre-implementation adversarial analysis. After a plan is approved but BEFORE code is written, adversary stress-tests the plan across 5 dimensions: edge cases, security, scalability, error propagation, and integration risk. It does NOT fix or redesign — it reports weaknesses so the plan can be hardened before implementation begins.
This fills the only gap in the plan-to-ship pipeline: all other quality skills (review, preflight, sentinel) operate AFTER code exists. Catching a flaw in a plan costs minutes; catching it in implementation costs hours.
adversary MUST NOT approve a plan without at least one specific challenge per dimension analyzed. A report that says "plan looks solid" without concrete attack vectors is NOT a red-team analysis. Every finding MUST reference the specific plan section, file, or assumption it challenges.build Phase 2.5 — after plan approved, before Phase 3 (TEST)/topia adversary — manual red-team analysis of any plan or design document.topia/ or docs/plans/guardian (L2): deep security scan when adversary identifies auth/crypto/payment attack vectors in the planperf (L2): scalability analysis when adversary identifies potential bottleneck patternsrecon (L2): find existing code that might conflict with planned changesdocs-seeker (L3): verify framework/API assumptions in the plan are correct and currenthallucination-guard (L3): verify that APIs, packages, or patterns referenced in the plan actually existcontext-engine (L3): (oracle-mode) emit context.preview before bundle build to gate token costsession-bridge (L3): (oracle-mode) detach protocol when target model is opus-class for non-blocking dispatchbuild (L1): Phase 2.5 — after plan approval, before TDDplan (L2): optional post-step for critical featuresteam (L1): when decomposing large tasks, adversary validates the decompositiondebug (L2): (oracle-mode) listens to agent.stuck from debug after 3 disproved hypothesesfix (L2): (oracle-mode) listens to agent.stuck from fix after 2+ failed attemptsdocumentation (L2): reads adversary report for leadership risk summary/topia adversary direct invocationadversary ← build — plan produced → adversary challenges it → hardened plan feeds Phase 3adversary → guardian — security attack vector identified → sentinel validates depthadversary → perf — scalability concern raised → perf quantifies the bottleneckadversary → scout — integration risk flagged → scout finds affected codeadversary → plan — CRITICAL findings → plan revises before implementation.topia/features/<name>/plan.md, phase file, or user-specified path).topia/features/<name>/requirements.md from idea)scout to identify existing code files that the plan will touch or depend onChallenge the plan's handling of boundary conditions.
For each input/output/state transition in the plan, ask:
EDGE_CASE_TEMPLATE:
- Scenario: [specific edge case]
- Plan assumption: [what the plan assumes]
- Attack: [how this breaks]
- Impact: [what fails — data loss, crash, wrong result, security breach]
- Remediation: [1-sentence fix suggestion]
Analyze the plan for security weaknesses BEFORE any code exists.
If any auth, crypto, or payment logic is in the plan: MUST call topia:guardian for deep analysis.
SECURITY_TEMPLATE:
- Vector: [attack type — OWASP category if applicable]
- Entry point: [which part of the plan is vulnerable]
- Exploit scenario: [how an attacker would use this]
- Severity: CRITICAL | HIGH | MEDIUM
- Remediation: [what the plan should specify to prevent this]
Project the plan forward — what happens at 10x and 100x scale?
If bottleneck patterns detected: call topia:perf for quantitative analysis.
SCALE_TEMPLATE:
- Bottleneck: [what breaks at scale]
- Current plan: [what the plan specifies]
- At 10x: [what happens]
- At 100x: [what happens]
- Remediation: [what to add to the plan]
Trace failure paths through the planned system.
ERROR_TEMPLATE:
- Failure point: [where in the plan]
- Propagation: [what else breaks]
- User impact: [what the user experiences]
- Recovery: [how to get back to good state]
- Missing in plan: [what the plan should specify]
Check for conflicts with existing code and architecture.
topia:recon to find all files the plan will modify or depend onINTEGRATION_TEMPLATE:
- Conflict: [what clashes]
- Existing code: [file:line that would be affected]
- Plan assumption: [what the plan assumes about existing code]
- Reality: [what the existing code actually does]
- Remediation: [how to resolve the conflict]
Synthesize all findings into an actionable report.
Before reporting, apply rigor filter:
Verdict logic:
After reporting:
plan with findings attached as constraintsadversary.passed once remediations are acceptedadversary.passed so downstream skills (e.g. documentation) can package the hardened plan for stakeholders## Adversary Report: [feature/plan name]
- **Plan analyzed**: [path to plan file]
- **Dimensions checked**: [which of the 5 were relevant]
- **Findings**: [count by severity]
- **Verdict**: REVISE | HARDEN | PROCEED
### CRITICAL
- [ADV-001] [dimension]: [description with plan reference]
- Attack: [how this breaks]
- Remediation: [specific fix]
### HIGH
- [ADV-002] [dimension]: [description with plan reference]
- Attack: [how this breaks]
- Remediation: [specific fix]
### MEDIUM
- [ADV-003] [dimension]: [description]
### Strength Notes
- [what the plan does well — adversary is harsh but fair]
### Verdict
[Summary: why REVISE/HARDEN/PROCEED, what to do next]
All 5 dimensions analyzed. Used for new features, architectural changes, security-sensitive plans.
Skip Steps 3-4 (scalability, error propagation). Focus on edge cases, security, and integration. Trigger: plan modifies < 3 files AND no auth/payment/data logic.
Steps 2 and 5 only (security + integration). Used when guardian requests adversarial pre-analysis.
Trigger: plan involves auth, crypto, payment, or user data handling.
Triggered by: agent.stuck signal — emitted by debug (after 3 disproved hypotheses) or fix (after 2+ failed attempts on the same file).
Purpose: Break confirmation-bias loops. The same agent that read auth.ts 3 times has formed a theory it cannot un-form. Oracle-mode dispatches a stateless second-model pass with explicit "no prior context" framing, breaking the semantic loop that scout's zoom-out mode (structural pivot) cannot.
When NOT to use:
debug or 2 attempts in fixProtocol:
context.preview to context-engine first; abort if action=blockreferences/context-bundle-format.md for exact formatoracle.dispatched signal; route via session-bridge detach if target model is opus-class (non-blocking).topia/oracle-pending/<id>.json if opus-classoracle.failed if all claims uncited)oracle.response carries the validated diagnosis, consumed by debug/fix to override or refine their current hypothesisBundle format (mandatory regex-validated):
[SYSTEM] You are Oracle, a focused one-shot problem solver. You have NO prior context — assume zero project knowledge. Cite file:line for every claim. Reject any claim you cannot ground in the provided files.
[USER] <agent stuck after N hypothesis cycles. What is the most likely root cause not yet considered?>
### File 1: <relative/path/to/file.ts>
<file content, normalized whitespace, max 4k chars per file>
### File 2: <...>
<...>
Hard caps:
... [truncated] marker)Response contract — Oracle reply MUST contain:
Replies failing this contract are rejected — oracle.failed emitted, primary agent continues without second opinion.
See references/oracle-mode.md for the full protocol and integration with debug/fix.
context.preview BEFORE building the bundle — abort if context-engine action=blockoracle.failed| Gate | Requires | If Missing |
|---|---|---|
| Plan Gate | A plan document exists (from plan skill or user-provided) | Cannot run — ask for plan first |
| Codebase Gate | Access to existing codebase (for integration checks) | Skip Step 5, note in report |
| Failure Mode | Severity | Mitigation |
|---|---|---|
| Over-challenging — nitpicking every line of the plan | HIGH | Rigor filter: only findings you can justify with specific references. Skip theoretical 3+ condition chains |
| False security alarms — flagging secure patterns as vulnerable | HIGH | Call sentinel for validation before reporting security findings as CRITICAL |
| Analysis paralysis — too many findings block all progress | MEDIUM | Max 3 CRITICAL + 5 HIGH. If more found, consolidate or prioritize top impact |
| Missing context — challenging plan without understanding existing codebase | HIGH | Step 0 MUST load existing code context via scout before challenging |
| Scope creep — reviewing existing code quality instead of plan quality | MEDIUM | Adversary reviews THE PLAN, not the codebase. Existing code is context only |
| Redundancy with review/preflight — duplicating post-implementation checks | MEDIUM | Adversary operates PRE-implementation only. Never run adversary on existing code |
| (oracle-mode) Bundle exceeds token cap — caller didn't pTopia | HIGH | Caller MUST run context.preview first; adversary fails fast with oracle.failed instead of silently truncating signal |
| (oracle-mode) Oracle reply has no citations — model improvised | CRITICAL | Reject reply with oracle.failed. Primary agent continues without second opinion (better than acting on hallucination) |
(oracle-mode) Loop: oracle reply triggers another agent.stuck | HIGH | Cap at 1 oracle dispatch per primary-agent stuck cycle. Subsequent stucks must escalate to user |
oracle.failed emitted with rejection reason| Artifact | Format | Location |
|---|---|---|
| Adversary Report | Markdown | inline (stdout) |
| Threat findings | Structured list (CRITICAL/HIGH/MEDIUM) | inline |
| Risk matrix per dimension | Table | inline |
| Verdict + remediation list | Markdown | inline |
| Hardened plan notes (if PROCEED) | Text | passed to build Phase 3 |
~4000-8000 tokens input (plan + codebase context), ~2000-3000 tokens output. Opus model for adversarial depth. Runs once per feature plan — high cost justified by preventing wasted implementation cycles.
Scope guardrail: adversary reviews THE PLAN only — never audits existing codebase quality or rewrites code.
npx claudepluginhub linenoize/topia --plugin topiaProvides behavioral guidelines to reduce common LLM coding mistakes, focusing on simplicity, surgical changes, assumption surfacing, and verifiable success criteria.
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.