Skip to content

Commit 8a48496

Browse files
chore: enhance root cause analysis for /create-bug skill (MetaMask#26722)
## **Description** Updates the `/create-bug` Claude Code skill command to include a full root cause analysis workflow (Step 6) with three phases: - **6a**: Investigate root cause — trace through the code to identify exact files, lines, and logic - **6b**: Identify regression PRs — check git history against previous releases - **6c**: Scope analysis — search for same pattern across codebase, file separate bugs for other affected features Also updates the comment format to include all required sections. ## **Changelog** CHANGELOG entry: null ## **Related issues** Fixes: [MMQA-1523](https://consensyssoftware.atlassian.net/browse/MMQA-1523) ## **Manual testing steps** ```gherkin Feature: Create Bug Skill Root Cause Analysis Scenario: user runs /create-bug and opts into root cause investigation Given user has Claude Code open in the metamask-mobile repo When user runs /create-bug and files a bug report And user opts into root cause investigation Then Claude performs root cause investigation (6a) And Claude identifies regression PRs by comparing release branches (6b) And Claude performs scope analysis to find same pattern elsewhere (6c) And Claude posts a comment with summary, regression PRs, error flow, scope of impact, key files, suggested fix, and related bug links ``` ## **Screenshots/Recordings** ### **Before** N/A ### **After** Run `/create-bug` in Claude Code terminal and opt into root cause investigation to see the full 3-phase workflow. ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I've included tests if applicable - [x] I've documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I've applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. [MMQA-1523]: https://consensyssoftware.atlassian.net/browse/MMQA-1523?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 1591e2d commit 8a48496

1 file changed

Lines changed: 33 additions & 5 deletions

File tree

.claude/commands/create-bug.md

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,15 +124,43 @@ For `render: shell` fields, wrap the value in a code fence:
124124
- Output the issue URL so the user can view it
125125
- Ask the user: "Would you like me to investigate the codebase for the possible root cause? (yes/no)"
126126
- Default is **no** — only proceed if the user explicitly says yes
127-
- If yes, investigate the codebase (research only — no code changes) and add a comment using:
127+
- If yes, perform the full **Root Cause Analysis** (Step 6)
128+
129+
## Step 6: Root Cause Analysis
130+
131+
When the user opts in, perform all three phases below and post a single comment on the issue with the combined findings.
132+
133+
### 6a: Investigate the root cause
134+
135+
- Trace the bug through the code to identify the exact files, lines, and logic causing the issue
136+
- Research only — no code changes
137+
138+
### 6b: Identify regression PRs
139+
140+
- Check `git log` history of affected files, comparing the release branch against the previous release branch
141+
- Identify which PRs introduced or surfaced the bug (new code, removed compensating mechanisms, refactors, etc.)
142+
- Note whether the issue is a new regression or pre-existing
143+
144+
### 6c: Scope analysis
145+
146+
- Search the codebase for the same pattern, function, or anti-pattern causing the bug
147+
- Identify all affected areas beyond the originally reported bug
148+
- If other features are impacted, file separate bug issues for each and link them
149+
150+
### Comment format
151+
152+
Post findings as a comment using:
128153

129154
```bash
130155
gh issue comment <issue-number> --repo MetaMask/metamask-mobile --body "..."
131156
```
132157

133158
The comment should include:
134159

135-
- A summary of the possible root cause
136-
- The error flow with relevant file paths and line numbers
137-
- Key files table (file, line(s), description)
138-
- A suggested fix approach
160+
- **Summary** of the root cause
161+
- **Likely Regression PR(s)** — PR numbers, titles, authors, and explanation of what changed (or note if pre-existing)
162+
- **Error flow** with relevant file paths and line numbers
163+
- **Full scope of impact** — all affected files, hooks, and components beyond the reported bug
164+
- **Key files table** (file, line(s), description)
165+
- **Suggested fix approach**
166+
- **Links to related bugs** filed from the scope analysis

0 commit comments

Comments
 (0)