Investigate logo

Investigate

CommunityPopular
FlorianBruniaux
investigate

Systematic root-cause debugging: find the cause before writing any fix

Overview

PublisherFlorianBruniaux
Repositoryclaude-code-ultimate-guide
Skill nameinvestigate
Stars
6K
Forks
782
Bundled files
Instructions only
LicenseCC-BY-SA-4.0
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by FlorianBruniaux on GitHub. Read the source before you install it.

Installation

Install the Investigate AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/FlorianBruniaux/claude-code-ultimate-guide.git /tmp/claude-code-ultimate-guide
mkdir -p .claude/skills
cp -r /tmp/claude-code-ultimate-guide/examples/skills/investigate .claude/skills/investigate
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Investigate in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Investigate on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Investigate is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Investigate: Root-Cause Debugging

Systematic debugging with mandatory root cause investigation before any code changes.

Iron Law: NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST.

Fixing symptoms creates whack-a-mole debugging. Every fix that doesn't address root cause makes the next bug harder to find.

Instructions

Phase 1: Collect Symptoms

Gather all available context before forming any hypothesis.

  1. Read the error messages, stack traces, and reproduction steps in full
  2. Ask ONE targeted question if the user hasn't provided enough context:
    • "What exact error message do you see?"
    • "Can you reproduce this consistently?"
    • "When did this start happening?"
  3. Identify the affected component and its boundaries

Output: A precise symptom statement: what fails, when, with what error.


Phase 2: Read the Code

Trace the code path from symptom back to potential causes. Do not guess.

bash
# Find all references to the failing component
grep -rn "ComponentName\|function_name\|error_string" src/ --include="*.{ts,js,py,rb,go}" | head -30

# Check recent changes to affected files
git log --oneline -15 -- <affected-file>

# Read the actual diff for each recent commit
git show <commit-hash> -- <affected-file>

Use Grep to find all references, Read to understand the logic. Never skip reading the code.


Phase 3: Check Recent Changes

bash
# What changed recently across the whole repo
git log --oneline -20

# Changes to files related to the symptom
git log --oneline -20 -- <affected-files>

# Full diff of the last N commits
git diff HEAD~3..HEAD -- <affected-directory>

Key question: Was this working before? If yes, the root cause is in the recent diff.

  • Regression = root cause is in the changes, not the original code
  • Always-broken = architectural issue or incorrect assumption

Phase 4: Reproduce

Before fixing anything, confirm you can trigger the bug deterministically.

bash
# Run the test suite targeting the affected area
npm test -- --testPathPattern="affected-module" 2>/dev/null || \
pnpm test -- --testPathPattern="affected-module" 2>/dev/null || \
pytest tests/test_affected.py -v 2>/dev/null

# Check logs if available
tail -50 logs/error.log 2>/dev/null || \
journalctl -u app-service --lines=50 2>/dev/null

If you cannot reproduce: gather more evidence. Do not fix what you cannot verify is broken.


Phase 5: Pattern Analysis

Match the symptom against known bug patterns:

PatternSignatureWhere to look
Race conditionIntermittent, timing-dependent failuresConcurrent access to shared state, async/await ordering
Null propagationTypeError, undefined is not a functionMissing guards on optional values, unchecked API responses
State corruptionInconsistent data, partial updatesTransactions, callbacks, mutation of shared objects
Integration failureTimeout, unexpected response shapeExternal API calls, service boundaries, schema changes
Configuration driftWorks locally, fails in staging/prodEnv vars, feature flags, database state, missing secrets
Stale cacheShows old data, fixes on restart/clearRedis, CDN, browser cache, memoization
Import/module error"Cannot find module", "is not a function"Package versions, circular imports, build artifacts

Also check:

  • TODOS.md or issue tracker for known issues in the same area
  • git log for prior fixes in the same files; recurring bugs in the same location are an architectural smell

External search: If the pattern doesn't match, search for: {framework} {sanitized-error-type} (strip hostnames, file paths, internal data). Search the error category, not the raw message.

Form a hypothesis: "Root cause hypothesis: [specific, testable claim about what is wrong and why]"


Phase 6: Hypothesis Testing

Before writing any fix, verify your hypothesis.

  1. Confirm the hypothesis: Add a temporary log statement, assertion, or debug output at the suspected root cause. Run the reproduction. Does the evidence match?
javascript
// Example: temporary diagnostic
console.log('[DEBUG investigate]', { value, expected, type: typeof value });
python
# Example: temporary diagnostic
import sys; print(f'[DEBUG investigate] value={value!r} type={type(value)}', file=sys.stderr)
  1. If hypothesis is wrong: Gather more evidence. Return to Phase 2. Do not guess.

  2. 3-strike rule: If 3 hypotheses fail, STOP. This may be an architectural issue.

    Present this to the user:

    3 hypotheses tested, none confirmed. This likely requires deeper investigation.
    
    Options:
    A) I have a new hypothesis: [describe], continue investigating
    B) Add instrumentation and wait: capture the bug in the act next time
    C) Escalate: this needs someone with deeper system knowledge

Red flags, slow down immediately:

  • "Quick fix for now": there is no "for now"
  • Proposing a fix before tracing data flow: that's guessing
  • Each fix reveals a new problem elsewhere: wrong layer, not wrong code

Phase 7: Implementation

Once root cause is confirmed:

  1. Fix the root cause, not the symptom. The smallest change that eliminates the actual problem.

  2. Minimal diff: Fewest files touched, fewest lines changed. Resist refactoring adjacent code.

  3. Write a regression test that:

    • Fails without the fix (proves the test is meaningful)
    • Passes with the fix (proves the fix works)
  4. Run the full test suite and paste the output. No regressions allowed.

  5. Blast radius check: If the fix touches more than 5 files, stop and confirm:

    This fix touches N files. That's a large blast radius for a bug fix.
    
    A) Proceed: the root cause genuinely spans these files
    B) Split: fix the critical path now, defer the broader cleanup
    C) Rethink: there may be a more targeted approach

Output Format

DEBUG REPORT
════════════════════════════════════════════════════
Symptom:          [what the user observed]
Root cause:       [what was actually wrong, specific not vague]
Fix:              [what was changed, with file:line references]
Evidence:         [test output or reproduction showing fix works]
Regression test:  [file:line of the new test]
Related:          [known issues, prior bugs in same area, architectural notes]
Status:           DONE | DONE_WITH_CONCERNS | BLOCKED
════════════════════════════════════════════════════

Status definitions:

  • DONE: root cause found, fix applied, regression test written, all tests pass
  • DONE_WITH_CONCERNS: fixed but cannot fully verify (intermittent, requires staging)
  • BLOCKED: root cause unclear after full investigation

Escalation format (when BLOCKED):

STATUS: BLOCKED
REASON: [1-2 sentences explaining what was tried and why it failed]
ATTEMPTED: [list of hypotheses tested]
RECOMMENDATION: [what the user should do next: add logging, escalate, or request an architectural review]

Important Rules

  • Never apply a fix you cannot verify. If you can't reproduce and confirm, don't ship it.
  • Never say "this should fix it." Verify and prove it. Run the tests.
  • Never fix >3 unrelated things in one investigation. If you find other bugs, note them but stay focused.
  • Remove all debug log statements before committing the fix.
  • 3+ failed hypotheses → question the architecture, not your hypothesis skills.

Usage

/investigate TypeError: Cannot read properties of undefined (reading 'map')
/investigate the payment flow is silently dropping some transactions
/investigate

Related Commands

  • /review-pr: review the fix before merging
  • /qa: run browser QA on the affected feature after fixing
  • /ship: pre-deploy checklist after investigation is complete

$ARGUMENTS

Frequently asked questions

What does the Investigate AI skill do?

Systematic root-cause debugging: find the cause before writing any fix

Why use Investigate on TypingMind?

Because you install it once and use it with any model. Investigate is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Investigate in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/FlorianBruniaux/claude-code-ultimate-guide/tree/main/examples/skills/investigate. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Investigate?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Investigate?

As many as you like. As long as a model supports skills, you can use Investigate with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Investigate AI skill free?

Yes. It is published on GitHub by FlorianBruniaux under the CC-BY-SA-4.0 license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇