| name | github-issue-rca |
| description | GitHub Issue root cause analysis skill. Analyze specified GitHub issues to identify possible root causes by examining issue content, code repository, and related resources. Use when user asks to analyze issue root cause, investigate issue, RCA analysis, or troubleshoot GitHub issues. Provides investigation directions with probability estimates and explicitly states when root cause cannot be determined. |
GitHub Issue Root Cause Analysis
This skill provides a systematic approach to analyzing GitHub issues and identifying their possible root causes, with emphasis on searching similar issues first and collecting all relevant links.
Output Requirement
After completing any analysis, you MUST save the report to a markdown file:
- File name:
{issue_number}_rca.md (e.g., 123_rca.md for issue #123)
- Location: Current working directory
- Tool: Use
write tool to create/update the file
- If file doesn't exist: Create it directly with
write
- If file exists: read it first, then overwrite with new content
The analysis is considered incomplete until the report file is saved.
When to Use This Skill
Use this skill when:
- User asks to analyze a GitHub issue's root cause
- User wants to investigate or troubleshoot a GitHub issue
- User requests RCA (Root Cause Analysis) for an issue
- User provides a GitHub issue URL or issue number and asks for analysis
Analysis Workflow
Step 1: Gather Issue Information
-
Extract issue details using GitHub tools:
- Issue title, description, and labels
- Error messages, stack traces, or logs
- Comments and discussions
- Related commits or pull requests
-
Identify affected components:
- File paths mentioned in error messages
- Functions, classes, or modules referenced
- Dependencies or external services involved
-
Extract search keywords:
- Error message fragments
- Function/class names
- Key symptoms or behaviors
Step 2: Search and Analyze Similar Issues (PRIORITY STEP)
This is a PRIORITY step - perform this BEFORE diving into code analysis
-
Search for similar issues using multiple strategies:
# Strategy 1: By error message
github_search_issues(q="error_fragment repo:owner/repo state:all")
# Strategy 2: By symptom/behavior
github_search_issues(q="symptom repo:owner/repo state:all")
# Strategy 3: By file/component
github_search_issues(q="filename repo:owner/repo state:all")
# Strategy 4: By label
github_search_issues(q="label:bug repo:owner/repo state:all")
-
Identify relevant similar issues:
- Issues with same/similar error messages
- Issues in same file or component
- Issues with same symptom pattern
- Recently closed issues (potential regression)
-
Analyze similar issues in detail:
- Root cause: What was the root cause?
- Resolution: How was it fixed? (PR link, commit)
- Pattern: Is this a recurring issue?
- Related code: Which files/functions were involved?
-
Categorize similar issues:
| Category | Description | Value |
|---|
| Identical | Same error, same location | High - likely same root cause |
| Similar | Same error, different location | Medium - same pattern |
| Related | Different error, same component | Low - may share root cause |
| Different | Unrelated issue | Skip |
-
Extract insights from similar issues:
- Common root causes
- Frequent problem areas
- Recurring patterns
- Previous fix approaches
-
[MANDATORY] Collect all links:
- Issue URLs:
https://github.com/owner/repo/issues/NNN
- PR URLs:
https://github.com/owner/repo/pull/NNN
- Commit URLs:
https://github.com/owner/repo/commit/SHA
- File URLs with line numbers
- These links MUST appear in the final report
Step 3: Code Repository Analysis
-
Locate relevant code:
- Use grep/search to find code related to error messages
- Read files mentioned in stack traces
- Examine recent commits in affected areas
- Cross-reference with similar issues
-
Analyze code patterns:
- Look for common bug patterns (null pointer, race condition, resource leak)
- Check error handling and validation logic
- Review configuration and environment-specific code
- Compare with similar issue patterns
-
[MANDATORY] Collect code links:
- File URLs:
https://github.com/owner/repo/blob/branch/path/to/file.py
- Line-specific:
https://github.com/owner/repo/blob/branch/path/to/file.py#L100
- Range URLs:
https://github.com/owner/repo/blob/branch/path/to/file.py#L100-L150
Step 4: External Context Investigation
-
Check related resources:
- Documentation for affected features
- Similar closed issues (search for patterns)
- Recent changes or releases
-
Use tools for additional context:
- GitHub: Query repository metadata, commits, PRs
- Web search: Find known issues or discussions
- Other tools: Based on issue domain
-
[MANDATORY] Collect external links:
- Documentation URLs
- Stack Overflow discussions
- Blog posts or tutorials
- Official guides or references
Step 5: Cross-Reference Analysis with Similar Issues
Compare current issue with similar issues identified in Step 2
-
Pattern matching:
- Is this a regression? (previously fixed, now broken)
- Is this a known recurring issue pattern?
- Did similar issues share the same root cause?
-
Root cause correlation:
- If similar issue had root cause X, does current issue show same symptoms?
- Are the code paths overlapping?
- Is the same component/function involved?
-
Adjust hypothesis confidence based on similar issues:
- High correlation: Boost confidence
- Partial correlation: Consider combined root causes
- No correlation: May indicate new issue
-
Generate comparative analysis table:
| Similar Issue | Similarity | Root Cause | Status | Relevance |
|---|
| #YYY | Identical | [Cause] | Closed | High |
| #ZZZ | Similar | [Cause] | Open | Medium |
Step 6: Root Cause Hypothesis Generation
Generate 2-5 hypotheses based on:
- Direct causes (most obvious from error messages/code)
- Configuration issues (environment, settings, versions)
- Integration issues (APIs, services, dependencies)
- Timing/race conditions (concurrency, async issues)
- Data issues (corrupt data, missing data, invalid state)
- Regression from similar issues (if pattern matches)
For each hypothesis, assess:
- Evidence supporting
- Evidence against
- Confidence level (High/Medium/Low)
- Correlation with similar issues (if applicable)
Step 7: Generate Analysis Report and Save to File
CRITICAL: After completing the analysis, save the findings to a markdown file. This is mandatory.
File: {issue_number}_rca.md (e.g., 123_rca.md)
Location: Current working directory
The report MUST include ALL collected links in the References section.
Report Format (Simplified)
# Root Cause Analysis: Issue #XXX
## Issue Summary
[Brief description]
## Similar Issues Analysis (PRIORITY)
| Issue | Similarity | Status | Root Cause |
|-------|------------|--------|------------|
| #YYY | Identical | Closed | [Cause] |
### Insights
- [Insight 1]
- [Insight 2]
## Possible Root Causes
### Hypothesis 1: [Name]
**Probability**: High/Medium/Low (%)
**Evidence**: [Supporting evidence]
**Similar Issue Correlation**: [Relation to similar issues]
**Recommended Investigation**: [Verification steps]
## References & Links
- Issue #YYY: https://github.com/owner/repo/issues/YYY
- PR #ABC: https://github.com/owner/repo/pull/ABC
- File: https://github.com/owner/repo/blob/main/path/to/file.py#L100
Report Format (Detailed)
# Root Cause Analysis: Issue #XXX
**Repository**: owner/repo
**Issue URL**: https://github.com/owner/repo/issues/XXX
**Analysis Date**: YYYY-MM-DD
---
## 1. Issue Summary
### Title
[Issue title]
### Description
[Brief summary]
### Labels
[List of labels]
### Key Symptoms
- Symptom 1
- Symptom 2
---
## 2. Similar Issues Analysis (PRIORITY SECTION)
### 2.1 Search Queries Used
- `error_fragment repo:owner/repo state:all`
- `symptom repo:owner/repo state:all`
- `filename repo:owner/repo state:all`
### 2.2 Similar Issues Found
| Issue | Title | Similarity | Status | Root Cause | Fix |
|-------|-------|------------|--------|------------|-----|
| #YYY | [Title] | Identical | Closed | [Cause] | [PR/Commit] |
| #ZZZ | [Title] | Similar | Open | Unknown | - |
### 2.3 Pattern Analysis
- **Is this a regression?**: Yes/No/Unclear
- **Recurring pattern**: [Description]
- **Previous fix approaches**: [How similar issues were resolved]
### 2.4 Insights from Similar Issues
1. **[Insight 1]** - Source: Issue #YYY
2. **[Insight 2]** - Source: Issue #ZZZ
---
## 3. Analysis Process
### Files Examined
- `path/to/file1.ext` - [Why examined]
- `path/to/file2.ext` - [Why examined]
### Code Areas Investigated
- [Function/Class/Module 1]
- [Function/Class/Module 2]
---
: High/Medium/Low (XX%)
:
[Evidence 1]
[Evidence 2]
:
[Counter-evidence]
:
Related to: Issue #YYY
Pattern match: High/Medium/Low
Regression candidate: Yes/No
:
[Detailed explanation of how this could cause the observed issue]
:
[Step 1 - specific and actionable]
[Step 2 - specific and actionable]
[Step 3 - specific and actionable]
---
[Same structure as Hypothesis 1]
---
[Same structure as Hypothesis 1]
---
| Priority | Hypothesis | Rationale | Similar Issue |
| |----------|------------|-----------|------------------------|
| 1 | [Hypothesis name] | [Why this should be investigated first] | #YYY (if applicable) |
| 2 | [Hypothesis name] | [Why second] | #ZZZ (if applicable) |
---
[Action 1]
[Action 2]
[If regression]: Check commit that introduced regression
[If recurring]: Review why previous fix didn't prevent this
[If new pattern]: Document as new issue type
[Information that would help narrow down the cause]
[Logs or data that should be collected]
[Direction 1 - possibly based on similar issue fix]
[Direction 2]
---
[Summary of the most likely root cause and confidence]
: [insights summary]
---
: Unable to determine definitive root cause
:
[Specific reason 1]
[Specific reason 2]
:
[Paste relevant error messages or stack traces]
### B. Code Snippets
```[language]
[Relevant code snippets]
C. Related Links & References
⚠️ MANDATORY: Include ALL links discovered during analysis
C.1 Related Issues
C.2 Related PRs
C.3 Related Commits
C.4 Code References
C.5 Documentation & Guides
C.6 External Resources
C.7 Root Cause Case Library
Link to similar resolved cases for reference:
C.8 All Search Queries Used
Query 1: "error_message repo:owner/repo state:all"
→ Results: X issues found
→ Relevant: #YYY, #ZZZ
Query 2: "symptom repo:owner/repo state:all"
→ Results: Y issues found
→ Relevant: #AAA
Query 3: "label:bug repo:owner/repo is:closed"
→ Results: Z issues found
→ Relevant: None
D. Quick Reference Links Summary
Most Important Links (Bookmark These):
- This Issue: https://github.com/owner/repo/issues/XXX
- Most Similar Issue: https://github.com/owner/repo/issues/YYY
- Previous Fix PR: https://github.com/owner/repo/pull/ABC
- Suspect Code File: https://github.com/owner/repo/blob/main/path/to/file.py
- Documentation: https://docs.example.com/...
---
## Tools to Use
- **GitHub**: `github_get_issue`, `github_search_issues`, `github_search_code`, `github_list_commits`
- **Code search**: `grep`, `glob`
- **File reading**: `read`
- **Web search**: For external context
- **Link construction**:
- Issue: `https://github.com/{owner}/{repo}/issues/{number}`
- PR: `https://github.com/{owner}/{repo}/pull/{number}`
- Commit: `https://github.com/{owner}/{repo}/commit/{sha}`
- File: `https://github.com/{owner}/{repo}/blob/{branch}/{path}#L{line}`
---
## Best Practices
1. **Search similar issues first** - This is the top priority before code analysis
2. **Use multiple search strategies** - Combine error, symptom, component searches
3. **Check for regressions** - Recently closed similar issues may indicate regression
4. **Start with error message** - Trace it back through the code
5. **Check recent changes** - Git blame/history for affected files
6. **Be explicit about uncertainty** - Better to say "unknown" than guess
7. **Provide actionable steps** - Each hypothesis should have verification steps
8. **[MANDATORY] Save the report** - Analysis is incomplete until saved to file
9. **[MANDATORY] Collect ALL links** - Every issue, PR, commit, file, doc link must be in the report
10. **Format links as clickable** - Use markdown: `[Title](URL)`
11. **Include line numbers** - Use `#L100` for specific lines
---
## Complete Workflow Example
1. User: "分析 GitHub issue #123"
2. Extract issue details using `github_get_issue`
3. **PRIORITY: Search similar issues** using `github_search_issues`
4. **Collect all relevant links** (issues, PRs, commits, files)
5. Analyze similar issues for patterns and fixes
6. Search code using `grep` and `github_search_code`
7. Review commits using `github_list_commits`
8. Read relevant files using `read`
9. Generate hypotheses with probability estimates
10. **Compile all discovered links**
11. **Write to `123_rca.md`** (must include all links in Appendix)
12. Inform: "分析完成,报告已保存到 123_rca.md"
---
## Link Collection Checklist
During analysis, track and output these link types:
- [ ] Related issues (from search results)
- [ ] Related PRs (from issue references or search)
- [ ] Related commits (from git history)
- [ ] Code files with line numbers
- [ ] Documentation links
- [ ] External resources (Stack Overflow, blogs, etc.)
**Every link should be formatted as a clickable markdown link in the report.**