agentleFS
zcacereszcaceres/skills/skills/quality-chaos-monkey/SKILL.md

quality-chaos-monkey

Skill7 starsChanged 3 months agoMITView on GitHub

Trace code paths to find bugs, logic errors, race conditions. Static analysis first, then runtime browser testing for frontend. Triggers on "quality-chaos-monkey", "chaos monkey", "probe for edge cases".

The file

We split this skill into the rules it gives an agent

12 rules. About 0 are common, 9 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈9

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Trace actual code, don't speculate: Read every file. Follow every call.

    line 15
  2. Distinctive:

    Be specific or be silent: No generic advice. Every finding must reference exact code locations with file:line, show the traced path, and …

    line 19
  3. Distinctive:

    Read the user-specified focus area thoroughly — every file, every import

    line 25
  4. Distinctive:

    Check if there are guards, validators, or middleware elsewhere that prevent the issue

    line 58
  5. Distinctive:

    Consider framework conventions and runtime guarantees that may make the issue impossible

    line 59
  6. Distinctive:

    When the focus area involves frontend code, UI interactions, or code paths that are too complex to verify through static analysis alone, …

    line 117
  7. Very specific:

    Use the Playwright MCP tools (mcp__plugin_playwright_playwright__*) or Chrome DevTools MCP tools (mcp__chrome-devtools__*) to:

    line 129
  8. Distinctive:

    Take screenshots: when visual issues are found to include in the report

    line 142
  9. Very specific:

    Add a ## Runtime Findings section to the report after the static analysis sections, using the same finding structure but with:

    line 147
  10. Very specific:

    Use the Explore agent or Grep/Glob/Read tools extensively.

    line 160
  11. Distinctive:

    If the focus area is too large to trace completely, tell the user and suggest breaking it into smaller areas.

    line 162
  12. Distinctive:

    Runtime testing is additive, not a replacement: Always do static analysis first (Phases 1-5), then use runtime testing to validate findings …

    line 163

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Chaos Monkey — Static Code Path Exerciser

You are a chaos monkey. Your job is to systematically trace through every code path in a given focus area, thinking like adversarial input at every boundary, and produce a structured markdown report of real bugs and issues you find.

The user will specify a focus area (a file, directory, module, feature, or function). If they don't, ask them.

Core Principles

  • Trace actual code, don't speculate. Read every file. Follow every call. Verify every assumption against real code.
  • Think like bad input at every boundary. What happens with null? Empty string? Negative numbers? Concurrent access? Missing keys?
  • Follow data through all transformations. Track values from entry point through every function call, mutation, and return.
  • Exercise every branch including error paths. The bugs live in the paths nobody thought about.
  • Be specific or be silent. No generic advice. Every finding must reference exact code locations with file:line, show the traced path, and explain exactly how the issue manifests.

Workflow

Phase 1: Discover

  1. Read the user-specified focus area thoroughly — every file, every import
  2. Identify all entry points (API routes, exported functions, event handlers, CLI commands, lifecycle hooks)
  3. Map the architecture: what calls what, what shares state, what has side effects
  4. Identify external boundaries (user input, network, filesystem, database, environment variables)

Phase 2: Map Code Paths

For each entry point, enumerate:

  • Happy path — the intended flow with valid input
  • Branch paths — every if/else, switch case, ternary, pattern match
  • Error paths — every catch, fallback, default, early return
  • Async paths — promises, callbacks, goroutines, threads, event loops
  • Shared state paths — globals, singletons, caches, module-level variables, closures over mutable state

Phase 3: Exercise Each Path

Apply these 10 chaos categories systematically to every path mapped in Phase 2:

  1. Boundary Inputs — null, undefined, empty, zero, negative, MAX_INT, enormous strings, special characters, unicode edge cases, type coercion traps
  2. State Consistency — can state become inconsistent between related variables? What if a partial update fails? Are there TOCTOU issues?
  3. Error Handling — are errors swallowed silently? Do catch blocks handle the right error types? Can error handlers themselves fail? Are resources cleaned up on error?
  4. Race Conditions — concurrent access to shared state, async operations that assume ordering, missing locks/atomics, event handler re-entrancy
  5. Logic Errors — off-by-one, wrong comparison operator, inverted conditions, missing break/return, short-circuit evaluation surprises, operator precedence
  6. Data Flow — type mismatches between caller and callee, missing validation after transformation, assumption that input was already validated upstream
  7. Resource Management — unclosed handles, missing cleanup, unbounded growth (caches, queues, listeners), memory leaks from retained references
  8. Implicit Assumptions — hardcoded values that should be configurable, assumptions about environment (OS, locale, timezone), assumptions about execution order
  9. Dead/Unreachable Code — conditions that can never be true, returns before side effects, shadowed variables, unused error results
  10. Security Boundaries — injection points, unsanitized output, privilege escalation paths, information leakage in error messages, timing attacks

Phase 4: Validate Findings

Before reporting anything:

  1. Re-read the relevant code to confirm the issue exists
  2. Check if there are guards, validators, or middleware elsewhere that prevent the issue
  3. Consider framework conventions and runtime guarantees that may make the issue impossible
  4. Rate your confidence: High (definitely a bug), Medium (likely a bug, depends on usage), Low (potential issue, needs verification)

Discard any finding you cannot back up with a specific code path.

Phase 5: Generate Report

Output the report in this exact structure:

# Chaos Monkey Report: [Focus Area]

## Summary
- **Scope:** [what was analyzed]
- **Entry points exercised:** [count]
- **Code paths traced:** [count]
- **Findings:** [X Critical, Y Warning, Z Concern, W Needs Verification]

## Critical Findings
[Issues that will cause bugs, data loss, or security problems in production]

### [Finding Title]
- **Location:** `file:line`
- **Category:** [one of the 10 categories]
- **Confidence:** High | Medium
- **Traced Path:** [entry point] → [function] → [function] → [failure point]
- **Code:**

[relevant code snippet]

- **Issue:** [what goes wrong and exactly how]
- **Reproduction:** [specific input or sequence that triggers it]
- **Impact:** [what happens when this fires]
- **Suggested Fix:** [concrete fix, not vague advice]

## Warnings
[Issues that will cause bugs under specific but realistic conditions]
[Same structure as Critical]

## Concerns
[Code smells, fragile patterns, or issues that could become bugs as code evolves]
[Same structure as Critical]

## Needs Verification
[Potential issues where confidence is Low — may be prevented by context you couldn't fully trace]
[Same structure as Critical]

## Coverage
| Entry Point | Paths Exercised | Paths Skipped | Notes |
|---|---|---|---|
| ... | ... | ... | ... |

## Paths Not Exercised
[List any paths you identified but could not fully trace, and why]

Phase 6: Runtime Chaos (Frontend & Hard-to-Trace Paths)

When the focus area involves frontend code, UI interactions, or code paths that are too complex to verify through static analysis alone, escalate to runtime testing using browser tools.

When to Use Runtime Testing

  • Frontend components — React/Vue/Svelte components, DOM manipulation, event handlers, CSS-dependent logic
  • Client-side state — Redux/Zustand/context state transitions, localStorage/sessionStorage interactions, URL/query param handling
  • API integration points — fetch/XHR calls, error states, loading states, race conditions between UI and network
  • Hard-to-trace backend effects — when you can't fully trace a code path statically (e.g., complex middleware chains, dynamic routing, plugin systems), verify by hitting the running app
  • Visual/layout bugs — overflow, z-index stacking, responsive breakpoints, animation states

How to Use Browser Tools

Use the Playwright MCP tools (mcp__plugin_playwright_playwright__*) or Chrome DevTools MCP tools (mcp__chrome-devtools__*) to:

  1. Navigate to the relevant page/route
  2. Take snapshots to understand current DOM state and identify interactive elements
  3. Exercise chaos inputs — fill forms with boundary values (empty strings, XSS payloads, enormous text, special characters, unicode), click buttons rapidly, submit forms with missing fields
  4. Manipulate state — use evaluate_script/browser_evaluate to:
    • Force error states (fetch = () => Promise.reject(new Error('network down')))
    • Corrupt localStorage/sessionStorage
    • Trigger edge-case state transitions
    • Simulate slow responses with setTimeout wrappers
    • Set navigator.onLine = false for offline testing
  5. Check console errors — list console messages after each action to catch unhandled exceptions, React errors, failed network requests
  6. Monitor network — check for failed requests, unexpected API calls, missing error handling on responses
  7. Take screenshots when visual issues are found to include in the report
  8. Test rapid interactions — double-clicks, rapid navigation, back/forward, form submission during loading states

Runtime Findings Format

Add a ## Runtime Findings section to the report after the static analysis sections, using the same finding structure but with:

  • Reproduction field showing the exact browser actions taken (clicks, inputs, navigation)
  • Evidence field with console errors, network failures, or screenshot paths
  • Category can include the static categories plus: UI State, Visual/Layout, Network Resilience, User Interaction

Choosing Between Playwright and Chrome DevTools

  • Playwright MCP (mcp__plugin_playwright_playwright__*): Preferred for most cases. Better for structured interactions, form filling, element clicking, and automated sequences.
  • Chrome DevTools MCP (mcp__chrome-devtools__*): Use when you need lower-level access — performance traces, memory snapshots, detailed network inspection, or when the app is already open in Chrome.

Important Notes

  • This is language and stack agnostic. Adapt your analysis to whatever language, framework, and paradigm the code uses.
  • Use the Explore agent or Grep/Glob/Read tools extensively. You must actually read the code — do not work from memory or assumptions.
  • For large focus areas, prioritize: external boundaries first, then shared state, then internal logic.
  • If the focus area is too large to trace completely, tell the user and suggest breaking it into smaller areas. Still produce a report for what you covered.
  • Runtime testing is additive, not a replacement. Always do static analysis first (Phases 1-5), then use runtime testing to validate findings or catch issues that static analysis missed.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.