Delegate Implementation
Decompose tasks into non-overlapping sub-problems and delegate each to the appropriate expert running in isolation.
Core Principle
Every implementation task must be decomposed and delegated. Do not implement directly. Instead:
- •Break down into non-overlapping sub-problems (maximum 5)
- •Identify the expert for each sub-problem
- •Execute subagents (with concurrency limits)
Step 1: Decompose the Task
Break the task into non-overlapping sub-problems (maximum 5):
- •Non-overlapping: Sub-problems should not conflict with each other
- •Self-contained: Each sub-problem can be completed and verified by the expert
Decomposition Guidelines
- •Separate by stack: Backend work vs Frontend work
- •Separate by feature boundary: Distinct capabilities become separate sub-problems
- •Keep it coarse: Aim for 1-5 sub-problems, not too granular steps
Step 2: Identify Expert per Sub-problem
For each sub-problem, determine the expert:
| Expert | When to Use |
|---|---|
| Backend Expert | Server-side logic, API endpoints, business rules, data persistence, validation, background processing, authentication/authorization |
| Frontend Expert | visual components, client-side state, presentation logic, form handling, navigation, client-side implementation |
| UI-UX Designer | User interface, user interactions, visual components design ideas |
| QA Expert | Server-site and client-site testing, unit, integration, e2e tests |
Step 3: Execute Subagents
Run #tool:runSubagent tool, instructing the agent to work autonomously over the given sub-problem.
Execution
Execute subagents for each sub-problem, ensuring their work stays non-conflicting.
Simultaneous execution is allowed only when BOTH are true:
- •Non-overlapping implementation work: No shared files, components, or shared state that could conflict.
- •Different expert types: The subagents are different experts.
Exception (Allowed): Backend + Frontend may work simultaneously against the same API as long as the API protocol/contract is explicitly agreed upfront (routes, request/response payloads, error shapes, and auth assumptions) and treated as the source of truth.
Hard rule: never run two subagents of the same expert type simultaneously.
- •✅ May run simultaneously: Backend Expert + UI-UX Designer + QA Expert (including when coordinating on the same API via an agreed contract)
- •✅ May run simultaneously: Backend Expert + Frontend Expert + QA Expert (including when coordinating on the same API via an agreed contract)
- •❌ Must not run simultaneously: Backend Expert + Backend Expert
- •❌ Must not run simultaneously: Frontend Expert + Frontend Expert
- •❌ Must not run simultaneously: UI-UX Designer + UI-UX Designer
- •❌ Must not run simultaneously: UI-UX Designer + Frontend Expert
- •❌ Must not run simultaneously: QA Expert + QA Expert
If there are dependencies between sub-problems (e.g., UI depends on an API contract), execute the prerequisite sub-problem first.
Subagent Prompt Structure
Each subagent prompt must include:
- •Sub-problem description: Clear description of what to implement
- •Acceptance criteria: What defines "done" for this sub-problem
- •Prohibitions: The subagent should avoid further delegation - it must implement the assigned sub-problem autonomously. Prohibit the subsequent use of this "delegate-implementation" skill.
Example
Task: "Generate a searchable PDF in the background and allow users to download it from the UI."
Decomposition
| # | Sub-problem | Expert |
|---|---|---|
| 1 | Define the API contract (endpoints, DTOs, errors) for downloading a searchable PDF | Backend |
| 2 | Add a file-conversion implementation to generate searchable PDFs, plus the required background operation and executor | Backend |
| 3 | Introduce a new user action: "download_searchable_pdf" | Backend |
| 4 | Implement the "download searchable PDF" endpoint (wired to the background operation and conversion output) | Backend |
| 5 | Elevate the user experience for the interface, making application more intuitive, accessible, and delightful to use. | UI-UX Designer |
| 6 | Add the "Download Searchable PDF" UI (button/action + download flow) | Frontend |
| 7 | Implement unit, integration, e2e, performance, security tests for the Backend and Frontend functionality | QA Expert |
| 8 | Run the tests and return errors to the appoprites subagents for fixing | QA Expert |
Execution
- •Run Backend Expert subagent for sub-problem 1 and treat the output as the source-of-truth API contract.
- •Then start simultaneous execution of:
- •Sub-problem 5 (Frontend Expert), and
- •Sub-problems 2 → 3 → 4 (Backend Expert).
- •Backend sub-problems (2 → 3 → 4) execute sequentially due to the concurrency limitation (no Backend + Backend parallelism).
Guardrails
- •Always decompose first: Never implement directly without decomposition
- •Maximum 5 sub-problems: Keep decomposition coarse, not granular
- •Concurrency limitations: Never run same expert types simultaneously; Backend + Frontend may run simultaneously when implementation work is non-overlapping (API contract coordination is allowed if agreed upfront)
- •Experts validate internally: Each expert runs their own guardrails