Parallel Git Worktree Task Split with Interface Contracts and Merge Order

Turns a pasted feature spec into independent coding-agent tasks with file ownership, interface contracts, a merge order and a done command for each task.

You get: Working code with an explanation

More like this

The prompt

parallel-git-worktree-task-split-with-interface-contracts-and-merge-order.md
Act as a staff engineer who plans parallel work for coding agents, each running in its own git worktree. Here is the feature spec: {paste your feature spec here}

If the repo layout, language or test command is missing, ask me up to two short questions first. Otherwise list your assumptions separately and continue.

Rules:
- Every task owns a distinct set of files or directories. If two tasks would touch the same file, move it into a shared-interface task that merges first.
- Define each interface between tasks as a concrete signature, schema or endpoint, so agents can code against stubs without waiting.
- Each task must be finishable and testable alone, with a done check that is a runnable command.
- Use 3 to 6 tasks. Merge anything too small to justify its own worktree.

Output:
1. Assumptions and open questions.
2. Task table with ID, goal, owner agent, branch name, files owned, depends on, and done check.
3. Interface contracts as code blocks.
4. Merge order, with the reason for each step and the integration test to run after it.
5. Risks (conflicts, interface drift, flaky tests) and next actions.

The plan is good if no two tasks write the same file, every dependency appears in the merge order, and each task has a command that proves it is done.

Example output

AI-written example
# Saved Searches with Daily Email Digest: Parallel Plan

## 1. Assumptions and open questions
Assumptions
- Monorepo: `backend/` (FastAPI, SQLAlchemy, Alembic, pytest) and `web/` (Next.js, TypeScript, vitest).
- Existing search entry point: `backend/app/services/search.py::search(query: dict, limit: int) -> list[dict]`. No agent edits it.
- Email sending goes through the existing `backend/app/email/sender.py::send(to, subject, html)`.
- Auth already provides `current_user` via `Depends(get_current_user)`.
- Digest runs once a day from an existing cron runner that calls a module-level `run()`.

Open questions (non-blocking)
- Is there a cap on saved searches per user? Assumed 20.
- Should digests skip empty results? Assumed yes.

## 2. Task table

| ID | Goal | Owner agent | Branch | Files owned | Depends on | Done check |
|----|------|-------------|--------|-------------|-----------|------------|
| T0 | Shared contracts: model, migration, schemas, router stub, TS types, nav link | agent-core | `feat/ss-contracts` | `backend/app/models/saved_search.py`, `backend/app/schemas
Generated from this prompt by AI. Your results will vary.

Tips and common edits

Use before launching several coding agents on one feature. Paste the full spec, and mention the repo structure and test command if you know them.

Questions about this prompt

Orchestrator System Prompt Builder with Progress Ledger and Stop Conditions

Writes a ready-to-deploy orchestrator system prompt that delegates to your workers, tracks progress in a ledger, merges results and stops on defined conditions.

Agent Run Post-Mortem: Trace Root Cause and Prompt or Tool Fixes

Analyzes a pasted agent trace to find the first real failure and proposes exact prompt rewrites or tool changes, each with a test.

Characterization Tests Before a Refactor

Writes tests that lock in a module's current behavior, including edge cases and quirks, so you can refactor safely.

Codebase Tour for a Specific Task

Explores a repo through the lens of your task and explains the architecture, key files and data flow, then says where to start.

Failing Test First Bug Fix

Reproduces a bug with a failing test, finds the root cause, applies the smallest fix and shows the test passing.

Subagent Fan-Out Plan for a Large Codebase Migration

Plans a big migration so an orchestrating agent can split it into independent chunks for parallel subagents, each with a clear brief, a verification command and merge rules.

Typed Phase Handoff Contracts and Validator for Multi-Agent Pipelines

Has Claude Code define schema-based handoff contracts between agent phases, generate a validator, and add contract tests. Supports the decision of which phase boundaries need strict contracts versus lightweight checks.

Agent Workflow Decomposition with Autonomy Levels and Stop Rules

Turns a manual process into a step-by-step agent plan with tools, approval gates, retry limits, and a build/pilot/skip recommendation.

Dependency Graph Planner for a Multi-Agent Software Release Workflow

Turns a list of release tasks into a dependency graph with parallel batches, critical path, shared-resource conflicts, and agent assignments. Supports the decision on what to run now versus wait on.

Parallel Research Fan-Out and Fan-In with Citation Table and Decision Memo

Splits a research question across parallel research agents, defines source discovery and evidence review steps, merges findings into a citation table, and produces a decision memo without claiming live browsing.

Strict JSON Handoff Schemas with Validation and Retry Rules for Agent Pipelines

Turns a pasted pipeline description into JSON schemas for every agent-to-agent handoff, plus validation checks and retry rules for bad output.

Checkpoint and Rollback Manager with Compensation Steps and Failure Injection Tests

Guides Claude Code to implement checkpoint snapshots, rollback modes, and compensating actions for side-effecting agent phases, then prove them with failure-injection tests. Helps you decide the rollback strategy per phase.