agentleFS
christyjacob4christyjacob4/claude-tricks/skills/investigate/SKILL.md

investigate

Skill2 starsChanged 9 months agoMITView on GitHub

Deep investigation of bugs, performance issues, or unexpected behavior. TRIGGER THIS SKILL when users report bugs, errors, performance regressions, unexpected behavior, or ask to investigate, debug, diagnose, or find the root cause of any issue — whether they say "why is this broken", "investigate this bug", "find the root cause", "debug this issue", "this is failing and I don't know why", "performance degraded", or share error messages and stack traces. Do NOT trigger for feature requests, code reviews, refactoring, or general code questions.

74 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use qa-only, document-release and 10 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

    qa-only

    纯 QA 报告工具。只生成 bug 报告,不修复。

    Also in 10 projects that use this

  • AICreator-WindSkill

    document-release

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

    Also in 9 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

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

The file

We split this skill into the rules it gives an agent

6 rules. 0 are common, 5 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 64 edited versions we read keep these.

  • 5

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Wait for both agents to complete.

    line 47
  2. Distinctive:

    Wait for all four agents to complete.

    line 109
  3. Distinctive:

    Wait for all hypothesis agents to complete.

    line 136
  4. Very specific:

    Wait for both agents to complete.

    line 219
  5. Distinctive:

    Create the smallest possible test case that reproduces the issue.

    line 234
  6. Distinctive:

    IMPORTANT: If any tests fail during investigation, they must be fixed.

    line 241

“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

Deep Investigation

Thorough investigation of issues with root cause analysis and recommendations.

OUTPUT: Detailed report with findings, root cause, and recommendations.

Arguments

  • $ARGUMENTS - Issue description, error message, or area to investigate

Phase 1: Define the Problem (Parallel: Hypotheses + Data Gathering)

Launch two parallel agents immediately. Both can work simultaneously since forming hypotheses from the issue description is independent from gathering raw data.

Agent 1 - Hypotheses Formation:

Analyze the issue description: $ARGUMENTS

Form 3-5 ranked hypotheses about what might be causing this issue. For each hypothesis, state:

  • The suspected cause
  • Why this is plausible given the symptoms
  • What evidence would confirm or refute it

Return a numbered list of hypotheses with supporting reasoning.

Agent 2 - Data Gathering:

Gather all available data about: $ARGUMENTS

Collect in parallel where possible:

  • Error messages and stack traces (search logs, output files, CI artifacts)
  • Recent changes to affected areas (git log --oneline -30 -- path/to/affected/)
  • Related issues or discussions (search issue trackers if available)
  • Current state of affected code paths (read the relevant source files)
  • Environment and configuration state

Return all raw findings organized by category.

Wait for both agents to complete. Combine their outputs to form the investigation plan for Phase 2.

Phase 2: Evidence Collection (Parallel: 4 Independent Agents)

Launch four parallel agents, one per evidence dimension. These are completely independent investigations that share no dependencies.

Agent 1 - Code Analysis:

Investigate the code paths related to: $ARGUMENTS

Using the hypotheses: [insert hypotheses from Phase 1]

Analyze:

  • All code paths involved in the issue (read source files, trace call chains)
  • Recent changes to affected areas (git log -p --since="2 weeks ago" -- path/to/affected/)
  • Dependencies and their versions
  • Integration points between components
  • Any relevant design patterns or architectural decisions that could contribute

For each hypothesis, note which code evidence supports or contradicts it. Return detailed code-level findings with exact file paths and line numbers.

Agent 2 - Log and Error Analysis:

Analyze logs and error output related to: $ARGUMENTS

Search for:

  • Error patterns matching the reported symptoms (use Grep across log files)
  • Timestamp correlations (what happened before, during, and after the error)
  • Frequency and distribution of errors
  • Stack traces and their common frames
  • Warning messages that might indicate preconditions

Return a timeline of events and all error patterns found, with file locations.

Agent 3 - Test Behavior:

Investigate test behavior related to: $ARGUMENTS

Perform:

  • Run existing tests for affected areas and capture results
  • Write a minimal exploratory test that attempts to reproduce the issue
  • Check test coverage of the affected code paths
  • Look for flaky tests or tests with known issues in the affected area
  • Try to create the smallest possible reproduction case

Return test results, reproduction status, and any newly written test code.

Agent 4 - External Factors:

Investigate external factors related to: $ARGUMENTS

Check:

  • Database state and schema (if applicable)
  • Third-party service status and API changes
  • Configuration differences between working and broken environments
  • Environment variables and their values
  • Infrastructure or platform changes (OS updates, dependency updates, CI changes)
  • Network conditions or connectivity issues

Return all external factor findings, noting which factors changed recently.

Wait for all four agents to complete. Merge all evidence into a unified evidence set.

Phase 3: Root Cause Analysis (Parallel: Hypothesis Testing)

Launch one parallel agent per hypothesis from Phase 1. Each agent independently evaluates a single hypothesis against the full evidence set from Phase 2.

For each hypothesis, launch an agent:

Evaluate hypothesis: "[Hypothesis N description]"

Against collected evidence: [Insert merged evidence from Phase 2]

Perform:

  1. List all evidence that supports this hypothesis
  2. List all evidence that contradicts this hypothesis
  3. Attempt to definitively prove or disprove it (run targeted commands, read specific code, write a focused test)
  4. If the code path can be traced, follow it from entry point through data transformations, decision points, to exit/error point
  5. Rate confidence: HIGH / MEDIUM / LOW with justification

Distinguish between:

  • Proximate cause: The immediate trigger
  • Root cause: The underlying issue
  • Contributing factors: Things that made it worse

Return: verdict (confirmed/refuted/inconclusive), confidence level, all supporting evidence, and the causal chain if confirmed.

Wait for all hypothesis agents to complete. Select the hypothesis with the strongest evidence as the root cause. If multiple hypotheses are confirmed, determine whether they are independent issues or parts of the same causal chain.

Phase 4+5: Documentation and Recommendations (Parallel: 2 Agents)

Launch two parallel agents. The report structure and the recommendations are independent deliverables that draw from the same evidence.

Agent 1 - Investigation Report:

Write a complete investigation report for: $ARGUMENTS

Using root cause: [insert root cause from Phase 3] Using evidence: [insert evidence from Phase 2] Using hypothesis results: [insert results from Phase 3]

Format:

# Investigation Report: [Issue Title]

**Date:** [date]
**Investigator:** Claude Code
**Status:** Complete

## Summary
[One paragraph summary of the issue and root cause]

## Problem Statement
[What was reported/observed]

## Investigation Steps

### Step 1: [What was checked]
**Finding:** [What was discovered]

### Step 2: [What was checked]
**Finding:** [What was discovered]

...

## Root Cause
[Detailed explanation of the root cause, distinguishing proximate cause, root cause, and contributing factors]

## Evidence
- [Evidence 1 with file:line references]
- [Evidence 2 with file:line references]

## Contributing Factors
- [Factor 1]
- [Factor 2]

## Appendix

### Code References
- `file1.kt:123` - [description]
- `file2.kt:456` - [description]

### Timeline
- [timestamp] - [event]
- [timestamp] - [event]

Agent 2 - Recommendations and Prevention:

Based on root cause: [insert root cause from Phase 3] And evidence: [insert evidence from Phase 2]

Produce two deliverables:

1. Prioritized Actions:

  • Critical - Must do immediately to resolve the issue
  • Important - Should do soon to prevent recurrence
  • Nice to have - Consider for future resilience

For each action, include specific code changes, file paths, and implementation details.

2. Prevention Plan:

  • Testing improvements (specific tests to add, coverage gaps to fill)
  • Monitoring and alerting (what metrics to watch, what thresholds to set)
  • Code review focus areas (patterns to watch for in future reviews)
  • Documentation updates (what to document, where)

Return both deliverables with concrete, actionable items.

Wait for both agents to complete. Merge the recommendations into the report under a ## Recommendations section.

Investigation Techniques Reference

These techniques may be used by any agent during any phase:

Binary Search (Git Bisect)

git bisect start
git bisect bad HEAD
git bisect good <known-good-commit>
# Test each commit until culprit found

Minimal Reproduction

Create the smallest possible test case that reproduces the issue. Prefer an automated test over manual steps.

Compare Working vs Broken

Diff configurations, code versions, and environments between working and broken states.

Test Failure Policy

IMPORTANT: If any tests fail during investigation, they must be fixed. There is no such thing as a "pre-existing" test failure - all test failures must be resolved before the task is considered complete. The task always completes with completely passing tests.

Completion Criteria

  • Problem clearly defined
  • Evidence collected from all four dimensions (code, logs, tests, external)
  • All hypotheses evaluated with evidence-backed verdicts
  • Root cause identified with confidence level
  • Report written with full code references and timeline
  • Recommendations provided with specific, actionable items
  • ALL tests pass (no exceptions for "pre-existing" failures)

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.