From am2rican5
Orchestrate multiple Claude agents working in parallel on a shared codebase with task locking, conflict avoidance, and autonomous work loops. Use when user says "run parallel agents", "orchestrate agents", "multi-agent workflow", "coordinate agents on shared codebase", "parallelize this work", or "run multiple agents simultaneously". Key capabilities include task decomposition, lock-file coordination, git worktree isolation, and branch-per-agent strategies. Do NOT use for single-agent task execution (use task-runner agent instead) or for learning about testing patterns (use test-driven-autonomous-dev instead).
How this skill is triggered — by the user, by Claude, or both
Slash command
/am2rican5:parallel-agent-orchestrationThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
- NEVER spawn parallel agents without explicit user confirmation of the work plan
Analyze the work the user wants to parallelize:
IF all tasks touch the same files or share heavy state → recommend sequential execution and stop. IF tasks are clearly independent → proceed to Step 2.
Create a locking mechanism to prevent duplicate work:
_tasks/ directory in the working area (or use an existing task tracking system)_tasks/available/ with the task descriptionreferences/lock-protocol.md for the full protocol (lock file format, claim-before-start, completion, failure, stale lock recovery).Choose an isolation strategy based on the work:
Option A: Git Worktrees (Recommended for file-heavy work)
git worktree add ../agent-<n> -b agent-<n>/workOption B: Branch-Per-Agent (Lightweight)
agent-<n>/<task-name>Option C: File-Level Partitioning (Simplest)
Present options to the user and let them choose.
Configure each agent to run the autonomous loop: scan for tasks → claim → execute → complete/fail → repeat. See references/lock-protocol.md for the full loop definition.
Launch agents using Claude Code's Task tool with run_in_background: true for parallel execution. Each agent gets:
_tasks/ directoryWhile agents run:
_tasks/ directory for progressN completed / M total (K in progress, F failed)After all agents finish:
User says: "Fix all failing tests in the auth, billing, and notifications modules"
Result: Three agents launched with file-level partitioning, each owning one module directory. All modules fixed in parallel, merge back cleanly.
User says: "Migrate all API endpoints from Express to Fastify"
Result: Shared middleware migrated sequentially first (dependency), then route files parallelized with branch-per-agent strategy.
See references/examples.md for detailed walkthroughs of both scenarios.
Cause: Two agents edited the same file or adjacent lines. Solution: This shouldn't happen if file-level independence was verified in Step 1. Review the dependency analysis. For future runs, use stricter file partitioning.
Cause: An agent crashed or timed out without releasing its lock.
Solution: Check the lock file timestamp. If >30 minutes old and the agent is no longer running, manually move the lock file to _tasks/failed/ and reassign the task.
Cause: Race condition — both checked availability simultaneously. Solution: The lock-file protocol should prevent this. If it happens, check that agents are using atomic file operations. The second agent should detect the existing lock and skip to the next task.
Cause: Agent keeps failing the same task and reclaiming it.
Solution: After 2 failures on the same task, the agent should mark it as blocked and move to the next task. Review blocked tasks manually.
npx claudepluginhub am2rican5/cc-plugin --plugin am2rican5Dispatches Claude Code agents concurrently for independent tasks to reduce total resolution time. Useful when multiple issues have different root causes and no shared state.
Dispatches independent tasks to concurrent Claude Code agents, checks for file and dependency conflicts, and integrates results. Useful when 3+ truly independent tasks exist across different subsystems.
Dispatches parallel subagents for 2+ independent tasks with no shared state. Use when tasks are well-defined and have no sequential dependency.