Investigate issues and report findings. Does NOT create plans or modify code.
Purpose
- Investigate reported issues (API errors, wrong data, unexpected behavior)
- Debug deployment or runtime issues using deployment logs
- Analyze codebase to understand behavior
- Examine configuration and environment issues
- Report findings only - user decides next steps
Arguments
$ARGUMENTS should describe what to investigate:
- What happened vs what was expected
- Error messages or unexpected values
- Which environment (if applicable) — if not specified, ask
- Deployment ID if it's a deployment issue
- Any context that helps narrow the scope
Context Gathering
IMPORTANT: Do NOT hardcode MCP names or folder paths. Always read CLAUDE.md to discover:
Available MCP servers - Look for "MCP SERVERS", "MCPs", or similar sections to find:
- Error tracking MCPs for crash/error investigation (use ToolSearch to load tools before calling them)
- Deployment MCPs for logs and service status (Railway, Vercel, AWS, etc.)
- Any other configured MCPs
Sentry configuration - Look for "SENTRY" section. If present, use the organization, project, and region URL for all Sentry MCP calls. If absent, skip Sentry. See the Sentry Integration section below for detailed guidance.
Project structure - Look for "STRUCTURE" or "FOLDER STRUCTURE" sections to understand:
- Where source code and documents are stored
- Naming conventions and organization
Domain concepts - Look for sections describing:
- Data schemas and formats
- Business rules and validation
- API endpoints and their behavior
Environments - Look for "ENVIRONMENTS" section to discover:
- Environment names (production, staging, etc.)
- Associated branches and URLs
- Deployment service configurations
Sentry Integration
Conditional: Only applies if CLAUDE.md has a SENTRY section. If no Sentry is configured, skip this entirely.
Read CLAUDE.md SENTRY section for organizationSlug, projectSlugOrId, and regionUrl. Always pass these to every Sentry MCP call. Use ToolSearch to load Sentry tools before calling them.
When to use Sentry
- User reports crashes or errors in production
- Investigating runtime exceptions or unhandled errors
- Need crash frequency, affected user count, or error trends
- User provides a Sentry issue URL or issue ID
- Need production stack traces
Which Sentry tool to use
| Goal |
Tool |
Example |
| List matching issues |
search_issues |
"unresolved errors in production" |
| Issue details + stacktrace |
get_issue_details |
Pass issue ID |
| Count errors or search events |
search_events |
"how many errors today" |
| Filter events within one issue |
search_issue_events |
"events from last hour" on issue X |
| View a trace |
get_trace_details |
Pass 32-char hex trace ID |
| Tag distribution for an issue |
get_issue_tag_values |
tagKey: "environment", "url", "browser" |
| AI root cause analysis |
analyze_issue_with_seer |
Deep analysis with code fix suggestions |
Investigation patterns
Error investigation:
search_issues — find matching issues by description or symptoms
get_issue_details — get stacktrace, affected users, frequency
get_issue_tag_values — check environment/release/url distribution
search_issue_events — filter to specific timeframe or environment
analyze_issue_with_seer — get AI root cause analysis with code fixes
Performance investigation:
search_events — query spans: "slow API requests", "p95 response time"
get_trace_details — inspect a specific trace for bottlenecks
Trend investigation:
search_events — "count of errors today vs yesterday", "error rate this week"
search_issues — "new issues in the last 24 hours"
Tips
- Start with
search_issues for broad exploration, get_issue_details when you have a specific issue
- Use
search_events for "how many errors today?" style questions
- Cross-reference Sentry stack traces with local codebase to identify the exact code path
- Check tag distributions (device, OS, release, environment) to understand issue scope
Investigation Workflow
Step 1: Classify the Investigation Type
Based on $ARGUMENTS, determine what you're investigating:
| Category |
Indicators |
Primary Tools |
| API |
Wrong response, missing data, error codes |
Codebase, Deployment logs |
| Deployment |
Service down, build failures, runtime errors |
Deployment MCP |
| Data |
Wrong values, missing records, unexpected state |
Codebase, Database queries |
| Performance |
Slow responses, timeouts, resource issues |
Deployment logs, Codebase |
| Auth |
Login failures, permission errors, token issues |
Codebase, Deployment logs |
| General |
Unknown cause, need exploration |
All available tools |
Step 2: Gather Evidence
For Sentry (if configured):
Start with Sentry for error/performance investigations — it provides the richest context (stacktraces, traces, frequency, affected environments). See the Sentry Integration section above for tool selection and patterns.
For Codebase Analysis:
- Use Grep/Glob for specific searches
- Use Task tool with
subagent_type=Explore for broader exploration
- Read relevant source files, configs, and tests
For Deployment Issues (if MCP available):
- Determine target environment from $ARGUMENTS (consult CLAUDE.md's ENVIRONMENTS section). If unclear, ask user.
- Check deployment MCP status
- List services to find affected service
- List recent deployments with statuses — pass
environment: "<target>" explicitly if the MCP supports it
- Get deployment and build logs — pass
environment: "<target>" explicitly if the MCP supports it
- Search logs for errors using filters (e.g.,
@level:error) if the MCP supports it
For API Issues:
- Trace the request flow through the codebase
- Check route handlers, middleware, and data access layers
- Look for error handling gaps
- Check environment variable usage
For Data Issues:
- Examine data models and schemas
- Check validation logic
- Trace data flow from input to storage
- Look for transformation errors
Step 3: Form Conclusions
After gathering evidence, determine:
- Root Cause Identified - You found what's causing the issue
- Root Cause Suspected - Strong hypothesis but not 100% certain
- Multiple Possibilities - Several potential causes, need more info
- Nothing Wrong Found - Investigation shows system working correctly
- Cannot Determine - Insufficient information to conclude
Investigation Report Format
Write findings to the conversation (NOT to a file):
## Investigation Report
**Subject:** [What was investigated]
**Environment:** [production | staging | codebase-only]
**Conclusion:** [Root Cause Identified | Suspected | Multiple Possibilities | Nothing Wrong | Cannot Determine]
### Context
- **MCPs used:** [list MCPs accessed]
- **Sentry issues reviewed:** [issue IDs if applicable]
- **Environment queried:** [production | staging | N/A]
- **Files examined:** [list key files checked]
- **Logs reviewed:** [deployment IDs, time ranges if applicable]
### Evidence
[What you found - be specific with data points, log excerpts, file contents]
### Findings
[Explain what you discovered. If root cause found, explain it clearly.
If nothing wrong, explain what was checked and why it appears correct.
If uncertain, list possibilities ranked by likelihood.]
### Recommendations (Optional)
[Only if you have specific suggestions - do NOT write a fix plan]
Deployment Debugging Guidelines
When investigating deployment issues (if MCP available):
- Identify target environment - Determine environment name from CLAUDE.md's ENVIRONMENTS section
- Check status first - Verify MCP access
- List recent deployments - Get deployment IDs and statuses (pass
environment param if supported)
- Get targeted logs - Search for errors using filters (pass
environment param if supported)
- Look for patterns - Repeated errors, timing correlations
- Check configuration - Environment variables, settings (pass
environment param if supported)
Error Handling
| Situation |
Action |
| $ARGUMENTS is vague |
Ask for more specific details |
| CLAUDE.md doesn't exist |
Continue with codebase-only investigation |
| MCP not available |
Skip that MCP, note in report what couldn't be checked |
| Sentry not configured |
Skip Sentry, continue with other sources |
| Sentry has no matching issues |
Note in report — may be a new/unreported issue |
| File/resource not found |
Document in report (may be relevant) |
| Cannot reproduce issue |
Document steps taken, request more context |
| Logs unavailable |
Note in report, suggest alternative approaches |
Rules
- Report only - Do NOT modify source code or files
- No plans - Do NOT write PLANS.md or fix plans
- Start with Sentry - For error/performance investigations, check Sentry before deployment logs (if configured)
- Sentry constants - ALWAYS pass
organizationSlug, projectSlugOrId, and regionUrl from CLAUDE.md to Sentry tools
- Discover MCPs - Read CLAUDE.md to find available tools
- Explicit environment - ALWAYS pass the
environment parameter to deployment MCP tools when supported; never rely on CLI defaults
- Be thorough - Check multiple sources before concluding
- Be specific - Include exact values, line numbers, timestamps
- Be honest - If uncertain, say so; if nothing wrong, say so
What NOT to Do
- Don't create PLANS.md - This skill only reports
- Don't modify code - Investigation is read-only
- Don't assume MCPs - Discover from CLAUDE.md
- Don't conclude prematurely - Gather sufficient evidence first
- Don't force findings - "Nothing wrong" is a valid conclusion
Termination
When you finish investigating, output the investigation report.
If bugs or issues were found that need fixing, end with:
---
Investigation complete. Issues found that may need fixing.
Would you like me to create a fix plan? Say 'yes' or run `/plan-fix` with the context above.
(Fix plans will create Linear issues with your project's issue prefix in Todo state)
If nothing wrong was found or no fix needed, end with:
---
Investigation complete.
To take action based on these findings:
- For bug fixes: Use `plan-fix` with this context (creates Linear issues in Todo)
- For feature changes: Use `plan-inline` with specific request (creates Linear issues in Todo)
- For further investigation: Provide more details and run investigate again
Do not offer to implement fixes directly. Report findings and offer skill chaining if appropriate.
1---2name: investigate3description: Read-only investigation that reports findings WITHOUT creating plans or modifying code. Use when user says "investigate", "check why", "look into", "diagnose", or wants to understand a problem before deciding on action. Accesses deployment logs and codebase.4---56Investigate issues and report findings. Does NOT create plans or modify code.78## Purpose910- Investigate reported issues (API errors, wrong data, unexpected behavior)11- Debug deployment or runtime issues using deployment logs12- Analyze codebase to understand behavior13- Examine configuration and environment issues14- **Report findings only** - user decides next steps1516## Arguments1718$ARGUMENTS should describe what to investigate:19- What happened vs what was expected20- Error messages or unexpected values21- Which environment (if applicable) — if not specified, ask22- Deployment ID if it's a deployment issue23- Any context that helps narrow the scope2425## Context Gathering2627**IMPORTANT: Do NOT hardcode MCP names or folder paths.** Always read CLAUDE.md to discover:28291. **Available MCP servers** - Look for "MCP SERVERS", "MCPs", or similar sections to find:30 - Error tracking MCPs for crash/error investigation (use ToolSearch to load tools before calling them)31 - Deployment MCPs for logs and service status (Railway, Vercel, AWS, etc.)32 - Any other configured MCPs33342. **Sentry configuration** - Look for "SENTRY" section. If present, use the organization, project, and region URL for all Sentry MCP calls. If absent, skip Sentry. See the **Sentry Integration** section below for detailed guidance.35363. **Project structure** - Look for "STRUCTURE" or "FOLDER STRUCTURE" sections to understand:37 - Where source code and documents are stored38 - Naming conventions and organization39404. **Domain concepts** - Look for sections describing:41 - Data schemas and formats42 - Business rules and validation43 - API endpoints and their behavior44455. **Environments** - Look for "ENVIRONMENTS" section to discover:46 - Environment names (production, staging, etc.)47 - Associated branches and URLs48 - Deployment service configurations4950## Sentry Integration5152**Conditional:** Only applies if CLAUDE.md has a SENTRY section. If no Sentry is configured, skip this entirely.5354Read CLAUDE.md SENTRY section for `organizationSlug`, `projectSlugOrId`, and `regionUrl`. Always pass these to every Sentry MCP call. Use ToolSearch to load Sentry tools before calling them.5556### When to use Sentry5758- User reports crashes or errors in production59- Investigating runtime exceptions or unhandled errors60- Need crash frequency, affected user count, or error trends61- User provides a Sentry issue URL or issue ID62- Need production stack traces6364### Which Sentry tool to use6566| Goal | Tool | Example |67|------|------|---------|68| List matching issues | `search_issues` | "unresolved errors in production" |69| Issue details + stacktrace | `get_issue_details` | Pass issue ID |70| Count errors or search events | `search_events` | "how many errors today" |71| Filter events within one issue | `search_issue_events` | "events from last hour" on issue X |72| View a trace | `get_trace_details` | Pass 32-char hex trace ID |73| Tag distribution for an issue | `get_issue_tag_values` | tagKey: "environment", "url", "browser" |74| AI root cause analysis | `analyze_issue_with_seer` | Deep analysis with code fix suggestions |7576### Investigation patterns7778**Error investigation:**791. `search_issues` — find matching issues by description or symptoms802. `get_issue_details` — get stacktrace, affected users, frequency813. `get_issue_tag_values` — check environment/release/url distribution824. `search_issue_events` — filter to specific timeframe or environment835. `analyze_issue_with_seer` — get AI root cause analysis with code fixes8485**Performance investigation:**861. `search_events` — query spans: "slow API requests", "p95 response time"872. `get_trace_details` — inspect a specific trace for bottlenecks8889**Trend investigation:**901. `search_events` — "count of errors today vs yesterday", "error rate this week"912. `search_issues` — "new issues in the last 24 hours"9293### Tips9495- Start with `search_issues` for broad exploration, `get_issue_details` when you have a specific issue96- Use `search_events` for "how many errors today?" style questions97- Cross-reference Sentry stack traces with local codebase to identify the exact code path98- Check tag distributions (device, OS, release, environment) to understand issue scope99100## Investigation Workflow101102### Step 1: Classify the Investigation Type103104Based on $ARGUMENTS, determine what you're investigating:105106| Category | Indicators | Primary Tools |107|----------|-----------|---------------|108| **API** | Wrong response, missing data, error codes | Codebase, Deployment logs |109| **Deployment** | Service down, build failures, runtime errors | Deployment MCP |110| **Data** | Wrong values, missing records, unexpected state | Codebase, Database queries |111| **Performance** | Slow responses, timeouts, resource issues | Deployment logs, Codebase |112| **Auth** | Login failures, permission errors, token issues | Codebase, Deployment logs |113| **General** | Unknown cause, need exploration | All available tools |114115### Step 2: Gather Evidence116117**For Sentry (if configured):**118Start with Sentry for error/performance investigations — it provides the richest context (stacktraces, traces, frequency, affected environments). See the **Sentry Integration** section above for tool selection and patterns.119120**For Codebase Analysis:**121- Use Grep/Glob for specific searches122- Use Task tool with `subagent_type=Explore` for broader exploration123- Read relevant source files, configs, and tests124125**For Deployment Issues (if MCP available):**1261. **Determine target environment** from $ARGUMENTS (consult CLAUDE.md's ENVIRONMENTS section). If unclear, ask user.1272. Check deployment MCP status1283. List services to find affected service1294. List recent deployments with statuses — pass `environment: "<target>"` explicitly if the MCP supports it1305. Get deployment and build logs — pass `environment: "<target>"` explicitly if the MCP supports it1316. Search logs for errors using filters (e.g., `@level:error`) if the MCP supports it132133**For API Issues:**134- Trace the request flow through the codebase135- Check route handlers, middleware, and data access layers136- Look for error handling gaps137- Check environment variable usage138139**For Data Issues:**140- Examine data models and schemas141- Check validation logic142- Trace data flow from input to storage143- Look for transformation errors144145### Step 3: Form Conclusions146147After gathering evidence, determine:1481491. **Root Cause Identified** - You found what's causing the issue1502. **Root Cause Suspected** - Strong hypothesis but not 100% certain1513. **Multiple Possibilities** - Several potential causes, need more info1524. **Nothing Wrong Found** - Investigation shows system working correctly1535. **Cannot Determine** - Insufficient information to conclude154155## Investigation Report Format156157Write findings to the conversation (NOT to a file):158159```160## Investigation Report161162**Subject:** [What was investigated]163**Environment:** [production | staging | codebase-only]164**Conclusion:** [Root Cause Identified | Suspected | Multiple Possibilities | Nothing Wrong | Cannot Determine]165166### Context167- **MCPs used:** [list MCPs accessed]168- **Sentry issues reviewed:** [issue IDs if applicable]169- **Environment queried:** [production | staging | N/A]170- **Files examined:** [list key files checked]171- **Logs reviewed:** [deployment IDs, time ranges if applicable]172173### Evidence174[What you found - be specific with data points, log excerpts, file contents]175176### Findings177178[Explain what you discovered. If root cause found, explain it clearly.179If nothing wrong, explain what was checked and why it appears correct.180If uncertain, list possibilities ranked by likelihood.]181182### Recommendations (Optional)183[Only if you have specific suggestions - do NOT write a fix plan]184```185186## Deployment Debugging Guidelines187188When investigating deployment issues (if MCP available):1891901. **Identify target environment** - Determine environment name from CLAUDE.md's ENVIRONMENTS section1912. **Check status first** - Verify MCP access1923. **List recent deployments** - Get deployment IDs and statuses (pass `environment` param if supported)1934. **Get targeted logs** - Search for errors using filters (pass `environment` param if supported)1945. **Look for patterns** - Repeated errors, timing correlations1956. **Check configuration** - Environment variables, settings (pass `environment` param if supported)196197## Error Handling198199| Situation | Action |200|-----------|--------|201| $ARGUMENTS is vague | Ask for more specific details |202| CLAUDE.md doesn't exist | Continue with codebase-only investigation |203| MCP not available | Skip that MCP, note in report what couldn't be checked |204| Sentry not configured | Skip Sentry, continue with other sources |205| Sentry has no matching issues | Note in report — may be a new/unreported issue |206| File/resource not found | Document in report (may be relevant) |207| Cannot reproduce issue | Document steps taken, request more context |208| Logs unavailable | Note in report, suggest alternative approaches |209210## Rules211212- **Report only** - Do NOT modify source code or files213- **No plans** - Do NOT write PLANS.md or fix plans214- **Start with Sentry** - For error/performance investigations, check Sentry before deployment logs (if configured)215- **Sentry constants** - ALWAYS pass `organizationSlug`, `projectSlugOrId`, and `regionUrl` from CLAUDE.md to Sentry tools216- **Discover MCPs** - Read CLAUDE.md to find available tools217- **Explicit environment** - ALWAYS pass the `environment` parameter to deployment MCP tools when supported; never rely on CLI defaults218- **Be thorough** - Check multiple sources before concluding219- **Be specific** - Include exact values, line numbers, timestamps220- **Be honest** - If uncertain, say so; if nothing wrong, say so221222## What NOT to Do2232241. **Don't create PLANS.md** - This skill only reports2252. **Don't modify code** - Investigation is read-only2263. **Don't assume MCPs** - Discover from CLAUDE.md2274. **Don't conclude prematurely** - Gather sufficient evidence first2285. **Don't force findings** - "Nothing wrong" is a valid conclusion229230## Termination231232When you finish investigating, output the investigation report.233234**If bugs or issues were found that need fixing**, end with:235236```237---238Investigation complete. Issues found that may need fixing.239240Would you like me to create a fix plan? Say 'yes' or run `/plan-fix` with the context above.241(Fix plans will create Linear issues with your project's issue prefix in Todo state)242```243244**If nothing wrong was found or no fix needed**, end with:245246```247---248Investigation complete.249250To take action based on these findings:251- For bug fixes: Use `plan-fix` with this context (creates Linear issues in Todo)252- For feature changes: Use `plan-inline` with specific request (creates Linear issues in Todo)253- For further investigation: Provide more details and run investigate again254```255256Do not offer to implement fixes directly. Report findings and offer skill chaining if appropriate.