一键导入
Orchestrate large-scale changes across a codebase in parallel
npx skills add https://github.com/rysweet/RustyClawd --skill batch复制此命令并粘贴到 Claude Code 中以安装该技能
Orchestrate large-scale changes across a codebase in parallel
npx skills add https://github.com/rysweet/RustyClawd --skill batch复制此命令并粘贴到 Claude Code 中以安装该技能
Review changed code for reuse, quality, and efficiency, then fix any issues found
Consolidated Claude Code sync and parity tracking for RustyClawd. Fetches latest Claude Code features from official sources, compares against the local feature inventory, identifies gaps, and optionally creates GitHub issues. Also supports deep analysis by deminifying the installed Claude Code cli.js.
Track and report agent invocation metrics including usage counts, success/failure rates, and completion times. Use for understanding which agents are utilized, identifying underused agents, and optimizing agent delegation patterns.
Automated dependency conflict detection and resolution. Detects local vs CI environment mismatches, compares versions, and generates pinning recommendations. Run as pre-push check to catch issues early.
Auto-discovers and configures Language Server Protocol (LSP) servers for your project's languages
Multi-repository orchestration for coordinating atomic changes across dependent repositories. Tracks dependency graphs, coordinates cross-repo PRs, and detects breaking changes.
| name | batch |
| description | Orchestrate large-scale changes across a codebase in parallel |
| disable-model-invocation | true |
Orchestrate large-scale changes across a codebase by decomposing the work into independent units and executing them in parallel. Each unit runs in an isolated git worktree with its own agent, implements the change, runs tests, and opens a PR.
gh CLI must be available for creating pull requestsVerify prerequisites before proceeding:
git rev-parse --is-inside-work-tree 2>/dev/null || echo "NOT_A_GIT_REPO"
git status --porcelain | head -5
git remote -v | head -2
which gh 2>/dev/null || echo "GH_CLI_NOT_FOUND"
If any prerequisite fails, stop and report what is missing. Do not proceed without a git repository.
/batch <description of large-scale change>Before decomposing work, understand the codebase structure and the scope of the requested change.
# Example: finding all HTTP handlers
grep -rl "fn handle\|async fn handle\|#\[handler\]\|@app.route\|router\." src/
# Example: understanding the project structure
find . -name "*.rs" -o -name "*.py" -o -name "*.ts" | head -50
Break the change into 5-30 independent units. Each unit must be:
For each unit, define:
Unit N: [Short title]
- Files to modify: [list of file paths]
- Description: [What to change and how]
- Test command: [How to verify this unit works]
- Estimated complexity: simple | moderate | complex
Rules for decomposition:
Present the decomposition to the user and wait for explicit approval before proceeding.
## Batch Change Plan
### Change: [User's requested change]
### Research Summary:
- Total files affected: N
- Modules involved: [list]
- Shared dependencies needed: [list or "none"]
### Decomposition: N units
**Unit 1: [Title]** (simple)
- Files: path/to/file1.rs, path/to/file2.rs
- Change: [one-line description]
- Test: cargo test -p module_name
**Unit 2: [Title]** (moderate)
- Files: path/to/file3.rs
- Change: [one-line description]
- Test: cargo test -p other_module
...
### Execution Order:
- Sequential first: [Units that must go first, e.g., shared type definitions]
- Parallel batch: [Units that can run simultaneously]
### Estimated total: N units, ~M minutes
Proceed? (yes/no)
Do not proceed without user approval. This is the one point where the skill must stop and wait. The user may want to adjust units, remove some, or change the approach.
After approval, execute the units. Sequential units (if any) run first, then parallel units launch simultaneously.
Each unit runs as an independent background agent via the Task tool. Each agent receives:
Agent prompt template for each unit:
You are implementing one unit of a batch change.
## Setup
Create an isolated git worktree for this unit:
```bash
BRANCH_NAME="batch/{unit_slug}"
WORKTREE_DIR="/tmp/batch-{unit_slug}-$(date +%s)"
git worktree add "$WORKTREE_DIR" -b "$BRANCH_NAME" main
cd "$WORKTREE_DIR"
Unit: {unit_title} Files to modify: {file_list} Description: {unit_description}
Run the verification command:
{test_command}
If tests pass, commit and push:
git add {file_list}
git commit -m "batch: {unit_title}"
git push -u origin "batch/{unit_slug}"
Create a PR:
gh pr create \
--title "batch: {unit_title}" \
--body "Part of batch change: {overall_description}\n\nUnit {unit_number} of {total_units}." \
--base main
If tests fail, fix the issue and retry. If you cannot fix it after two attempts, commit what you have with a [WIP] prefix on the PR title and note what failed.
After pushing (success or failure):
cd /home/azureuser/src/RustyClawd
git worktree remove "$WORKTREE_DIR" --force 2>/dev/null
### Phase 5: Monitor and Report
After all agents are dispatched, monitor their progress. As each agent completes, collect its result.
Present a rolling status table:
| Unit | Status | PR | Notes |
|---|---|---|---|
| 1. Add logging to auth handlers | Done | #123 | Tests pass |
| 2. Add logging to user handlers | Done | #124 | Tests pass |
| 3. Add logging to payment handlers | Running | - | - |
| 4. Add logging to notification handlers | Running | - | - |
| 5. Add logging to admin handlers | Queued | - | - |
### Phase 6: Final Summary
After all units complete, present the final summary:
## Handling Edge Cases
- **Fewer than 5 units**: Proceed normally. Even 2-3 units benefit from parallel execution.
- **More than 30 units**: Group related units to reduce below 30. Too many parallel agents degrades performance.
- **Shared file conflict detected during decomposition**: Merge the conflicting units into one. Never allow two units to touch the same file.
- **Agent fails to create worktree**: Fall back to working on a branch directly (without worktree isolation). Note this in the status.
- **Test infrastructure missing**: If no tests exist for a unit, the agent should still implement the change and note "no tests available" in the PR.
- **User rejects plan**: Ask what to adjust. Re-decompose if needed.
- **Repository has no remote**: Skip PR creation. Commit to local branches only and report branch names.
- **gh CLI not available**: Skip PR creation. Push branches and report them. User can create PRs manually.
## Constraints
- This skill orchestrates work; it does not implement changes directly
- Each unit agent is fully autonomous once dispatched
- Units must be truly independent - no shared mutable state between parallel units
- The skill must wait for user approval of the plan before executing
- Failed units do not block successful ones
- All worktrees must be cleaned up, even on failure
## Integration
This skill works well for:
- Codebase-wide migrations (API changes, library upgrades)
- Applying consistent patterns across modules (logging, error handling, tracing)
- Bulk refactoring (renaming, restructuring)
- Adding cross-cutting concerns (validation, authentication checks)
This skill pairs with:
- `/simplify` for post-batch cleanup of each unit
- Test gap analyzer for ensuring batch changes have adequate coverage
- PR review assistant for reviewing the generated PRs