Agent skill
investigate
Deep investigation of errors, bugs, or codebase questions without making any code changes. Use when user mentions investigate, understand, explore, analyze, or pastes error tracebacks. Spawns parallel subagents for comprehensive exploration.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/investigate-trecek-useful-claude-skills
SKILL.md
Investigation Skill
Perform deep codebase investigation without making any changes. This skill uses parallel subagents to explore multiple aspects simultaneously.
When to Use
- User pastes an error traceback and wants root cause analysis
- User wants to understand how a system/module works
- User asks "how did tests miss this" or similar
- User says "investigate", "explore", "understand", or "analyze"
- User explicitly says "do not change any code"
Critical Constraints
NEVER:
- Modify any source code files
- Suggest backward compatibility solutions
- Suggest fallbacks that hide errors
- Create files outside
temp/investigate/directory - Choose or accept approaches, solutions, and/or fixes that are chosen simply because they are easier
ALWAYS:
- Use subagents for parallel exploration
- Write findings as a markdown report with unique name to
temp/investigate/directory - Identify how tests missed the issue (if applicable)
- Check for similar existing patterns in codebase
- Ensure approaches, solutions, and fixes are the appropriate long-term solutions with proper architecture
Investigation Workflow
Step 1: Parse the Investigation Target
Identify what needs investigation:
- Error Investigation: Extract error type, message, and stack trace
- Module Investigation: Identify the module/component to understand
- Question Investigation: Clarify the specific question being asked
Step 2: Launch Parallel Subagents
Spawn explore subagents to investigate different aspects simultaneously (some aspects may and should require multiple subagents):
Core Implementation
- Find the primary source files
- Understand the main logic flow
- Identify key functions/classes
Dependencies & Consumers
- What depends on this code?
- What does this code depend on?
- Map the dependency graph
Test Coverage
- Find all tests for this code
- Identify what scenarios are tested
- Find gaps in test coverage
Error Context (if error investigation)
- Trace the error through the stack
- Find where the bad state originated
- Identify the root cause
Similar Patterns
- Search for similar code elsewhere
- How do other parts handle this?
- Are there established patterns?
Architecture Context
- Read relevant architecture.md files
- Understand design decisions
- Check for documented constraints
External Research (Web Search)
- Search for error messages in external sources
- Look up known issues in libraries/frameworks
- Find documentation for relevant APIs
- Check GitHub issues for similar problems
- Search for Stack Overflow discussions
Step 3: Synthesize Findings
After subagents complete, consolidate into structured findings:
- Summary: One paragraph overview
- Root Cause (if error): The actual source of the problem
- Affected Components: List of files/modules involved
- Data Flow: How data moves through the system
- Test Gap Analysis: Why tests didn't catch this
- Similar Patterns: How similar issues are handled elsewhere
- External Research: Relevant findings from web search (if applicable)
- Recommendations: Suggested approaches (NOT implementations)
Step 4: Write Report
Write findings to: temp/investigate/investigation_{topic}_{date}.md
Report structure:
# Investigation: {Topic}
**Date:** {YYYY-MM-DD}
**Scope:** {What was investigated}
## Summary
{One paragraph overview}
## Root Cause
{If error investigation - the actual source}
## Affected Components
- {file1}: {role}
- {file2}: {role}
## Data Flow
{How data moves through the system}
## Test Gap Analysis
{Why existing tests didn't catch this}
## Similar Patterns
{How similar scenarios are handled elsewhere}
## External Research
{Relevant findings from web search - library bugs, known issues, documentation insights}
{Include source URLs for reference}
## Recommendations
{Suggested approaches - NOT code changes}
Subagent Prompt Template
Use this template for each Explore subagent:
Investigate {specific aspect} of {target}.
Focus on:
1. {Specific question 1}
2. {Specific question 2}
3. {Specific question 3}
This is a research task - DO NOT modify any code.
Report your findings in a structured format.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?