{"id":"expand-tasks","name":"expand-tasks","summary":"コーディングを始める前に、TaskMasterのすべてのタスクを徹底的に調査して拡張しましょう。tasks.json読み取り、研究拡張エージェントを使ってタスクごとに並列研究エージェントを波状に発射します。","body":"# Expand Tasks with Research v1.0\n\nExpands TaskMaster tasks with research before coding begins.\nDeterministic operations handled by `script.py`; AI handles judgment.\n\n**Script location**: `skills/expand-tasks/script.py` (relative to plugin root)\n**Part of**: `prd-taskmaster` plugin\n**Depends on**: `research-expander` agent (parallel research worker), any research\nprovider configured via `task-master models --set-research` or registered as an\nMCP research tool.\n\n## When to Use\n\nActivate when user says: expand tasks, research tasks, research before coding for all, expand subtasks.\nDo NOT activate for: single task research (use /research-before-coding), PRD generation (use /prd:go).\n\n## Native-parallel first (token economy)\n\nBefore launching agent waves, check the cheaper path: the native engine expands tasks\nin parallel for free. Prefer `python3 script.py expand` — backend op expand (native api) —\nor the `expand_tasks` MCP tool: it runs structured `expand` across pending tasks\nconcurrently (inheriting the engine's ThreadPoolExecutor) on economy-tier models /\nkeyless host CLIs and merges atomically.\nUse THIS skill's agent waves when: no provider/CLI is available, native expand reports\nfailures for specific tasks (rerun just those here), or the research must be repo-grounded\n(agents can read the codebase; native expand cannot).\n\n## Prerequisites\n\n- TaskMaster `tasks.json` must exist (run `/prd:go` first)\n- 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)\n- At least 1 task in `tasks.json`\n\n---\n\n## Workflow (5 Steps)\n\n### Step 1: Preflight\n\n```bash\npython3 skills/expand-tasks/script.py read-tasks\n```\n\nReturns JSON: `total`, `expanded`, `pending_expansion`, `tasks[]`.\n\n**If `pending_expansion` is 0**: Report all tasks already expanded. Exit skill.\n\n**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.\n\n---\n\n### Step 2: Choose Scope\n\nUse AskUserQuestion:\n- **All tasks** (default): Expand every task that hasn't been researched yet\n- **Specific tasks**: User provides task IDs (comma-separated)\n- **By dependency level**: Expand tasks with no dependencies first, then next wave\n\n**AI judgment**: Recommend \"All tasks\" for initial expansion, \"By dependency level\" for incremental work.\n\n---\n\n### Step 3: Generate Research Prompts\n\nFor each task to expand:\n\n```bash\npython3 skills/expand-tasks/script.py gen-prompt --task-id <ID>\n```\n\nReturns JSON with `prompt` field containing the full research agent prompt.\n\n**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.\n\n---\n\n### Step 4: Launch Parallel Research Agents\n\nLaunch research agents in parallel waves. Each wave = up to 5 concurrent agents.\n\n**For each task**, spawn a Task agent using the dedicated `research-expander`\nsubagent type (defined in `agents/research-expander.md`):\n\n```\nTask(\n  subagent_type: \"research-expander\",\n  description: \"Research Task <ID>: <title>\",\n  run_in_background: true,\n  prompt: <prompt from Step 3>\n)\n```\n\n**Wave strategy**:\n- Wave 1: Tasks with no dependencies (they inform downstream tasks) — run in parallel\n- Wave 2: Tasks depending on Wave 1 — run in parallel\n- Wave 3+: Continue until all tasks covered — run in parallel per wave\n- Max 5 agents per wave to avoid overwhelming the configured research backend\n\n**Wait for each wave to complete before launching the next.** Parallel dispatch\nonly happens WITHIN a wave; waves themselves are serial.\n\n---\n\n### Step 5: Collect and Write Results\n\nAs each `research-expander` agent completes, save its research output:\n\n1. Write agent output to a temp file:\n   ```bash\n   cat > /tmp/research-task-<ID>.md <<'EOF'\n   <agent output>\n   EOF\n   ```\n\n2. Write research back to `tasks.json`:\n   ```bash\n   python3 skills/expand-tasks/script.py write-research --task-id <ID> --research /tmp/research-task-<ID>.md\n   ```\n\n3. After all tasks are written, verify:\n   ```bash\n   python3 skills/expand-tasks/script.py status\n   ```\n\n**AI judgment**: Review each research result for quality. If a result is too thin (< 5 lines of useful content) or clearly failed, re-run that specific task's research through a fresh `research-expander` invocation.\n\n---\n\n## Research Agent Prompt Pattern\n\nThe `gen-prompt` command generates prompts that follow the\nresearch-before-coding pattern:\n\n1. Agent receives task context (title, description, dependencies, subtasks)\n2. Agent runs 3-5 targeted queries against the user's configured research provider. The `research-expander` agent is tool-agnostic: it picks up whichever research tools are available in the current Claude Code session. This may be `task-master research`, an MCP search/reason tool from `~/.claude.json` (including any `mcp__plugin_prd_go__*` tools registered by this plugin), WebSearch as a last resort, or whatever the user has bound. The skill does not hard-code any specific research MCP.\n3. Agent distills results into structured summary\n4. Summary returns to main context (~25-40 lines per task)\n\n**Critical**: prefer structured research tools (`task-master research`, MCP\nsearch/reason tools) over raw WebSearch/WebFetch when available — they produce\ncleaner outputs with citations.\n\n---\n\n## Error Handling\n\n| Error | Action |\n|-------|--------|\n| Research provider unreachable or rate-limited | Exit skill, tell user to verify `task-master models` research role is set and reachable |\n| `research-expander` agent returns empty/failed | Re-run that specific task with different queries |\n| `tasks.json` not found | Exit skill, tell user to run `/prd:go` first |\n| Task already expanded | Skip silently unless user forces re-expansion |\n| Agent timeout | Mark task as failed, continue with others |\n\n---\n\n## Output\n\nAfter all tasks are expanded, the skill reports:\n- Total tasks expanded\n- Any failures that need retry\n- Next recommended action (usually: begin implementation)\n\n---\n\n## Integration with prd-taskmaster\n\nThis skill fits between Step 8 (Parse & Expand Tasks) and Step 11 (Choose Next\nAction) of the prd-taskmaster workflow. After PRD is parsed into tasks but\nbefore execution begins.\n\n```\n/prd:go → generates PRD → parses into tasks\n    ↓\n/expand-tasks   → research-expander agents run in Parallel waves → writes findings back to tasks.json\n    ↓\nImplementation begins (with research context in each task)\n```\n\n---\n\n## Tips\n\n- Run after PRD generation but before any implementation\n- Research results are stored in `research_notes` field of each task in `tasks.json`\n- Re-running on already-expanded tasks is safe (will skip unless forced)\n- For very large task lists (20+), consider expanding in dependency order to save context\n- Each `research-expander` agent typically completes in ~30s depending on research backend and query depth; 15 tasks ≈ 3 waves ≈ 2-3 minutes total","author":"@anombyte93","ownerProfile":null,"authorContacts":null,"sourceUrl":"https://github.com/anombyte93/prd-taskmaster/tree/main/skills/expand-tasks","license":"MIT","category":"coding","lang":"en","tokens":1718,"stars":0,"calls30d":2,"claimed":false,"visibility":"public","origin":"crawler","version":"0.1.0","createdAt":"2026-08-22","updatedAt":"2026-08-22","files":[],"requires":{"mcp":["plugin_prd_go"],"tools":["Read","Write","Edit","Bash","Task","Skill","Glob","Grep","AskUserQuestion","ToolSearch","mcp__atlas-engine","mcp__plugin_prd_go","mcp__plugin_prd-taskmaster_go","mcp__plugin_atlas-go_go"]},"safety":{"flags":[],"scannedAt":"2026-08-22","hasScripts":false,"networkEndpoints":[]}}