IN

An intelligent routing hub that directs code investigation requests to the right diagnostic agent.

Install

mkdir -p .claude/skills/investigate && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/5127" && unzip -o skill.zip -d .claude/skills/investigate && rm skill.zip

Installs to .claude/skills/investigate

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Unified entry point for code investigation. Auto-routes to specialized detective based on query keywords. Use when investigation type is unclear or for general exploration.
172 chars✓ has a “when” trigger
Beginner

Key capabilities

  • Normalizes user input for keyword extraction
  • Routes requests to specialized detective sub-skills
  • Resolves conflicts between multiple relevant detectives
  • Defaults to developer-detective when no specific domain is identified

How it works

Processes text via bash-based keyword matching and applies priority logic to route tasks to specific internal modules.

Inputs & outputs

You give it
A natural language query about code
You get back
Delegation to the appropriate detective agent

When to use investigate

  • Debug code errors or crashes
  • Analyze test coverage
  • Review architectural patterns
  • Investigate general code implementation

About this skill

Investigate Skill

Version: 1.0.0 Purpose: Keyword-based routing to specialized detective skills Pattern: Smart delegation via Task tool

Overview

This skill analyzes your investigation query and routes to the appropriate detective specialist:

  • debugger-detective (errors, bugs, crashes)
  • tester-detective (tests, coverage, edge cases)
  • architect-detective (architecture, design, patterns)
  • developer-detective (implementation, data flow - default)

Routing Logic

Priority System (Highest First)

  1. Error/Debug (Priority 1) - Time-critical bug fixes

    • Keywords: "debug", "error", "broken", "failing", "crash"
    • Route to: debugger-detective
  2. Testing (Priority 2) - Specialized test analysis

    • Keywords: "test", "coverage", "edge case", "mock"
    • Route to: tester-detective
  3. Architecture (Priority 3) - High-level understanding

    • Keywords: "architecture", "design", "structure", "layer"
    • Route to: architect-detective
  4. Implementation (Default, Priority 4) - Most common

    • Keywords: "implementation", "how does", "code flow"
    • Route to: developer-detective

Conflict Resolution

When multiple keywords from different categories are detected:

  • Highest priority wins (Priority 1 beats Priority 2, etc.)
  • No matches: Default to developer-detective

Workflow

Phase 1: Extract Query

The investigation query should be available from the task description or user input.

# Query comes from the Task description or user request
INVESTIGATION_QUERY="${TASK_DESCRIPTION:-$USER_QUERY}"

# Normalize to lowercase for case-insensitive matching
QUERY_LOWER=$(echo "$INVESTIGATION_QUERY" | tr '[:upper:]' '[:lower:]')

Phase 2: Keyword Detection

# Priority 1: Error/Debug keywords
if echo "$QUERY_LOWER" | grep -qE "debug|error|broken|failing|crash"; then
  DETECTIVE="debugger-detective"
  KEYWORDS="debug/error keywords"
  PRIORITY=1
  RATIONALE="Bug fixes are time-critical and require call chain tracing"

# Priority 2: Testing keywords
elif echo "$QUERY_LOWER" | grep -qE "test|coverage|edge case|mock"; then
  DETECTIVE="tester-detective"
  KEYWORDS="test/coverage keywords"
  PRIORITY=2
  RATIONALE="Test analysis is specialized and requires callers analysis"

# Priority 3: Architecture keywords
elif echo "$QUERY_LOWER" | grep -qE "architecture|design|structure|layer"; then
  DETECTIVE="architect-detective"
  KEYWORDS="architecture/design keywords"
  PRIORITY=3
  RATIONALE="High-level understanding requires PageRank analysis"

# Priority 4: Implementation (default)
else
  DETECTIVE="developer-detective"
  KEYWORDS="implementation (default)"
  PRIORITY=4
  RATIONALE="Most common investigation type - data flow via callers/callees"
fi

Phase 3: User Feedback

Before delegating, inform the user of the routing decision:

echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "🔍 Investigation Routing"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
echo "Query: $INVESTIGATION_QUERY"
echo ""
echo "Detected: $KEYWORDS (Priority $PRIORITY)"
echo "Routing to: $DETECTIVE"
echo "Reason: $RATIONALE"
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""

Phase 4: Delegation via Task Tool

Use the Task tool to delegate to the selected detective:

Task({
  description: INVESTIGATION_QUERY,
  agent: DETECTIVE,
  context: {
    routing_reason: `Auto-routed based on ${KEYWORDS}`,
    original_query: INVESTIGATION_QUERY,
    priority: PRIORITY
  }
})

Examples

Example 1: Debug Keywords

Input: "Why is login broken?"

Detection:

  • Keyword matched: "broken"
  • Priority: 1 (Error/Debug)
  • Route to: debugger-detective

Feedback:

🔍 Investigation Routing
Query: Why is login broken?
Detected: debug/error keywords (Priority 1)
Routing to: debugger-detective
Reason: Bug fixes are time-critical and require call chain tracing

Example 2: Test Keywords

Input: "What's the test coverage for payment?"

Detection:

  • Keywords matched: "test", "coverage"
  • Priority: 2 (Testing)
  • Route to: tester-detective

Feedback:

🔍 Investigation Routing
Query: What's the test coverage for payment?
Detected: test/coverage keywords (Priority 2)
Routing to: tester-detective
Reason: Test analysis is specialized and requires callers analysis

Example 3: Architecture Keywords

Input: "What's the architecture of the auth layer?"

Detection:

  • Keywords matched: "architecture", "layer"
  • Priority: 3 (Architecture)
  • Route to: architect-detective

Feedback:

🔍 Investigation Routing
Query: What's the architecture of the auth layer?
Detected: architecture/design keywords (Priority 3)
Routing to: architect-detective
Reason: High-level understanding requires PageRank analysis

Example 4: No Keywords (Default)

Input: "How does payment work?"

Detection:

  • No keywords matched
  • Priority: 4 (Default)
  • Route to: developer-detective

Feedback:

🔍 Investigation Routing
Query: How does payment work?
Detected: implementation (default) (Priority 4)
Routing to: developer-detective
Reason: Most common investigation type - data flow via callers/callees

Example 5: Multi-Keyword Conflict

Input: "Debug the test coverage"

Detection:

  • Keywords matched: "debug" (Priority 1) AND "test" (Priority 2)
  • Priority 1 wins
  • Route to: debugger-detective

Feedback:

🔍 Investigation Routing
Query: Debug the test coverage
Detected: debug/error keywords (Priority 1)
Routing to: debugger-detective
Reason: Bug fixes are time-critical and require call chain tracing
(Note: Also detected test keywords, but debug takes priority)

Complete Implementation

Here's the full workflow:

#!/bin/bash

# Get investigation query from task description
INVESTIGATION_QUERY="${TASK_DESCRIPTION}"

# Normalize to lowercase
QUERY_LOWER=$(echo "$INVESTIGATION_QUERY" | tr '[:upper:]' '[:lower:]')

# Keyword detection with priority routing
if echo "$QUERY_LOWER" | grep -qE "debug|error|broken|failing|crash"; then
  DETECTIVE="debugger-detective"
  KEYWORDS="debug/error keywords"
  PRIORITY=1
  RATIONALE="Bug fixes are time-critical and require call chain tracing"

elif echo "$QUERY_LOWER" | grep -qE "test|coverage|edge case|mock"; then
  DETECTIVE="tester-detective"
  KEYWORDS="test/coverage keywords"
  PRIORITY=2
  RATIONALE="Test analysis is specialized and requires callers analysis"

elif echo "$QUERY_LOWER" | grep -qE "architecture|design|structure|layer"; then
  DETECTIVE="architect-detective"
  KEYWORDS="architecture/design keywords"
  PRIORITY=3
  RATIONALE="High-level understanding requires PageRank analysis"

else
  DETECTIVE="developer-detective"
  KEYWORDS="implementation (default)"
  PRIORITY=4
  RATIONALE="Most common investigation type - data flow via callers/callees"
fi

# Show routing decision
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "🔍 Investigation Routing"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
echo "Query: $INVESTIGATION_QUERY"
echo ""
echo "Detected: $KEYWORDS (Priority $PRIORITY)"
echo "Routing to: $DETECTIVE"
echo "Reason: $RATIONALE"
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""

Then use the Task tool to delegate:

Task({
  description: INVESTIGATION_QUERY,
  agent: DETECTIVE
})

Fallback Protocol

If routing produces unexpected results:

  1. Show routing decision to user
  2. Ask for override if needed via AskUserQuestion
  3. Default to developer-detective if ambiguous

Override Pattern

// If user wants to override the routing
AskUserQuestion({
  questions: [{
    question: `Auto-routing selected ${DETECTIVE}. Override?`,
    header: "Investigation Routing",
    multiSelect: false,
    options: [
      { label: "Continue with auto-routing", description: `Use ${DETECTIVE}` },
      { label: "debugger-detective", description: "Root cause analysis" },
      { label: "tester-detective", description: "Test coverage analysis" },
      { label: "architect-detective", description: "Architecture patterns" },
      { label: "developer-detective", description: "Implementation details" }
    ]
  }]
})

Integration with Existing Workflow

This skill is additive only and does not change existing behavior:

  • Direct detective usage still works (Task → specific detective)
  • /analyze command unchanged (launches codebase-detective)
  • Parallel orchestration patterns unchanged
  • All claudemem hooks preserved

Use Cases

When to Use Investigate SkillWhen to Use Direct Detective
Investigation type unclearYou know which specialist you need
General explorationParallel orchestration (multimodel plugin)
Quick routing decisionSpecific workflow requirements
Learning/experimentingProduction automation

Notes

  • Case-insensitive keyword matching
  • Priority system resolves conflicts
  • User sees routing decision before delegation
  • Original query preserved in Task context
  • Default to developer-detective when no keywords match
  • Works with all claudemem versions (v0.3.0+)

Maintained by: MadAppGang Plugin: code-analysis v3.1.0 Last Updated: January 2026 (v1.0.0 - Initial release)

When not to use it

  • When the specific detective skill is already known
  • Simple tasks requiring direct action without investigation

Limitations

  • Reliant on keyword presence
  • Priority system may miscategorize nuanced or cross-disciplinary queries

How it compares

It eliminates the need for the user to manually select or guess which specialized diagnostic tool is required.

Compared to similar skills

investigate side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
investigate (this skill)16moReviewBeginner
python-testing-patterns772moReviewIntermediate
error-handling-patterns352moNo flagsIntermediate
go-dev-guidelines149moNo flagsIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

More by MadAppGang

View all by MadAppGang

claudish-usage

MadAppGang

CRITICAL - Guide for using Claudish CLI ONLY through sub-agents to run Claude Code with any AI model (OpenRouter, Gemini, OpenAI, local models). NEVER run Claudish directly in main context unless user explicitly requests it. Use when user mentions external AI models, Claudish, OpenRouter, Gemini, OpenAI, Ollama, or alternative models. Includes mandatory sub-agent delegation patterns, agent selection guide, file-based instructions, and strict rules to prevent context window pollution.

442

golang-performance

MadAppGang

Use when profiling Go applications (pprof), running benchmarks, optimizing memory/CPU usage, or debugging performance bottlenecks in production Go code.

47

golang

MadAppGang

Use when building Go backend services, implementing goroutines/channels, handling errors idiomatically, writing tests with testify, or following Go best practices for APIs/CLI tools.

313

schemas

MadAppGang

YAML frontmatter schemas for Claude Code agents and commands. Use when creating or validating agent/command files.

34

external-model-selection

MadAppGang

Choose optimal external AI models for code analysis, bug investigation, and architectural decisions. Use when consulting multiple LLMs via claudish, comparing model perspectives, or investigating complex Go/LSP/transpiler issues. Provides empirically validated model rankings (91/100 for MiniMax M2, 83/100 for Grok Code Fast) and proven consultation strategies based on real-world testing.

218

adr-documentation

MadAppGang

Architecture Decision Records (ADR) documentation practice. Use when documenting architectural decisions, recording technical trade-offs, creating decision logs, or establishing architectural patterns. Trigger keywords - "ADR", "architecture decision", "decision record", "trade-offs", "architectural decision", "decision log".

12

You might also like

python-testing-patterns

wshobson

Implement comprehensive testing strategies with pytest, fixtures, mocking, and test-driven development. Use when writing Python tests, setting up test suites, or implementing testing best practices.

77204

error-handling-patterns

wshobson

Master error handling patterns across languages including exceptions, Result types, error propagation, and graceful degradation to build resilient applications. Use when implementing error handling, designing APIs, or improving application reliability.

35170

go-dev-guidelines

jumppad-labs

This skill should be used when writing, refactoring, or testing Go code. It provides idiomatic Go development patterns, TDD-based workflows, project structure conventions, and testing best practices using testify/require and mockery. Activate this skill when creating new Go features, services, packages, tests, or when setting up new Go projects.

1495

codebase-context-extractor

lofcz

This skill provides a comprehensive context extraction system for large codebases. It intelligently analyzes code structure, dependencies, and relationships to extract relevant context for understanding, debugging, or modifying code.

424

fix-bug

tddworks

Guide for fixing bugs in ClaudeBar following Chicago School TDD and rich domain design. Use this skill when: (1) User reports a bug or unexpected behavior (2) Fixing a defect in existing functionality (3) User asks "fix this bug" or "this doesn't work correctly" (4) Correcting behavior that violates the user's mental model

1117

investigating-code-patterns

CaptainCrouton89

Systematically trace code flows, locate implementations, diagnose performance issues, and map system architecture. Use when understanding how existing systems work, researching concepts, exploring code structure, or answering "how/where/why is X implemented?" questions.

19

Search skills

Search the agent skills registry