Top-rated AI prompts for Sub-agent Orchestration. Copy any prompt and get instant results.
Your complete step-by-step AI guide for Sub-agent Orchestration. Copy, paste, and get results.
Top-rated AI prompts for Sub-agent Orchestration. Copy any prompt and get instant results.
This collection of tested AI prompts for Sub-agent Orchestration covers define agent roles, write the handoff protocol, and more. Each prompt is copy-paste ready and free to use. Copy any prompt, add your specifics, and get professional Sub-agent Orchestration results in seconds.
Stage 1
Every agent needs a clear, narrow role. Agents with broad mandates drift. Agents with focused mandates compound. These prompts help you define what each agent in your loop is and is not allowed to do.
Define the maker agent role
Write the role definition for a maker agent in [YOUR_PROJECT]. The maker agent's only job is to implement tasks from the task queue. Write the role as a .claude/agents/ YAML definition that specifies: the agent's name and description, the exact instructions for reading a task from .agent/tasks.md, the constraints on what files it may edit, the test it must run before marking a task done, and the format it uses to update the state file when finished.
Define the checker agent role
Write the role definition for a checker agent in [YOUR_PROJECT]. The checker agent may never write or modify code. Its job is to review the maker's output against: the original task spec, the test results, the style conventions in AGENTS.md, and any performance or security requirements. Write the full .claude/agents/ YAML definition and the structured output format the checker must produce: PASS with summary, or FAIL with a numbered list of specific issues.
Define a read-only research agent
Write a sub-agent definition for a read-only research agent for [YOUR_PROJECT]. This agent reads code, documentation, and logs. It may not write to any source files or tests. Its output is always a structured markdown report written to .agent/research-[timestamp].md. Define: the agent's allowed tools (file reads, shell for grep and find only), the output format, and the prompt template it uses to scope its research.
Design specialized agents for your stack
I am building a multi-agent team for [YOUR_PROJECT] using [TECH STACK, e.g. Next.js, Supabase, Tailwind]. Design three specialized agents matched to this stack: one frontend agent (focuses on React components and CSS), one backend agent (focuses on API routes and database queries), and one ops agent (focuses on deployment config and environment variables). Write the YAML definition for each, including which files each agent is allowed to edit.
Write a documentation agent
Write a sub-agent definition for [YOUR_PROJECT] that maintains documentation automatically. The agent runs after every successful implementation pass and: reads the git diff to understand what changed, updates the affected sections of README.md and any inline JSDoc comments, writes a changelog entry, and updates AGENTS.md if any loop conventions changed. The agent must never modify source code or tests. Write the full agent definition.
Stage 2
An agent team is only as good as the handoffs between agents. If the maker does not write clear enough output for the checker to evaluate, the checker fails. These prompts help you design the data formats, state files, and protocols that make handoffs reliable.
Design the task handoff format
Design the handoff format that the maker agent writes for the checker agent in [YOUR_PROJECT]. The handoff must include: the task ID and original spec, the files changed with a summary of each change, the test command run and its output, the commands used to verify the change works, and a confidence score from the maker (1-3) with the reason. Write the full format specification and a sample handoff for a fictional bug fix.
Write the orchestrator prompt
Write the orchestrator prompt for [YOUR_PROJECT] that starts the agent team, monitors progress, and makes routing decisions. The orchestrator should: read .agent/tasks.md each cycle, assign the highest-priority task to the maker agent, wait for the maker to write its handoff file, pass the handoff to the checker, read the checker verdict, and either mark the task done or send it back to the maker with the checker's failure notes. Write the full orchestrator prompt.
Handle agent handoff failures
My sub-agent handoff in [YOUR_PROJECT] sometimes fails when the checker cannot evaluate the maker's output because the handoff file is incomplete. Write the failure recovery protocol: what the orchestrator should check if the handoff file is missing or malformed, the retry prompt it sends to the maker agent, the maximum number of retries before escalating, and the escalation format that alerts me without stopping the loop.
Build a parallel agent workflow
I have three independent tasks in [YOUR_PROJECT] that can be worked on in parallel: [TASK 1], [TASK 2], [TASK 3]. Design a parallel agent workflow using git worktrees: one worktree per task, one maker agent per worktree, one shared checker agent that reviews all three when done. Write the launch sequence, the worktree naming convention, the checker scheduling logic, and the merge protocol once all three pass verification.
Write the merge and close protocol
Write the final step in the [YOUR_PROJECT] agent loop: the merge and close protocol. After all tasks in a batch pass verification, the loop should: merge each worktree branch to main in priority order, run the full test suite after each merge, roll back any merge that introduces a failing test, delete the merged worktrees, update .agent/done.md, and write the batch summary. Write the merge protocol as a loop prompt and as a Claude Code hook.
The maker-checker pattern uses two separate agents with different roles: the maker implements the task, and the checker evaluates the output against the spec and tests. The checker has a read-only role and is specifically instructed never to approve its own work or rationalize problems away. The separation matters because the agent that wrote the code is too forgiving when grading it. A second agent with stricter instructions catches what the first one rationalized.
Assign each agent a fixed scope of files it is allowed to edit, defined in AGENTS.md. A frontend agent edits components and styles only. A backend agent edits API routes and database files only. An ops agent edits config files only. Using git worktrees for parallel agents adds a second layer of isolation: each agent works in its own directory on its own branch, so filesystem conflicts are impossible during the run.
Using a different model for the checker adds genuine independence. If the maker rationalized a flawed solution, the checker from a different model is less likely to replicate that reasoning. In practice, the cheapest effective setup is: use the most capable model for the maker, and a fast but strict model for the checker using a very focused system prompt. The agent definitions in Stage 1 of this guide include both.
A minimal sub-agent definition needs: a name, a one-sentence description the orchestrator uses to decide when to call it, instructions for what to do and what not to do, the tools it is allowed to use (keep this list tight), and the output format it must produce. For a checker agent, the output format is especially important: PASS with a summary, or FAIL with a numbered list of specific issues. Vague checker output produces vague fixes.
Two is usually enough to start: one maker and one checker. A third agent for documentation updates adds value without much complexity. Beyond three, the orchestration overhead grows faster than the benefit. Add specialized agents only when you have a recurring task type that requires genuinely different instructions from your existing agents, not just a different prompt for the same role.
AI Prompts for Loop Engineering
Loop engineering is what happens when you stop prompting the coding agent yourself and design the system that prompts it instead.
See promptsAI Prompts for Parallel Agent Workflows
Running multiple agents on the same codebase at the same time is the failure.
See promptsAI Prompts for Verification and Goal Loops
A loop running unattended is a loop making mistakes unattended.
See prompts