chaos-engineering
Introduces controlled failures to test and enhance system resilience in distributed environments.
What this skill does
# chaos-engineering
## Purpose
This skill enables OpenClaw to simulate failures in distributed systems, such as network partitions or pod kills, to identify weaknesses and improve resilience. It uses tools like Chaos Toolkit or similar integrations to inject faults programmatically.
## When to Use
Use this skill during system testing phases, before production releases, or in response to outages to validate resilience. Apply it in microservices architectures, cloud environments (e.g., Kubernetes), or when dealing with high-availability setups to ensure systems handle failures gracefully.
## Key Capabilities
- Inject faults like CPU stress, network latency, or pod evictions via CLI or API.
- Generate reports on system behavior post-failure, including metrics like recovery time.
- Support for custom experiments defined in YAML configs, e.g., specifying targets and durations.
- Integration with monitoring tools to correlate faults with real-time metrics.
- Automated rollback of experiments to restore original state.
## Usage Patterns
To run a chaos experiment, first define a configuration file, then execute via CLI. For API usage, authenticate and send requests to trigger events. Always run in a staging environment first. Pattern: Prepare config → Inject fault → Monitor effects → Analyze results. For repeated tests, use loops in scripts to vary parameters like duration or intensity.
## Common Commands/API
Use the OpenClaw CLI for chaos operations, requiring `$CHAOS_API_KEY` for authentication. Example CLI command:
```
ocla chaos inject --type network-latency --duration 30s --target pod=myapp-123 --key $CHAOS_API_KEY
```
API endpoint: POST to `/api/v1/chaos/experiments` with JSON body:
```
{ "experiment": "network-partition", "targets": ["service:db"], "duration": 60 }
```
Config format (YAML snippet):
```
apiVersion: chaos.openclaw/v1
kind: Experiment
spec:
type: cpu-stress
percentage: 80
```
To stop an experiment: `ocla chaos stop --id exp-456 --key $CHAOS_API_KEY`.
## Integration Notes
Integrate with Kubernetes by setting up a Chaos Engine operator; add annotations to deployments for auto-discovery. For monitoring, link with Prometheus via webhooks: e.g., export metrics to `/metrics` endpoint. Use environment variables for secrets, like `export CHAOS_API_KEY=your-key`. In code, import as a module:
```
import openclaw.chaos as oc
oc.inject_fault(type='pod-kill', target='app-pod')
```
Ensure compatibility with CI/CD tools by wrapping commands in scripts, e.g., in Jenkins: `sh 'ocla chaos inject ...'`.
## Error Handling
Check for errors like invalid targets or authentication failures; use try-catch in scripts. Example snippet:
```
try:
ocla chaos inject --type pod-kill --target invalid-pod --key $CHAOS_API_KEY
except subprocess.CalledProcessError as e:
print(f"Error: {e} - Check pod existence and API key")
```
Common issues: Rate limits (wait and retry), permission denials (verify RBAC), or experiment timeouts (set via `--timeout 120s`). Log all outputs and use `--dry-run` flag to preview actions without executing.
## Concrete Usage Examples
1. **Test Kubernetes pod resilience**: To simulate a pod failure in a staging cluster, run: `ocla chaos inject --type pod-kill --target deployment/myapp --duration 10s --key $CHAOS_API_KEY`. Then, verify recovery by checking pod status with `kubectl get pods` and analyze logs for downtime.
2. **Inject network latency for API testing**: For a microservice, create a config file and execute: `ocla chaos run --config path/to/experiment.yaml --key $CHAOS_API_KEY`. The YAML might look like: `spec: type: network-latency delay: 500ms`. Monitor with integrated tools to measure response times before and after.
## Graph Relationships
- Related to: devops-sre (cluster), monitoring (for fault analysis), deployment (for targeting systems), fault-injection (tag overlap).
- Connected via: resilience (tag), distributed-systems (embedding hint), enabling workflows with chaos-engineering and testing skills.
Related in Code Review
gstack
IncludedFast headless browser for QA testing and site dogfooding. Navigate pages, interact with elements, verify state, diff before/after, take annotated screenshots, test responsive layouts, forms, uploads, dialogs, and capture bug evidence. Use when asked to open or test a site, verify a deployment, dogfood a user flow, or file a bug with screenshots. (gstack)
startup-due-diligence
IncludedLegal due diligence review for seed-stage and Series A startups (US, Delaware C-Corp focus). Supports both investor and founder perspectives. Capabilities include: (1) Interactive document review and issue spotting; (2) Document request list generation; (3) Cap table and SAFE/convertible note analysis; (4) Red flag identification with severity ratings; (5) Diligence report generation. TRIGGERS: due diligence, DD, startup investment, cap table review, Series A, seed round, investor diligence, legal review startup, SAFE analysis, convertible note, 409A, founder vesting.
interview-master
IncludedThis skill should be used when the user asks to "generate interview questions", "prepare for interview", "optimize resume", "conduct mock interview", "analyze git commits for resume", "generate resume from code", "review my resume", or mentions interview preparation, career assistance, or extracting project experience from git history. Provides comprehensive interview and career development guidance for both job seekers and interviewers.
fix-issue
IncludedFixes GitHub issues using parallel analysis agents for root cause investigation, code exploration, and regression detection. Reads issue context from gh CLI, searches codebase and memory for related patterns, generates a fix with tests, and links the resolution back to the issue via PR. Includes prevention analysis to avoid recurrence. Use when debugging errors, resolving regressions, fixing bugs, or triaging issues.
sf-apex
IncludedGenerates and reviews Salesforce Apex code with 150-point scoring. TRIGGER when: user writes, reviews, or fixes Apex classes, triggers, test classes, batch/queueable/schedulable jobs, or touches .cls/.trigger files. DO NOT TRIGGER when: LWC JavaScript (use sf-lwc), Flow XML (use sf-flow), SOQL-only queries (use sf-soql), or non-Salesforce code.
swift-development
IncludedComprehensive Swift development for building, testing, and deploying iOS/macOS applications. Use when Claude needs to: (1) Build Swift packages or Xcode projects from command line, (2) Run tests with XCTest or Swift Testing framework, (3) Manage iOS simulators with simctl, (4) Handle code signing, provisioning profiles, and app distribution, (5) Format or lint Swift code with SwiftFormat/SwiftLint, (6) Work with Swift Package Manager (SPM), (7) Implement Swift 6 concurrency patterns (async/await, actors, Sendable), (8) Create SwiftUI views with MVVM architecture, (9) Set up Core Data or SwiftData persistence, or any other Swift/iOS/macOS development tasks.