running-chaos-tests

Execute chaos engineering experiments to test system resilience. Use when performing specialized testing. Trigger with phrases like "run chaos tests", "test resilience", or "inject failures".

1,868 stars

Best use case

running-chaos-tests is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Execute chaos engineering experiments to test system resilience. Use when performing specialized testing. Trigger with phrases like "run chaos tests", "test resilience", or "inject failures".

Teams using running-chaos-tests should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/running-chaos-tests/SKILL.md --create-dirs "https://raw.githubusercontent.com/jeremylongshore/claude-code-plugins-plus-skills/main/plugins/testing/chaos-engineering-toolkit/skills/running-chaos-tests/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/running-chaos-tests/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How running-chaos-tests Compares

Feature / Agentrunning-chaos-testsStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Execute chaos engineering experiments to test system resilience. Use when performing specialized testing. Trigger with phrases like "run chaos tests", "test resilience", or "inject failures".

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# Chaos Engineering Toolkit

## Overview

Execute controlled chaos engineering experiments to test system resilience, fault tolerance, and recovery capabilities. Injects failures including network latency, service crashes, resource exhaustion, and dependency outages to verify that systems degrade gracefully and recover automatically.

## Prerequisites

- Distributed system or microservice architecture deployed in a staging/test environment
- Monitoring and alerting configured (Grafana, Datadog, CloudWatch, or Prometheus)
- Rollback capability for the target environment (manual or automated)
- Chaos engineering tool installed (toxiproxy, Pumba, Litmus, or Chaos Mesh)
- Explicit approval from the team to run chaos experiments
- Steady-state hypothesis defined (what "healthy" looks like in metrics)

## Instructions

1. Define the steady-state hypothesis:
   - Identify measurable indicators of normal system behavior (e.g., p99 latency < 500ms, error rate < 0.1%, all health checks pass).
   - Record baseline metrics before injecting any failures.
   - Define the blast radius -- which services and users are affected by the experiment.
2. Design chaos experiments by category:
   - **Network**: Inject latency (200-2000ms), packet loss (5-50%), DNS failure, connection timeout.
   - **Process**: Kill a service instance, exhaust CPU or memory, fill disk.
   - **Dependency**: Block access to database, cache, or external API.
   - **State**: Corrupt data, introduce clock skew, simulate split-brain scenarios.
3. Start with minimal impact and increase gradually:
   - Begin with read-only experiments (network latency on non-critical path).
   - Progress to service-level failures (kill one instance of a multi-instance service).
   - Only move to data-level chaos after infrastructure chaos is validated.
4. Execute each experiment with safeguards:
   - Set a maximum experiment duration (5-15 minutes).
   - Configure automatic rollback triggers (error rate > 5% triggers abort).
   - Monitor system metrics in real-time during the experiment.
   - Have a manual kill switch ready (script to remove all injected failures immediately).
5. Observe and record system behavior during the experiment:
   - Did circuit breakers activate? How quickly?
   - Did auto-scaling trigger? How long until new instances were healthy?
   - Did retries succeed? Were they idempotent?
   - Did fallback mechanisms engage (cached responses, degraded mode)?
   - Were alerts triggered? Did on-call receive notification?
6. After the experiment, verify full recovery:
   - Remove all injected failures.
   - Verify steady-state hypothesis holds again within expected recovery time.
   - Check for data inconsistencies or orphaned state.
7. Document findings and create action items for resilience improvements.

## Output

- Chaos experiment definition files (YAML or JSON) with hypothesis, method, and rollback
- Experiment execution log with timeline of injected failures and observed effects
- System behavior report covering circuit breakers, retries, fallbacks, and alerts
- Recovery timeline showing time-to-detection and time-to-recovery
- Action items for resilience improvements (retry policies, circuit breaker tuning, fallback additions)

## Error Handling

| Error | Cause | Solution |
|-------|-------|---------|
| Experiment caused production outage | Blast radius larger than expected or missing safeguards | Always run in staging first; reduce scope; add automatic abort triggers; require approval |
| System did not recover after experiment | Auto-healing mechanisms not configured or too slow | Add health-check-based restarts; configure auto-scaling; implement circuit breaker patterns |
| Monitoring missed the failure | Alerting thresholds too lenient or wrong metrics monitored | Tighten alert thresholds; add specific alerts for the failure mode tested; verify alert channels |
| Chaos tool cannot access target | Network segmentation or security policies blocking the tool | Deploy chaos agent inside the target network; add security group rules for the chaos controller |
| Data corruption persists after rollback | Stateful failure injection without transaction protection | Use read-only chaos first; snapshot databases before stateful experiments; implement compensating transactions |

## Examples

**toxiproxy network latency injection:**
```bash
set -euo pipefail
# Create a proxy for the database connection
toxiproxy-cli create postgres_proxy -l 0.0.0.0:15432 -u postgres-host:5432  # 15432: PostgreSQL port

# Inject 500ms latency
toxiproxy-cli toxic add postgres_proxy -t latency -a latency=500 -a jitter=100  # HTTP 500 Internal Server Error

# Run tests while latency is active
npm test -- --grep "handles slow database"

# Remove the toxic
toxiproxy-cli toxic remove postgres_proxy -n latency_downstream
```

**Kubernetes pod kill experiment (Litmus Chaos):**
```yaml
apiVersion: litmuschaos.io/v1alpha1
kind: ChaosEngine
metadata:
  name: api-pod-kill
spec:
  appinfo:
    appns: default
    applabel: "app=api-server"
  chaosServiceAccount: litmus-admin
  experiments:
    - name: pod-delete
      spec:
        components:
          env:
            - name: TOTAL_CHAOS_DURATION
              value: "60"
            - name: CHAOS_INTERVAL
              value: "10"
            - name: FORCE
              value: "true"
```

**Custom chaos script (process kill and verify recovery):**
```bash
#!/bin/bash
set -euo pipefail
echo "=== Chaos Experiment: API server kill ==="
echo "Hypothesis: System recovers within 30 seconds"

# Record baseline
BASELINE=$(curl -s -o /dev/null -w '%{http_code}' http://app.test/health)
echo "Baseline health: $BASELINE"

# Kill one API instance
docker kill api-server-1

# Monitor recovery
for i in $(seq 1 30); do
  STATUS=$(curl -s -o /dev/null -w '%{http_code}' --max-time 2 http://app.test/health)
  echo "T+${i}s: HTTP $STATUS"
  if [ "$STATUS" = "200" ]; then  # HTTP 200 OK
    echo "RECOVERED at T+${i}s"
    break
  fi
  sleep 1
done
```

## Resources

- Principles of Chaos Engineering: https://principlesofchaos.org/
- toxiproxy: https://github.com/Shopify/toxiproxy
- Litmus Chaos: https://litmuschaos.io/
- Chaos Mesh (Kubernetes): https://chaos-mesh.org/
- Pumba (Docker chaos): https://github.com/alexei-led/pumba
- Netflix Chaos Engineering: https://netflixtechblog.com/tagged/chaos-engineering

Related Skills

generating-unit-tests

1868
from jeremylongshore/claude-code-plugins-plus-skills

Test automatically generate comprehensive unit tests from source code covering happy paths, edge cases, and error conditions. Use when creating test coverage for functions, classes, or modules. Trigger with phrases like "generate unit tests", "create tests for", or "add test coverage".

managing-snapshot-tests

1868
from jeremylongshore/claude-code-plugins-plus-skills

Create and validate component snapshots for UI regression testing. Use when performing specialized testing. Trigger with phrases like "update snapshots", "test UI snapshots", or "validate component snapshots".

running-smoke-tests

1868
from jeremylongshore/claude-code-plugins-plus-skills

Execute fast smoke tests validating critical functionality after deployment. Use when performing specialized testing. Trigger with phrases like "run smoke tests", "quick validation", or "test critical paths".

tracking-regression-tests

1868
from jeremylongshore/claude-code-plugins-plus-skills

Track and manage regression test suites across releases. Use when performing specialized testing. Trigger with phrases like "track regressions", "manage regression suite", or "validate against baseline".

running-performance-tests

1868
from jeremylongshore/claude-code-plugins-plus-skills

Execute load testing, stress testing, and performance benchmarking. Use when performing specialized testing. Trigger with phrases like "run load tests", "test performance", or "benchmark the system".

running-mutation-tests

1868
from jeremylongshore/claude-code-plugins-plus-skills

Execute mutation testing to evaluate test suite effectiveness. Use when performing specialized testing. Trigger with phrases like "run mutation tests", "test the tests", or "validate test effectiveness".

running-integration-tests

1868
from jeremylongshore/claude-code-plugins-plus-skills

Execute integration tests validating component interactions and system integration. Use when performing specialized testing. Trigger with phrases like "run integration tests", "test integration", or "validate component interactions".

running-e2e-tests

1868
from jeremylongshore/claude-code-plugins-plus-skills

Execute end-to-end tests covering full user workflows across frontend and backend. Use when performing specialized testing. Trigger with phrases like "run end-to-end tests", "test user flows", or "execute E2E suite".

managing-database-tests

1868
from jeremylongshore/claude-code-plugins-plus-skills

Test database testing including fixtures, transactions, and rollback management. Use when performing specialized testing. Trigger with phrases like "test the database", "run database tests", or "validate data integrity".

running-load-tests

1868
from jeremylongshore/claude-code-plugins-plus-skills

Create and execute load tests for performance validation using k6, JMeter, and Artillery. Use when validating application performance under load conditions or identifying bottlenecks. Trigger with phrases like "run load test", "create stress test", or "validate performance under load".

running-clustering-algorithms

1868
from jeremylongshore/claude-code-plugins-plus-skills

Analyze datasets by running clustering algorithms (K-means, DBSCAN, hierarchical) to identify data groups. Use when requesting "run clustering", "cluster analysis", or "group data points". Trigger with relevant phrases based on skill purpose.

generating-end-to-end-tests

1868
from jeremylongshore/claude-code-plugins-plus-skills

This skill enables Claude to generate end-to-end (E2E) tests for web applications. It leverages Playwright, Cypress, or Selenium to automate browser interactions and validate user workflows. Use this skill when the user requests to "create E2E tests", "generate end-to-end tests", or asks for help with "browser-based testing". The skill is particularly useful for testing user registration, login flows, shopping cart functionality, and other multi-step processes within a web application. It supports cross-browser testing and can be used to verify the responsiveness of web applications on different devices.