6.4 KiB
name, description, model, argument-hint, allowed-tools, user-invocable
| name | description | model | argument-hint | allowed-tools | user-invocable |
|---|---|---|---|---|---|
| spawn-pr-fixers | Fix one or more PRs based on review feedback using pr-fixer agents. Creates isolated worktrees, addresses review comments, commits and pushes fixes. Use when PRs need work, or when user says /spawn-pr-fixers. | claude-haiku-4-5 | <pr-number> [<pr-number>...] | Bash, Task, Read, TaskOutput | true |
Spawn PR Fixers
@/.claude/skills/worktrees/SKILL.md
@/.claude/skills/gitea/SKILL.md
Fix one or more pull requests that have review feedback using pr-fixer agents.
Arguments
One or more PR numbers: $ARGUMENTS
Example: /spawn-pr-fixers 55 56 57
Workflow
Concurrent Fixes - each PR fixed independently:
PR #55 ──► fetch branch ──► create worktree ──► read feedback ──► fix ──► commit ──► push ✓
PR #56 ──► fetch branch ──► create worktree ──► read feedback ──► fix ──► commit ──► push ✓
PR #57 ──► fetch branch ──► create worktree ──► read feedback ──► fix ──► commit ──► push ✓
Event-driven: As each fix completes, show results immediately.
Process
1. Parse and Validate
Parse $ARGUMENTS into PR numbers. If empty:
Usage: /spawn-pr-fixers <pr-number> [<pr-number>...]
Example: /spawn-pr-fixers 55 56
2. Setup Repository Context
REPO_PATH=$(pwd)
REPO_NAME=$(basename "$REPO_PATH")
WORKTREES_DIR="${REPO_PATH}/../worktrees"
Verify in git repository:
git rev-parse --git-dir >/dev/null 2>&1 || exit 1
3. Fetch PR Details and Create Worktrees
For each PR number:
Get PR details:
tea pulls <PR_NUMBER>
Extract:
- Branch name (e.g., "issue-42-feature-name")
- PR title
- PR state (verify it's open)
Check for review comments:
tea pulls <PR_NUMBER> --comments
Verify there are review comments. If no comments:
[PR #<NUMBER>] No review comments found - skipping
Create fix worktree:
cd "$REPO_PATH"
git fetch origin
fix_worktree=$(~/.claude/skills/worktrees/scripts/create-worktree.sh review <PR_NUMBER> <BRANCH_NAME>)
Track PR state:
prs = {
55: {
worktree: "/path/to/worktrees/repo-review-55",
branch: "issue-42-feature",
title: "Add user authentication",
stage: "ready",
task_id: null
},
...
}
Print initial status:
Created fix worktrees for 3 PRs:
[PR #55] ready - Add user authentication
[PR #56] ready - Fix validation bug
[PR #57] ready - Update documentation
4. Spawn PR Fixers
For each PR, spawn pr-fixer agent in background:
Task tool with:
- subagent_type: "pr-fixer"
- run_in_background: true
- prompt: "Fix PR #<PR_NUMBER> based on review feedback
Repository: <REPO_PATH>
PR number: <PR_NUMBER>
Worktree: <WORKTREE_PATH>
Follow the pr-fixer agent instructions to address review feedback.
Output the result in PR_FIXER_RESULT format."
Track task_id for each PR and update stage to "fixing".
Print status:
[PR #55] fixing...
[PR #56] fixing...
[PR #57] fixing...
5. Event-Driven Results
Wait for <task-notification> messages that arrive automatically when background tasks complete.
When notification arrives:
-
Identify which PR completed:
- Extract task_id from notification
- Look up which PR this belongs to
-
Read task output:
TaskOutput tool with task_id -
Parse result:
- Extract status (fixed/partial/failed)
- Extract changes summary
-
Print status update:
[PR #55] Fix complete: fixed ✓ [PR #56] Fix complete: partial (some issues unclear) [PR #57] Fix complete: fixed ✓ -
Check if all done:
- If all PRs fixed → proceed to cleanup and summary
6. Cleanup Worktrees
After all fixes complete:
cd "$REPO_PATH"
~/.claude/skills/worktrees/scripts/cleanup-worktrees.sh "$WORKTREES_DIR"
This removes all fix worktrees created during this run.
7. Final Summary
Print summary table with links:
All fixes complete!
| PR | Title | Status | Changes |
|-----|---------------------------|-------------|--------------------------------------|
| #55 | Add user authentication | fixed ✓ | Fixed error handling, added tests |
| #56 | Fix validation bug | partial | Fixed main issue, one unclear |
| #57 | Update documentation | fixed ✓ | Fixed typos, improved examples |
2 fully fixed, 1 partial
PRs updated:
- PR #55: https://git.flowmade.one/owner/repo/pulls/55
- PR #56: https://git.flowmade.one/owner/repo/pulls/56
- PR #57: https://git.flowmade.one/owner/repo/pulls/57
Next: Re-run reviews with /spawn-pr-reviews to verify fixes
Guidelines
Event-driven execution:
- Wait for task-notification messages
- Don't poll or check task status manually
- Process notifications as they arrive
- Fix each PR independently
Worktree management:
- Create fix worktrees upfront
- One worktree per PR
- Clean up all worktrees at end
- Always cleanup, even on error
State tracking:
- Track stage and task_id for each PR
- Update state when notifications arrive
- Print status after each transition
Error handling:
- If PR not found: skip it, continue with others
- If PR is closed: skip it, note in summary
- If no review comments: skip it, note why
- If branch not found: skip it, note error
- If fixer fails: mark as "failed"
- Always cleanup worktrees
Review iteration:
- This is one fix pass
- After fixes, use /spawn-pr-reviews to re-review
- Can repeat fix → review cycles manually
- For automated cycles, use /spawn-issues instead
Use Cases
When to use spawn-pr-fixers:
- PRs have review feedback that needs addressing
- Manual PRs from team members need fixes
- spawn-issues hit review iteration limit (3 cycles)
- You want to re-apply fixes after manual changes
- Quick fixes to existing PRs
When NOT to use spawn-pr-fixers:
- Implementing new issues (use /spawn-issues)
- Just reviewing PRs (use /spawn-pr-reviews)
- Need automated review loops (use /spawn-issues)
- PRs have no review comments yet
Tips
- Run after /spawn-pr-reviews identifies issues
- Can fix multiple PRs at once for efficiency
- Fixes are autonomous (agents make judgment calls)
- Review the fixes after completion
- Use /spawn-pr-reviews again to verify fixes
- For full automation, use /spawn-issues instead