bug
Create a bug sub-issue interactively or with a title, or add existing issues to a tracking PR
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Create a bug sub-issue interactively or with a title, or add existing issues to a tracking PR
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Automatically implement all sub-issues of an epic in dependency order
Implement a GitHub issue with automated PR creation
End-of-session retrospective. Captures knowledge from any working session (debug, implementation, config, deployment) as reusable scripts, CLAUDE.md procedures, or skill proposals. Run before ending a session to prevent knowledge loss.
Decompose a large GitHub issue into sub-issues and create a tracking draft PR
OWASP-guided security code review for a specific domain or issue
Project kickoff checklist based on lessons learned from previous projects. Generates a tailored checklist and optionally creates GitHub issues.
| name | bug |
| description | Create a bug sub-issue interactively or with a title, or add existing issues to a tracking PR |
| argument-hint | ["<bug title>"] | [<parent> "<title>"] | [add #issue [to #parent]] |
| user-invocable | true |
Create a bug issue with intelligent context gathering, or add existing bug issues to a tracking PR.
The user provides: $ARGUMENTS
Three modes of operation:
add #<issue> [#<issue>...] [to #<parent>]Examples:
/bug add #1042 # Add existing issue #1042 as bug, parent from branch
/bug add #1042 to #723 # Add existing issue #1042 as bug to epic #723
/bug add #1042 #1043 # Add multiple existing bug issues at once
"<bug title>" - Auto-detect parent from branch<parent-issue> "<bug title>" - Explicit parent overrideExamples:
/bug "Webhook signature fails in test mode" # Parent from branch
/bug 724 "Webhook signature fails in test mode" # Explicit parent #724
Examples:
/bug # Interactive mode: gather context, write issue
Disambiguation: add → Mode 1. No arguments → Mode 3. Anything else → Mode 2.
Use this when you have already-created bug issues that need to be linked to an epic's tracking PR.
Extract from $ARGUMENTS (after stripping the add keyword):
#<number> tokens before the to keyword (strip the # prefix)#<number> after to, or auto-detect from branch if no to keyword# Auto-detect parent from branch if needed
PARENT_ISSUE=$(~/.claude/bin/extract-issue-from-branch.sh)
If no parent found and no to #<parent> given: ask the user to provide one explicitly.
~/.claude/bin/find-tracking-pr.sh <repo> $PARENT_ISSUE
If no tracking PR exists: Inform the user and suggest using /decompose first.
If parent is a sub-issue, also find the grandparent tracking PR:
~/.claude/bin/gh-save.sh /tmp/parent-issue-body.json issue view [parent-issue] --json body
Use the Read tool to read /tmp/parent-issue-body.json and find Parent issue: #\d+ to get the grandparent issue number.
Fetch details for all issues to be added:
~/.claude/bin/batch-issue-view.sh <repo> [issue-numbers...]
Use the Read tool to read the output. For each issue, extract: number, title, state, labels.
For each issue, ensure the bug label is present:
gh issue edit [issue-number] --add-label "bug"
Also inherit relevant labels from the parent issue (e.g., payment, backend).
5a. Add Closes statements for each new issue (append after existing Closes lines):
Closes #[existing-issues]
Closes #1042 ← NEW
5b. Add rows to tracking table for each new issue (with 🐛 prefix):
| # | Sub-Issue | Status | PR |
|---|-----------|--------|-----|
| ... existing entries ... |
| N | #1042 - 🐛 Bug: [Issue title] | ⏳ Pending | - | ← NEW
Map issue state to status: OPEN → ⏳ Pending, CLOSED → ✅ Complete.
5c. Update progress line to reflect the new total.
Link the added bug issues to the parent issue using the GitHub GraphQL API:
gh api graphql -f query='
{
repository(owner: "OWNER", name: "REPO") {
parent: issue(number: [parent-number]) { id }
sub1: issue(number: [sub-number-1]) { id }
...
}
}'
gh api graphql -f query='
mutation {
addSubIssue(input: {issueId: "[parent-node-id]", subIssueId: "[sub-node-id]"}) {
issue { number }
subIssue { number }
}
}'
Do this for ALL added issues. This enables GitHub's native sub-issue tracking in the UI.
## Bug Issues Added to Epic
✅ Added #1042 - 🐛 [title] to tracking PR #[pr-number]
✅ Bug label added
✅ Closes statements updated
✅ Progress: X of Y sub-issues complete (Z%)
### Quick Links
- Tracking PR: #[pr-number]
- Parent issue: #[parent-issue]
- Bug issue: #1042
Use this when no arguments are provided. Gathers context interactively and writes a well-structured issue.
Try to detect parent from the current branch:
PARENT_ISSUE=$(~/.claude/bin/extract-issue-from-branch.sh)
Gather context automatically to enrich the bug report:
git log --oneline -10
git diff --stat
/tmp/ (e.g., pytest output files)mcp__sentry__*) are available, fetch recent unresolved issues for the projectStore this context internally — do NOT display it to the user yet.
Ask with AskUserQuestion (use an option that allows free text):
"Beschrijf de bug. Je kunt hier alles kwijt: beschrijving, log output, foutmeldingen, bestandspaden, screenshots — alles door elkaar. Ik sorteer het wel uit."
The user can dump everything at once in any order:
Analyze the user's dump and classify:
Traceback, Error:, at line, TypeError, 500, etc.)Only ask about information that was NOT in the dump. Use AskUserQuestion to ask multiple missing items at once (max 4 questions per call).
Possible follow-up questions (only if missing):
If the dump is already complete enough (description + evidence + severity inferable from context), skip follow-up questions and go directly to Step I6.
Combine all user input + auto-context into a structured issue body:
## Bug Description
<Rewritten description based on user input + auto-context>
## Steps to Reproduce
1. ...
2. ...
3. ...
## Expected Behavior
<Derived from description>
## Actual Behavior
<Derived from description>
## Evidence
<Relevant code fragments, log output, error messages — from step I3>
<If file references were provided: include relevant snippets>
## Context
- Branch: <current-branch>
- Recent changes: <summary of git log>
- Discovered while working on: #<parent-issue> (if available)
- Severity: <chosen or inferred severity>
Show the generated issue (title + body) to the user.
Ask with AskUserQuestion: "Ziet dit er goed uit?"
/tmp/bug-issue.md using the Write tool🐛 [Parent #XXX] Bug: <title>🐛 Bug: <title>gh issue create --title "<title>" --label "bug" --body-file /tmp/bug-issue.md
gh issue edit [new-issue] --add-label "priority: high"
If linked to parent:
## Bug Issue Created
✅ Created: #[new-issue-number] - 🐛 Bug: [title]
✅ Parent: #[parent-issue]
✅ Added to tracking PR #[pr-number]
✅ Will auto-close when PR merges
### Quick Links
- Bug issue: [url]
- Parent issue: #[parent-issue]
- Tracking PR: #[pr-number]
If standalone:
## Bug Issue Created
✅ Created: #[new-issue-number] - 🐛 Bug: [title]
ℹ️ Standalone issue — not linked to an epic
### Quick Links
- Bug issue: [url]
Check if first argument is a number:
$ARGUMENTS starts with a number → use that as parent issueExtract from branch:
PARENT_ISSUE=$(~/.claude/bin/extract-issue-from-branch.sh)
Example branch names:
issue-724-stripe-webhook → parent = 724issue-723-stripe-payment-provider → parent = 723If no parent found: Ask the user to provide one explicitly.
After determining parent issue, the rest of $ARGUMENTS is the bug title.
Parse:
/bug "Webhook fails" → parent=from branch, title="Webhook fails"/bug 724 "Webhook fails" → parent=724, title="Webhook fails"~/.claude/bin/gh-save.sh /tmp/parent-issue.json issue view [parent-issue] --json number,title,labels
Use the Read tool to read /tmp/parent-issue.json.
Search for the tracking/parent PR:
~/.claude/bin/find-tracking-pr.sh <repo> [parent-issue]
If parent is a sub-issue (e.g., #724), also find the grandparent tracking PR:
~/.claude/bin/gh-save.sh /tmp/parent-issue-body.json issue view [parent-issue] --json body
Use the Read tool to read /tmp/parent-issue-body.json and find Parent issue: #\d+ to get the grandparent issue number.
First write the body using the Write tool to /tmp/bug-issue.md:
## Parent Issue
Related to #[parent-issue] ([parent title])
## Bug Description
[To be filled in]
## Steps to Reproduce
1.
2.
3.
## Expected Behavior
## Actual Behavior
## Context
- Discovered while working on: #[parent-issue]
- Branch: [current-branch]
---
_This bug blocks the completion of #[parent-issue]_
Then create the issue:
gh issue create --title "🐛 [Parent #XXX] Bug: [bug title]" --label "bug" --body-file /tmp/bug-issue.md
Link the newly created bug issue to the parent issue using the GitHub GraphQL API:
gh api graphql -f query='
{
repository(owner: "OWNER", name: "REPO") {
parent: issue(number: [parent-number]) { id }
bug: issue(number: [new-bug-number]) { id }
}
}'
gh api graphql -f query='
mutation {
addSubIssue(input: {issueId: "[parent-node-id]", subIssueId: "[bug-node-id]"}) {
issue { number }
subIssue { number }
}
}'
Update the tracking PR to include the new bug:
6a. Add to Closes statements (at top of PR body):
Closes #[parent-issue]
Closes #[other-sub-issues]
Closes #[NEW-BUG-ISSUE] ← Add this
6b. Add to tracking table:
| # | Sub-Issue | Status | PR |
|---|-----------|--------|-----|
| ... | existing entries ... | ... | ... |
| N | #[NEW] - 🐛 Bug: [title] | ⏳ Pending | - |
## Bug Issue Created
✅ Created: #[new-issue-number] - 🐛 Bug: [title]
✅ Parent: #[parent-issue]
✅ Added to tracking PR #[pr-number]
✅ Will auto-close when PR merges to develop
### Quick Links
- Bug issue: [url]
- Parent issue: #[parent-issue]
- Tracking PR: #[pr-number]
### Next Steps
- Fix the bug in your current branch
- Or create a separate branch: `git checkout -b issue-[new-bug-number]-fix`
Automatically add labels:
bug - alwayspayment, backend)gh issue edit [new-issue] --add-label "bug"
$ git branch --show-current
issue-724-stripe-webhook
$ /bug "Signature verification fails for test webhooks"
Detected parent issue: #724 (from branch: issue-724-stripe-webhook)
Creating bug issue...
✅ Created: #731 - 🐛 [Parent #724] Bug: Signature verification fails for test webhooks
Finding tracking PR...
✅ Found: PR #727 (Stripe Payment Provider)
Updating tracking PR...
✅ Added "Closes #731" to PR #727
✅ Added #731 to tracking table
Done! Bug #731 will auto-close when PR #727 merges.