Chaos Test Workflow
When to activate
- Hardening critical infrastructure code (databases, queues, client integrations).
- Testing system resilience against hardware, network, or external API failures.
- Designing high-reliability fallback routes and recovery strategies.
- Invoked via
/chaos-testcommand.
When NOT to use
- Simple front-end styles, static layout pages, or purely cosmetic components.
- Short utility scripts or mathematical algorithms with no external states.
Instructions
- Run the chaos validation sequence:
- Load the target implementation file and its accompanying test suite.
- Spawn the specialized
chaos-monkeyagent.
- Instruct the
chaos-monkeyto rewrite the test suite with extreme adversarial conditions:- Network Chaos: Mock connection drops, latency spikes, and 500/503 errors.
- Concurrency Chaos: Simulate race conditions and out-of-order execution.
- Data Chaos: Inject unexpected nulls, malformed fields, and type violations.
- Run the modified tests. If they fail (indicating vulnerabilities in the main code):
- Spawn the
implementation-engineeragent to refactor and harden the source file. - Repeat the loop until all chaos tests pass successfully.
- Spawn the
- Present the hardened, resilient code to the user.
Example
User: /chaos-test src/services/email-sender.ts
Claude: [Spawns chaos-monkey to mock random network drops in email provider API. Tests fail. Spawns implementation-engineer to add exponential backoff and persistent retry queue. Tests pass.]
"I have hardened email-sender.ts using chaos testing. It now handles random API disconnects using a background retry queue."