From agent-workflows
Spawns N independent agents in isolated Git worktrees to prototype divergent implementation strategies for a PRD, then synthesizes results.
npx claudepluginhub sjarmak/agent-workflowsThis skill uses the workspace's default tool permissions.
Divergent prototyping. Spawns N independent agents in isolated worktrees to explore different implementation approaches for a PRD, then synthesizes results.
Mandates invoking relevant skills via tools before any response in coding sessions. Covers access, priorities, and adaptations for Claude Code, Copilot CLI, Gemini CLI.
Share bugs, ideas, or general feedback.
Divergent prototyping. Spawns N independent agents in isolated worktrees to explore different implementation approaches for a PRD, then synthesizes results.
$ARGUMENTS — format: [N] [path/to/prd.md] where N is optional (default: 3) and PRD path is optional
Extract:
If a PRD path is provided: read and validate it. It should contain at minimum: Problem Statement, Goals, and Requirements sections. If it's missing key sections, work with the user to fill gaps.
If no PRD path is provided: tell the user they need a PRD first and offer two options:
/diverge to research the topic and generate oneIf they choose option 2, walk through these questions:
Save the resulting PRD to prd_{topic}.md and confirm with the user before proceeding.
Based on the PRD requirements, design N distinct implementation strategies. Each strategy should:
Examples of strategy differentiation:
Present the strategies to the user and get confirmation before spawning agents.
Launch all N agents in parallel using the Agent tool. Each agent MUST:
isolation: "worktree" — each gets its own copy of the reposubagent_type: "general-purpose"PROTOTYPE_NOTES.md in the repo root summarizing:
Agent prompt template:
You are a prototype agent implementing a solution based on a PRD.
## PRD
{full_prd_content}
## Your Strategy: {strategy_name}
{strategy_description}
Implement a working prototype following this strategy. Focus on must-have requirements first.
## Instructions
0. (If the project uses bd for task tracking) Run any worktree setup helper present:
[ -f scripts/bd-worktree-redirect.sh ] && bash scripts/bd-worktree-redirect.sh || true
You are inside a git worktree, so bd commands targeting the main repo's Dolt server need a redirect file. The helper is idempotent and a no-op if the project doesn't use bd.
1. Read the relevant existing code to understand the current state
2. Implement your approach — create and modify files as needed
3. Make it work end-to-end for the core requirements if possible
4. Write PROTOTYPE_NOTES.md in the repo root with:
- Approach summary
- Key design decisions and why
- What works vs what's stubbed/incomplete
- Trade-offs you encountered
- Self-assessed quality [1-5]
- Estimated effort to production-ready [hours/days]
5. Stage and commit all changes with message: "prototype: {strategy_name}"
Do NOT:
- Over-engineer or add unnecessary abstractions
- Spend time on docs/tests unless they're core to the approach
- Try to be perfect — working > polished
After ALL agents return, for each prototype:
PROTOTYPE_NOTES.md from each worktree/branchgit diff --stat from base)Present a comparison matrix:
1. Strategy Summary Table
| Dimension | Strategy A | Strategy B | Strategy C |
|---|---|---|---|
| Approach | ... | ... | ... |
| Files changed | ... | ... | ... |
| Complexity | ... | ... | ... |
| Requirements met | X/Y | X/Y | X/Y |
| Self-assessed quality | ... | ... | ... |
| Production readiness | ... | ... | ... |
2. Trade-off Analysis For each major trade-off (complexity vs simplicity, performance vs maintainability, etc.), map where each prototype falls.
3. Best Ideas From Each Identify the strongest elements from each prototype that could be combined.
4. Recommended Path Forward Based on the exploration:
5. Per-Prototype Highlights For each prototype, a 2-3 sentence summary of its most distinctive contribution.
Ask the user how they want to proceed:
For each prototype's worktree+branch, after the user confirms the path forward:
git worktree unlock <prototype-worktree-path> 2>/dev/null || true
git worktree remove --force <prototype-worktree-path>
git branch -D <prototype-branch-name> 2>/dev/null || true
The Agent tool returns the worktree path and branch name in its result — capture those when each agent completes so this teardown loop has the data it needs. Without teardown, .claude/worktrees/agent-* directories accumulate (~24GB+ over a few weeks of normal use).
Guard: when "Park it" is chosen for a not-yet-merged prototype, confirm with the user before deleting the branch — the work has not yet been preserved elsewhere.
isolation: "worktree"..claude/worktrees/agent-* directory and an agent-* branch. Phase 5 MUST run the teardown loop for every prototype (adopted, parked, or discarded) once the path forward is decided. Skipping leaks ~MB per prototype and accumulates fast across multiple /diverge-prototype runs.