agentleFS
cogine-aicogine-ai/cogine-dev-skillset/skills/investigate/SKILL.md

investigate

Skill4 starsChanged 5 months agoApache-2.0View on GitHub

Systematic root-cause debugging. Use when: diagnosing bugs, investigating failures, debugging flaky tests, tracing unexpected behavior. Triggers on: '/investigate', 'debug this', 'why is this failing', 'find the root cause', 'flaky test'.

74 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use document-release, design-consultation and 8 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • AICreator-WindSkill

    document-release

    技术作家工具。更新项目文档。

    Also in 9 projects that use this

  • AICreator-WindSkill

    design-consultation

    设计合作伙伴工具。构建完整设计系统,提供专业设计建议。

    Also in 10 projects that use this

  • ayudaySkill

    cso

    Chief Security Officer mode. Performs OWASP Top 10 audit, STRIDE threat modeling, attack surface analysis, auth flow verification, secret detection, dependency CVE scanning, supply chain risk assessment, and data classification review. Use when: "security audit", "threat model", "pentest review", "OWASP", "CSO review".

    Also in 7 projects that use this

  • ayudaySkill

    setup-deploy

    Configure deployment settings for /land-and-deploy. Detects your deploy platform (Fly.io, Render, Vercel, Netlify, Heroku, GitHub Actions, custom), production URL, health check endpoints, and deploy status commands. Writes the configuration to CLAUDE.md so all future deploys are automatic. Use when: "setup deploy", "configure deployment", "set up land-and-deploy", "how do I deploy with gstack", "add deploy config".

    Also in 7 projects that use this

  • Kit4SomeSkill

    unfreeze

    Also in 8 projects that use this

  • CodeWithBehnamSkill

    setup-browser-cookies

    Import cookies from your real browser (Comet, Chrome, Arc, Brave, Edge) into the headless browse session. Opens an interactive picker UI where you select which cookie domains to import. Use before QA testing authenticated pages.

    Also in 7 projects that use this

  • +1 more from ayuday
  • +3 more from AICreator-Wind

The file

Show its rules and text

We split this skill into the rules it gives an agent

16 rules. 0 are common, 16 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 64 edited versions we read keep these.

  • 16

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Read the full error message/stack trace

    line 20
  2. Distinctive:

    Check if there are related error reports or failing tests

    line 23
  3. Distinctive:

    Write down the exact reproduction steps

    line 29
  4. Distinctive:

    If intermittent: identify the variable (timing, data, concurrency, environment)

    line 31
  5. Distinctive:

    Use binary search thinking:

    line 35
  6. Distinctive:

    Use the polluter-finding approach:

    line 64
  7. Distinctive:

    Run the failing test in isolation — does it pass?

    line 66
  8. Distinctive:

    If yes: another test is polluting shared state

    line 67
  9. Distinctive:

    STOP: Do not try a 4th fix.

    line 93
  10. Distinctive:

    Ask: "What assumption am I making that could be wrong?"

    line 95
  11. Distinctive:

    Consider: is this an architectural issue, not a bug?

    line 96
  12. Distinctive:

    No drive-by refactoring during bug fixes

    line 116
  13. Distinctive:

    Write a test that fails with the bug present

    line 121
  14. Distinctive:

    Verify the test passes

    line 123
  15. Distinctive:

    Run the full test suite — no regressions

    line 124
  16. Distinctive:

    After fix is applied, output:

    line 128

“Common” is measured: kept by at least 6 in 10 of the 64 edited versions of this file we could read. “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

Systematic Debugging

Four-phase scientific method for root-cause analysis. Integrates with slow-is-fast reasoning principles.

Iron Law: No fix without verified root cause. Never say "this should fix it."

Phase 1: Root Cause Investigation

1.1 Collect Symptoms

Gather all available evidence before forming any hypothesis:

  • Read the full error message/stack trace
  • Identify when it started (check git log --oneline -20 for recent changes)
  • Determine reproduction conditions (always? intermittent? environment-specific?)
  • Check if there are related error reports or failing tests

1.2 Reproduce

A bug you can't reproduce is a bug you can't fix.

  • Write down the exact reproduction steps
  • Confirm you can trigger the failure consistently
  • If intermittent: identify the variable (timing, data, concurrency, environment)

1.3 Narrow the Scope

Use binary search thinking:

  • Bisect in time: git log --oneline — when did it last work?
  • Bisect in space: Which module/layer? Add strategic logging or assertions
  • Bisect in data: Which inputs trigger it? Minimal reproduction case

Output after Phase 1:

Root cause hypothesis: <one sentence>
Evidence: <what supports this>
Confidence: <low/medium/high>

Phase 2: Pattern Analysis

Match against known bug patterns before investigating from scratch:

PatternSignatureWhere to Look
Race conditionIntermittent, timing-dependent, "works on retry"Shared state, async operations, missing locks/awaits
Nil/null propagationCrash on property access, "undefined is not a function"Optional chaining gaps, missing null checks at boundaries
State corruptionWrong value at wrong time, stale dataMutable shared state, cache invalidation, stale closures
Integration failureWorks in isolation, fails in compositionAPI contract mismatch, version skew, env config
Config driftWorks locally, fails in CI/staging/prodEnvironment variables, feature flags, dependency versions
Stale cacheOld behavior persists after fix, "but I already changed that"Build cache, module cache, CDN, browser cache, ORM cache
Test pollutionTest passes alone, fails in suite (or vice versa)Shared global state, missing cleanup, execution order

For Flaky Tests

Use the polluter-finding approach:

  1. Run the failing test in isolation — does it pass?
  2. If yes: another test is polluting shared state
  3. Binary search the test suite to find the polluter:
    # Run first half of suite + failing test
    # If fails: polluter is in first half. Recurse.
    # If passes: polluter is in second half. Recurse.
  4. Once found: fix the shared state leak, don't just reorder tests

Phase 3: Hypothesis Testing

Scientific Method

For each hypothesis:

  1. Predict: "If hypothesis X is correct, then Y should be true"
  2. Test: Design a minimal experiment that confirms or refutes
  3. Observe: Record actual result — no interpretation yet
  4. Conclude: Does evidence support or refute? Update hypothesis

Single variable: Change only one thing per test. Multiple changes = uninterpretable results.

3-Strike Rule

After 3 failed hypotheses:

  • STOP. Do not try a 4th fix.
  • Reassess: you likely have the wrong mental model of the system
  • Ask: "What assumption am I making that could be wrong?"
  • Consider: is this an architectural issue, not a bug?
  • Present findings to user and ask for guidance

Red Flags (you're on the wrong track)

  • Fix works but you don't understand why
  • Fix requires touching 5+ files for a "simple" bug
  • You're adding workarounds instead of fixing root cause
  • The "fix" breaks something else

Phase 4: Implementation

Fix Root Cause, Not Symptoms

  • Wrong: Adding a null check where null shouldn't be possible
  • Right: Fixing the code path that produces null

Minimal Diff

  • Change only what's necessary for the fix
  • No drive-by refactoring during bug fixes
  • No "while I'm here" improvements

Regression Test

  1. Write a test that fails with the bug present
  2. Apply the fix
  3. Verify the test passes
  4. Run the full test suite — no regressions

Verification Report

After fix is applied, output:

## Debug Report

Symptom: <what was observed>
Root cause: <what actually caused it>
Evidence: <how we confirmed>
Fix: <what was changed and why>
Regression test: <test name/location>
Hypotheses tested: <N> (<list with outcomes>)
Confidence: <high — verified | medium — likely but edge cases possible>

Anti-Patterns

  • Shotgun debugging: Changing random things hoping something works
  • Fix-and-pray: Applying a fix without understanding the cause
  • Symptom patching: Hiding the bug instead of fixing it (e.g., try/catch swallowing errors)
  • Blame the framework: Assuming the bug is in a dependency before checking your own code
  • Stale hypothesis: Continuing to pursue a theory after evidence contradicts it
  • Over-logging: Adding 50 log statements instead of thinking about the problem

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.