Claude-skill-registry collect-for-pr
Collect pending worktree commits into a PR for review. Use this skill when subdirectory worktrees have accumulated 4-7+ commits that should be batched together and submitted for review. Invoked with /collect-for-pr or automatically when monitoring worktree status.
git clone https://github.com/majiayu000/claude-skill-registry
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/collect-for-pr" ~/.claude/skills/majiayu000-claude-skill-registry-collect-for-pr && rm -rf "$T"
skills/data/collect-for-pr/SKILL.mdCollect Commits for PR
You are a coordinator agent that gathers matched function commits from subdirectory worktrees into PRs for review. Your job is to batch commits efficiently and create well-organized pull requests.
When to Use This Skill
Use
/collect-for-pr when:
- Subdirectory worktrees have accumulated commits ready for review
- You want to batch 4-7+ commits into a single PR (flexible threshold)
- After a decomp session to collect completed work
Workflow
Step 1: Check Worktree Status
melee-agent worktree list --commits
This shows all subdirectory worktrees with their pending commits. Look for:
- Pending commits: How many commits are waiting on each worktree
- Total across worktrees: Whether there's enough work to batch
Automatic limits: The collect command now automatically limits PRs to 7 function match commits by default. Fix-up commits (build fixes, header updates, etc.) don't count toward this limit.
- Use
to adjust the limit--max-functions N - Use
to collect all pending commits--no-limit - Deferred commits remain on worktree branches for the next PR
Step 2: Dry Run First
Always preview what will be collected. The
--source-dir parameter is required:
melee-agent worktree collect --source-dir lb --dry-run
This shows:
- Which commits will be cherry-picked from that subdirectory
- Total commit count
Review the output for:
- Build fix commits that should go together with function matches
- Logical groupings within the subdirectory
Step 3: Collect and Create PR
If the dry run looks good, collect and create the PR:
melee-agent worktree collect --source-dir lb --create-pr
This will:
- Create a new branch from
(namedupstream/master
)batch/lb-YYYYMMDD - Cherry-pick pending commits from the specified subdirectory
- Push the branch to origin
- Create a GitHub PR with organized commit listing
- Reset pending commit counts in the database
Custom branch name (optional):
melee-agent worktree collect --source-dir lb --create-pr --branch "batch/lb-module-cleanup"
Step 4: Handle Conflicts
If cherry-picks fail:
- The command aborts the cherry-pick automatically
- Failed commits are listed with error details
- Successful commits are still collected
For failed commits:
- Note which subdirectories have conflicts
- The commits remain on their subdirectory branches
- They can be collected in a future PR after resolving
Step 5: Monitor PR and Fix Issues
After creating the PR, use the feedback command to monitor for issues:
# Get all PR feedback in one call melee-agent pr feedback https://github.com/doldecomp/melee/pull/XXXX # JSON output for automated processing melee-agent pr feedback https://github.com/doldecomp/melee/pull/XXXX --json
This command consolidates:
- CI check status - Pass/fail with parsed error messages (compile errors, linker errors)
- Review comments - Both inline and PR-level comments from reviewers
- decomp-dev report - Regressions and improvements detected by the bot
- Action items - Generated list of what needs to be fixed
If issues are found:
- Fix the issues on the appropriate subdirectory worktree
- Push fix commits to the PR branch
- Re-run
to verify fixesmelee-agent pr feedback
Step 6: Post-PR Cleanup
After the PR is merged, clean up empty worktrees:
melee-agent worktree prune --dry-run # Preview melee-agent worktree prune # Execute
Decision Framework
Should I Create a PR Now?
Each subdirectory worktree is collected separately. Consider each subdirectory independently:
| Situation | Recommendation |
|---|---|
| 5-7 function matches in a subdirectory | Yes, good batch size (default limit) |
| 8+ function matches | Run collect (it will auto-limit to 7, defer the rest) |
| 2-4 function matches but work has stopped | Yes, ship what's ready |
| 1-2 function matches with active work ongoing | Wait for more |
| Many fix-up commits | Include them - they don't count toward limit |
Note: The
--max-functions limit only counts function match commits. Fix-up commits
(build fixes, header updates, signature changes) are always included and don't count.
PR Timing
- End of work session: Collect all completed work
- Before switching focus: Don't leave commits unbatched
- Module completion: When finishing a focused module push
- CI keeps up: Don't create multiple PRs faster than CI can process
What the Commands Do
worktree list
worktree listShows all subdirectory worktrees with status:
- Commits pending (ahead of upstream/master)
- Lock status
- Last activity time
- Uncommitted changes (work in progress)
worktree collect --source-dir <subdir>
worktree collect --source-dir <subdir>Cherry-picks commits from a specific subdirectory branch:
- Requires
to specify which subdirectory to collect--source-dir - Creates new branch from upstream/master (named
)batch/<subdir>-YYYYMMDD - Cherry-picks commits from that subdirectory
- Tracks success/failure per commit
- Optionally creates GitHub PR with
--create-pr
worktree prune
worktree pruneRemoves worktrees with no pending commits:
- Only removes fully merged worktrees
- Use
to remove with uncommitted changes--force - Use
to only prune old worktrees--max-age N
pr feedback <url>
pr feedback <url>Gets all feedback on a PR in one call:
- CI check status with parsed build errors
- Review comments (inline and PR-level)
- decomp-dev bot regression reports
- Generated action items list
- Use
for agent-friendly output--json
Example Session
# Check what's available melee-agent worktree list --commits # Output shows: # lb: 6 commits (match, match, match, fixup, match, match) # ft-chara-ftFox: 2 commits (match, fixup) # gr: 2 commits (match, match) # Preview collection for lb subdirectory melee-agent worktree collect --source-dir lb --dry-run # Shows commits from lb that will be cherry-picked # Classifies each as [match] or [fixup] # Create the PR for lb melee-agent worktree collect --source-dir lb --create-pr # Creates batch/lb-20241230 branch, cherry-picks commits, creates PR # Returns PR URL: https://github.com/doldecomp/melee/pull/XXXX # Monitor PR for issues melee-agent pr feedback https://github.com/doldecomp/melee/pull/XXXX # Shows CI status, review comments, decomp-dev report, action items # If CI fails or reviewers request changes, fix and push # Then re-check: melee-agent pr feedback https://github.com/doldecomp/melee/pull/XXXX # After PR merges, clean up melee-agent worktree prune
PR Quality Checklist
IMPORTANT: Before creating a PR, you MUST review ALL commits in the batch against this checklist. These are common issues identified from doldecomp/melee PR reviews:
Automated Checks (ALL are errors that block commits)
Run
melee-agent hook validate - ALL issues below will block the commit:
-
Use
/true
notfalse
/TRUEFALSE- Lowercase boolean literals are required
-
Float literals need F suffix
- Use
not1.0F
for f32 values1.0
- Use
-
Hex literals use uppercase
- Use
not0xABCD0xabcd
- Use
-
Don't use raw struct accesses/pointer arithmetic
- BAD:
*(s32*)((u8*)ptr + 0x10) - GOOD: Use
or fill in actual struct fieldsM2C_FIELD(ptr, 0x10, s32)
- BAD:
-
Don't add unnecessary extern declarations
- BAD:
at file topextern UNK_T lbl_804D1234; - GOOD: Include the proper header or create one
- BAD:
-
Don't rename descriptive symbols to address-based names
- BAD: Renaming
→ItemStateTable_GShellit_803F5BA8 - GOOD: Keep meaningful names
- BAD: Renaming
-
clang-format must pass
- Run
before committinggit clang-format
- Run
-
symbols.txt must be updated
- New functions need corresponding symbols.txt entries
-
No implicit function declarations
- All functions must have proper prototypes
-
Header signatures must match implementations
- No UNK_RET/UNK_PARAMS mismatches
-
No local scratch URLs in commits
- Commit messages must use production decomp.me URLs
- Run
before committing to sync scratchesmelee-agent sync production - Local URLs like
,nzxt-discord.local
,10.200.0.1
will be rejectedlocalhost:8000
Manual Review Required (not yet automated)
-
Use
return type for boolean functionsbool- If a function returns 0/1 for false/true, use
notbools32
- If a function returns 0/1 for false/true, use
-
Change argument/field types instead of casting
- BAD: Adding casts to work around type mismatches
- GOOD: Change the actual type in the struct or function signature
-
Keep temporary struct types instead of raw pointer arithmetic
- If m2c created a temp struct for field access, keep it
-
Don't modify unrelated files
- If a file shouldn't be in the PR (like
), revert it.gitkeep
- If a file shouldn't be in the PR (like
-
Don't mess with NonMatching/symbols.txt incorrectly
- Understand the matching/nonmatching workflow
-
Always use m2c first
- Don't try to one-shot decompile without using m2c
- m2c output should be the starting point, then cleaned up
Pre-PR Review Process
Before running
melee-agent worktree collect --create-pr:
# 1. Run automated checks melee-agent hook validate -v # 2. Review each commit's diff for manual issues git log upstream/master..HEAD --oneline # List commits git show <hash> # Review each commit # 3. Search for common issues grep -r "TRUE\|FALSE" melee/src/ # Boolean literals grep -rn "0x[0-9a-f]*[a-f]" melee/src/ # Lowercase hex # 4. If issues found, fix them BEFORE creating PR # Make fix commits on the subdirectory worktrees
What NOT to Do
- Don't create PRs with 1-2 commits unless work has completely stopped
- Don't skip the dry run on large batches
- Don't force-prune worktrees with uncommitted changes without checking first
- Don't create multiple overlapping PRs - wait for CI on previous PR
- Don't ignore cherry-pick failures - note them for future resolution
- Don't skip the quality checklist - reviewers will request changes
Troubleshooting
| Issue | Solution |
|---|---|
| Branch already exists | Use to specify different name |
| Cherry-pick conflict | Commits stay on subdirectory branch for later |
| No pending commits | Nothing to collect - keep working |
| Push failed | Check git remote auth, push manually if needed |
| PR creation failed | Branch is ready, create PR manually via GitHub |
Integration with Other Skills
- After
: Commits accumulate on subdirectory worktrees/decomp - Before
: Check if fixes should go in same batch/decomp-fixup - Coordination: Each subdirectory is collected separately, avoiding cross-subdirectory conflicts