.claude/skills/bug-report/SKILL.md
Template-driven bug reproduction and TDD-first fixing pipeline. Orchestrates: bug template reading, duplication check (regression-aware), GitHub issue creation, branch/worktree setup, bug reproduction with agent-browser, root cause analysis, PRD generation with TDD-first story ordering, Ralph JSON conversion, commit/push, and Ralph execution. Use when you have a bug to reproduce and fix. Triggers on: bug report, fix bug, reproduce bug, bug to fix, report bug, tdd fix.
npx skillsauth add ruska-ai/orchestra bug-reportInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Converts a bug description or existing GitHub issue into a fully diagnosed and fixed feature by orchestrating the complete pipeline: template reading, reproduction, root cause analysis, TDD-first PRD generation, Ralph conversion, and autonomous execution.
BUG: $ARGUMENTS.bug (optional if url is provided)
URL: $ARGUMENTS.url (optional if bug is provided)
ORCHESTRA_PROJECT_ROOT: The orchestra project root — the git repository root where .claude/, .worktrees/, and Makefile live. Resolve via git rev-parse --show-toplevel. All paths in this skill are anchored to this variable. Always cd $ORCHESTRA_PROJECT_ROOT before running commands to ensure worktrees are created in the correct location.
BUG_TEMPLATE_PATH: .github/ISSUE_TEMPLATE/bug_report.md
WORKSPACE_DOCS: orchestra/wiki
Exactly one of bug or url must be provided.
bugbug="When clicking Save on assistant edit, validation error appears even with model selected."
The skill will parse the description, derive severity, and extract reproduction steps.
urlurl="https://github.com/ruska-ai/orchestra/issues/796"
When url is provided the skill extracts all context from the existing issue:
gh issue view <URL> --json number,title,body,labelsCommit after every phase that produces artifacts. Each phase's output should be committed and pushed immediately so that:
The pattern at the end of each artifact-producing phase:
cd $ORCHESTRA_PROJECT_ROOT/.worktrees/bug-<issue#>
git add <phase artifacts>
git commit -s -m "<phase commit message>"
git push
MANDATORY first step. Read the bug report template to extract conventions before any other work.
$ORCHESTRA_PROJECT_ROOT/.github/ISSUE_TEMPLATE/bug_report.mdbug/[issue#]-[shortdesc])FROM bug/[issue#]-[shortdesc] TO development)$WORKSPACE/.worktrees/bug-[issue#])agent-browser for E2E)$ORCHESTRA_PROJECT_ROOT/wiki for bug context and documentationurl was provided:https://github.com/<owner>/<repo>/issues/<number>)gh issue view <URL> --json number,title,body,labelsfix: prefix)## Bug Scope (from Issue #<number>)
**Issue**: #<number> - <title>
**Bug name**: <bug-name>
**Severity**: <severity>
**Stories** (<N> total):
- BS-001: <broken-experience story 1>
- BS-002: <broken-experience story 2>
...
**Steps to Reproduce**:
1. <step 1>
2. <step 2>
...
**Root Cause Hypothesis**: <hypothesis or "Unknown">
Does this look correct? (y/n)
bug was provided:save-validation-error)## Bug Scope
**Bug name**: <bug-name>
**Severity**: <severity>
**Stories** (<N> total):
- BS-001: <broken-experience story 1>
...
**Steps to Reproduce**:
1. <step 1> (derived from description)
...
Does this look correct? (y/n)
Skipped when
urlis provided — the issue already exists on GitHub.
Check for existing work that overlaps with this bug:
gh issue list --search "<bug keywords>" --state open --json number,title,urlgh issue list --search "<bug keywords>" --state closed --json number,title,urlgit branch -a | grep -i "<bug keywords>" (case-insensitive search)git worktree listSkipped when
urlis provided — the issue already exists on GitHub.
COMPOSE issue body following the bug_report.md template:
## Metadata
```yml
pull_request_title: "FROM bug/<issue#>-<bug-name> TO development"
branch: "bug/<issue#>-<bug-name>"
worktree_path: "$WORKSPACE/.worktrees/bug-<issue#>"
<Best guess or "To be investigated">
agent-browser CLI
CREATE the issue:
gh issue create --title "fix: <bug-name>" --body "<body>" --label "bug"CAPTURE the issue number from output
REPORT "Created issue #<number>: fix: <bug-name>"
bug/<issue#>-<bug-name>$ORCHESTRA_PROJECT_ROOT/.worktrees/bug-<issue#>git fetch origin developmentgit worktree add $ORCHESTRA_PROJECT_ROOT/.worktrees/bug-<issue#> -b bug/<issue#>-<bug-name> origin/developmentcd $ORCHESTRA_PROJECT_ROOT/.worktrees/bug-<issue#> && bash $ORCHESTRA_PROJECT_ROOT/backend/scripts/changelog.shcd $ORCHESTRA_PROJECT_ROOT/.worktrees/bug-<issue#> && git add Changelog.md && git commit -s -m "init bug/<issue#>-<bug-name>"cd $ORCHESTRA_PROJECT_ROOT/.worktrees/bug-<issue#> && git push -u origin bug/<issue#>-<bug-name>gh issue comment <issue#> --body "$(cat <<'EOF'
## Investigation Started
**Branch**: `bug/<issue#>-<bug-name>`
**Worktree**: `$ORCHESTRA_PROJECT_ROOT/.worktrees/bug-<issue#>`
**PR title**: `FROM bug/<issue#>-<bug-name> TO development`
EOF
)"
cd $ORCHESTRA_PROJECT_ROOT/.worktrees/bug-<issue#> && gh pr create \
--draft \
--base development \
--title "FROM bug/<issue#>-<bug-name> TO development" \
--body "$(cat <<'EOF'
## Summary
Resolves #<issue#>
## Status
Pipeline in progress — this PR will be marked ready for review when Ralph completes.
Generated by `/bug-report` skill.
EOF
)"
Key differentiator from feature-dev. Before any fix is attempted, the bug must be reliably reproduced.
cd $ORCHESTRA_PROJECT_ROOT/.worktrees/bug-<issue#>agent-browser to navigate and interactcurl or equivalent to trigger the endpointtasks/screenshots/bug-<issue#>-before.png using agent-browser screenshotcd $ORCHESTRA_PROJECT_ROOT/.worktrees/bug-<issue#> && git add tasks/screenshots/ && git commit -s -m "evidence: bug #<issue#> reproduction" && git pushMANDATORY before PRD generation. Enter plan mode to analyze the root cause and design a TDD-first fix strategy.
cd $ORCHESTRA_PROJECT_ROOT/.worktrees/bug-<issue#>$ORCHESTRA_PROJECT_ROOT/wiki for contextgit log --oneline --all --grep="<relevant keywords>" to find related changesgit log --oneline -20 to check recent commits for potential regression sources.claude/plans/bug-<issue#>/plan-0.md:
mkdir -p $ORCHESTRA_PROJECT_ROOT/.worktrees/bug-<issue#>/.claude/plans/bug-<issue#>.claude/plans/bug-<issue#>/plan-0.md — this file becomes the input for PRD generation in Phase 6## Root Cause Analysis for #<issue#>: <bug-name>
### Root Cause
<description of what is actually broken and why>
### Affected Files
- <file 1>: <what needs to change>
- <file 2>: <what needs to change>
...
### TDD-First Fix Strategy
1. Write failing regression test that reproduces the exact bug
2. <fix step 1>
3. <fix step 2>
...
4. Verify all tests pass (existing + new)
### Regression Risk
- <what could break if the fix is wrong>
- <related features to verify>
### Regression Source (if applicable)
- Commit: <hash> — <message>
- Introduced in: <PR or date>
Plan stored at: `.claude/plans/bug-<issue#>/plan-0.md`
This phase produces two artifacts in sequence: the PRD markdown file (via /prd), then the Ralph JSON config (via /ralph). The output of /prd is the direct input to /ralph.
/prd skill with the approved plan and broken-experience stories:
Load the prd skill and create a PRD for:
Bug Fix: <bug-name> (Issue #<issue#>)
## Root Cause Analysis
<analysis from Phase 5>
## Broken-Experience Stories
<all stories from BUG variable or extracted from issue>
IMPORTANT TDD-first sizing rules for Ralph compatibility:
- FIRST story: "Write failing regression test" — must reproduce the exact bug in a test
- Middle stories: implement the fix (1-3 files per story max)
- Second-to-last story: "Verify all tests pass, no regressions" — run full test suite
- LAST story: git status check + commit/push
- Each user story must be completable in ONE iteration (one context window)
- One story should touch 1-3 files max
- Backend and frontend changes are SEPARATE stories
- Add "Typecheck passes" to every story
- Add "Verify in browser using agent-browser skill" to UI-related stories
- Add "Take screenshot with agent-browser for visual walkthrough" to UI-related stories
tasks/prd-bug-<bug-name>.mdcd $ORCHESTRA_PROJECT_ROOT/.worktrees/bug-<issue#> && git add tasks/prd-bug-<bug-name>.mdcd $ORCHESTRA_PROJECT_ROOT/.worktrees/bug-<issue#> && git commit -s -m "docs: add PRD for bug #<issue#>"cd $ORCHESTRA_PROJECT_ROOT/.worktrees/bug-<issue#> && git pushFeed tasks/prd-bug-<bug-name>.md from Step 1 directly into the /ralph skill.
/ralph skill with the PRD file as input (archiving already handled in Phase 3):
Load the ralph skill and convert tasks/prd-bug-<bug-name>.md to .ralph/prd.json
CRITICAL: Set branchName to "bug/<issue#>-<bug-name>" (must match the worktree branch exactly). Do NOT use the "ralph/" prefix.
.ralph/prd.json exists and contains valid JSONbug/<issue#>-<bug-name>:
jq -r '.branchName' .ralph/prd.jsoncd $ORCHESTRA_PROJECT_ROOT/.worktrees/bug-<issue#> && git add .ralph/prd.json .ralph/progress.txtcd $ORCHESTRA_PROJECT_ROOT/.worktrees/bug-<issue#> && git commit -s -m "chore: add Ralph config for bug #<issue#>"cd $ORCHESTRA_PROJECT_ROOT/.worktrees/bug-<issue#> && git pushAll artifacts have been committed and pushed incrementally in previous phases. This phase archives Ralph artifacts, catches any stragglers, generates a reviewer report, and marks the draft PR as ready for review.
archive/bug-<issue#>/:
mkdir -p $ORCHESTRA_PROJECT_ROOT/.worktrees/bug-<issue#>/.ralph/archive/bug-<issue#>cp $ORCHESTRA_PROJECT_ROOT/.worktrees/bug-<issue#>/.ralph/prd.json $ORCHESTRA_PROJECT_ROOT/.worktrees/bug-<issue#>/.ralph/archive/bug-<issue#>/prd.jsoncp $ORCHESTRA_PROJECT_ROOT/.worktrees/bug-<issue#>/.ralph/progress.txt $ORCHESTRA_PROJECT_ROOT/.worktrees/bug-<issue#>/.ralph/archive/bug-<issue#>/progress.txtrm $ORCHESTRA_PROJECT_ROOT/.worktrees/bug-<issue#>/.ralph/prd.json $ORCHESTRA_PROJECT_ROOT/.worktrees/bug-<issue#>/.ralph/progress.txtcd $ORCHESTRA_PROJECT_ROOT/.worktrees/bug-<issue#> && git add .ralph/archive/bug-<issue#>/ && git add -A && git commit -s -m "chore: archive Ralph artifacts for bug #<issue#>"cd $ORCHESTRA_PROJECT_ROOT/.worktrees/bug-<issue#> && git push.ralph/archive/bug-<issue#>/progress.txt and tasks/prd-bug-<bug-name>.md to summarize what was fixed## Summary
Resolves #<issue#>
## Root Cause
- <brief root cause description>
## What Changed
- <bullet summary of fix steps and key changes>
## Stories Completed
- [x] US-001: Write failing regression test
- [x] US-002: <fix title>
...
- [x] US-00N: Verify all tests pass, no regressions
## Testing
- <regression test added>
- <how to verify the fix>
- <any agent-browser screenshots or evidence>
## Notes
- <any caveats, follow-ups, or reviewer callouts>
Generated by `/bug-report` skill.
cd $ORCHESTRA_PROJECT_ROOT/.worktrees/bug-<issue#> && gh pr edit --body "<reviewer report>"cd $ORCHESTRA_PROJECT_ROOT/.worktrees/bug-<issue#> && gh pr readytmux new-session -d -s bug-<issue#> -c $ORCHESTRA_PROJECT_ROOT/.worktrees/bug-<issue#> "make -C $ORCHESTRA_PROJECT_ROOT ralph"# Attach to Ralph session
tmux attach -t bug-<issue#>
# Check progress
cat $ORCHESTRA_PROJECT_ROOT/.worktrees/bug-<issue#>/.ralph/progress.txt
## Bug Report Complete
**Issue**: #<issue#> - fix: <bug-name>
**Severity**: <severity>
**Branch**: bug/<issue#>-<bug-name>
**Worktree**: $ORCHESTRA_PROJECT_ROOT/.worktrees/bug-<issue#>
**PR**: <PR URL> (draft → ready for review)
**PRD**: tasks/prd-bug-<bug-name>.md
**Ralph config**: .ralph/prd.json (<N> user stories, TDD-first)
**Tmux session**: bug-<issue#>
### Root Cause
<brief root cause description>
### Stories (TDD-First Order)
- US-001: Write failing regression test
- US-002: <fix step 1>
- ...
- US-00N-1: Verify all tests pass, no regressions
- US-00N: Git status check + commit/push
### Next Steps
- Monitor: `tmux attach -t bug-<issue#>`
- Progress: `cat $ORCHESTRA_PROJECT_ROOT/.worktrees/bug-<issue#>/.ralph/progress.txt`
.claude/plans/bug-<issue#>/plan-0.md — these become PRD inputorchestra/wiki — consult for bug context and documentationbug/ prefix, NOT ralph/ — it must match the worktree branch exactly-s flag) per repository guidelinesbug nor url provided: REPORT "You must provide either bug or url. See examples below."gh auth status"bug argument."make -C $ORCHESTRA_PROJECT_ROOT dev"git worktree remove $ORCHESTRA_PROJECT_ROOT/.worktrees/bug-<issue#> first."/prd manually."/ralph manually."bug/<issue#>-<bug-name>cd $ORCHESTRA_PROJECT_ROOT/.worktrees/bug-<issue#> && git push -u origin bug/<issue#>-<bug-name>"cd $ORCHESTRA_PROJECT_ROOT/.worktrees/bug-<issue#> && make -C $ORCHESTRA_PROJECT_ROOT ralph"/bug-report url="https://github.com/ruska-ai/orchestra/issues/796"
Extracts broken-experience stories from issue #796, skips duplication check and issue creation, then:
bug/796-<slugified-title>$ORCHESTRA_PROJECT_ROOT/.worktrees/bug-796/bug-report bug="When clicking Save on assistant edit, validation error appears even with model selected."
Creates:
fix: save-validation-errorbug/803-save-validation-error./.worktrees/bug-803bug-803tools
Apply coordinated changes across multiple files efficiently using parallel Edit tool calls. Use when making systematic changes like renaming variables, updating imports, applying pattern changes, or refactoring across files. Triggers on: rename across files, update all imports, change pattern in multiple files, refactor across codebase, batch edit files.
testing
Record browser workflows as video and convert to high-quality GIFs using agent-browser and ffmpeg. Use when users ask to record workflow, create gif, record demo, browser recording, workflow gif, or screen recording.
development
Run and verify frontend tests for the React/Vite application.
development
Run and verify backend tests for the FastAPI/Python application.