$npx -y skills add anombyte93/prd-taskmaster --skill expand-tasksExpand all TaskMaster tasks with deep research before coding begins. Reads tasks.json, launches parallel research agents per task in waves using the research-expander agent. Writes findings back to tasks.json. Part of the prd-taskmaster toolkit. Use after PRD is parsed and before
| 1 | # Expand Tasks with Research v1.0 |
| 2 | |
| 3 | Expands TaskMaster tasks with research before coding begins. |
| 4 | Deterministic operations handled by `script.py`; AI handles judgment. |
| 5 | |
| 6 | **Script location**: `skills/expand-tasks/script.py` (relative to plugin root) |
| 7 | **Part of**: `prd-taskmaster` plugin |
| 8 | **Depends on**: `research-expander` agent (parallel research worker), any research |
| 9 | provider configured via `task-master models --set-research` or registered as an |
| 10 | MCP research tool. |
| 11 | |
| 12 | ## When to Use |
| 13 | |
| 14 | Activate when user says: expand tasks, research tasks, research before coding for all, expand subtasks. |
| 15 | Do NOT activate for: single task research (use /research-before-coding), PRD generation (use /prd:go). |
| 16 | |
| 17 | ## Native-parallel first (token economy) |
| 18 | |
| 19 | Before launching agent waves, check the cheaper path: the native engine expands tasks |
| 20 | in parallel for free. Prefer `python3 script.py expand` — backend op expand (native api) — |
| 21 | or the `expand_tasks` MCP tool: it runs structured `expand` across pending tasks |
| 22 | concurrently (inheriting the engine's ThreadPoolExecutor) on economy-tier models / |
| 23 | keyless host CLIs and merges atomically. |
| 24 | Use THIS skill's agent waves when: no provider/CLI is available, native expand reports |
| 25 | failures for specific tasks (rerun just those here), or the research must be repo-grounded |
| 26 | (agents can read the codebase; native expand cannot). |
| 27 | |
| 28 | ## Prerequisites |
| 29 | |
| 30 | - TaskMaster `tasks.json` must exist (run `/prd:go` first) |
| 31 | - A research provider is configured — either (a) `task-master models --set-research <model> --<provider>` for any task-master provider family, or (b) an MCP research tool registered in `~/.claude.json` that Claude Code can call directly (for example `mcp__plugin_prd_go__*` tools or an external search/reason MCP) |
| 32 | - At least 1 task in `tasks.json` |
| 33 | |
| 34 | --- |
| 35 | |
| 36 | ## Workflow (5 Steps) |
| 37 | |
| 38 | ### Step 1: Preflight |
| 39 | |
| 40 | ```bash |
| 41 | python3 skills/expand-tasks/script.py read-tasks |
| 42 | ``` |
| 43 | |
| 44 | Returns JSON: `total`, `expanded`, `pending_expansion`, `tasks[]`. |
| 45 | |
| 46 | **If `pending_expansion` is 0**: Report all tasks already expanded. Exit skill. |
| 47 | |
| 48 | **If research provider is not configured**: Check via `task-master models` and verify a research role is set. If none, tell the user to configure one (`task-master models --set-research <model> --<provider>`) and exit. The skill does not assume any specific research backend — it uses whatever is configured. |
| 49 | |
| 50 | --- |
| 51 | |
| 52 | ### Step 2: Choose Scope |
| 53 | |
| 54 | Use AskUserQuestion: |
| 55 | - **All tasks** (default): Expand every task that hasn't been researched yet |
| 56 | - **Specific tasks**: User provides task IDs (comma-separated) |
| 57 | - **By dependency level**: Expand tasks with no dependencies first, then next wave |
| 58 | |
| 59 | **AI judgment**: Recommend "All tasks" for initial expansion, "By dependency level" for incremental work. |
| 60 | |
| 61 | --- |
| 62 | |
| 63 | ### Step 3: Generate Research Prompts |
| 64 | |
| 65 | For each task to expand: |
| 66 | |
| 67 | ```bash |
| 68 | python3 skills/expand-tasks/script.py gen-prompt --task-id <ID> |
| 69 | ``` |
| 70 | |
| 71 | Returns JSON with `prompt` field containing the full research agent prompt. |
| 72 | |
| 73 | **AI judgment**: Review the auto-generated prompt. Customize research questions if the task needs domain-specific queries. Add project context from the PRD or session-context files if relevant. |
| 74 | |
| 75 | --- |
| 76 | |
| 77 | ### Step 4: Launch Parallel Research Agents |
| 78 | |
| 79 | Launch research agents in parallel waves. Each wave = up to 5 concurrent agents. |
| 80 | |
| 81 | **For each task**, spawn a Task agent using the dedicated `research-expander` |
| 82 | subagent type (defined in `agents/research-expander.md`): |
| 83 | |
| 84 | ``` |
| 85 | Task( |
| 86 | subagent_type: "research-expander", |
| 87 | description: "Research Task <ID>: <title>", |
| 88 | run_in_background: true, |
| 89 | prompt: <prompt from Step 3> |
| 90 | ) |
| 91 | ``` |
| 92 | |
| 93 | **Wave strategy**: |
| 94 | - Wave 1: Tasks with no dependencies (they inform downstream tasks) — run in parallel |
| 95 | - Wave 2: Tasks depending on Wave 1 — run in parallel |
| 96 | - Wave 3+: Continue until all tasks covered — run in parallel per wave |
| 97 | - Max 5 agents per wave to avoid overwhelming the configured research backend |
| 98 | |
| 99 | **Wait for each wave to complete before launching the next.** Parallel dispatch |
| 100 | only happens WITHIN a wave; waves themselves are serial. |
| 101 | |
| 102 | --- |
| 103 | |
| 104 | ### Step 5: Collect and Write Results |
| 105 | |
| 106 | As each `research-expander` agent completes, save its research output: |
| 107 | |
| 108 | 1. Write agent output to a temp file: |
| 109 | ```bash |
| 110 | cat > /tmp/research-task-<ID>.md <<'EOF' |
| 111 | <agent output> |
| 112 | EOF |
| 113 | ``` |
| 114 | |
| 115 | 2. Write research back to `tasks.json`: |
| 116 | ```bash |
| 117 | python3 skills/expand-tasks/script.py write-research |