{"id":"anombyte93-setup","name":"setup","summary":"prd-taskmasterパイプラインのフェーズ0。アクティブなバックエンドを解決し、プロジェクトを初期化し、TaskMasterバックエンドがアクティブなときにプロバイダースタックを設定(DETECT-FIRST、動作するユーザー設定を上書きしないでください)、AIパイプラインの検証を行います。","body":"# Phase 0: Setup\n\nDeclarative phase skill. Invoked by the prd-taskmaster orchestrator when\n`current_phase` is null or `SETUP`. Never called directly by a user.\n\n## Entry gate\n\n1. Call `mcp__plugin_prd_go__check_gate(phase=\"SETUP\", evidence={})` for diagnostics.\n\n   `check_gate` is an EXIT gate: it verifies you have the evidence to *advance*, not to\n   *enter*. On first entry you have no evidence yet (Step 4 below produces\n   `validate_setup.ready=true`), so a `gate_passed: false` result here is EXPECTED — the\n   state machine's legal transitions (`None → SETUP`) already guarantee only legal entry.\n\n   - **First entry** (no evidence yet): note the result and continue with the Procedure.\n   - **Re-entry**: if the gate reports violations, report them and stop — it protects\n     against re-running a completed phase or skipping ahead.\n\n   Enforce the gate when you ADVANCE (after the procedure), not on entry.\n\n## Procedure (5 steps, abort on hard failure)\n\n### Step 1: Backend detection\n\nRun backend detection:\n\n```bash\npython3 script.py backend-detect\n```\n\nThe native engine is the sole generator and needs no external binary — a\nkeyless host CLI (`claude` / `codex` / `gemini`) on PATH, or a provider API key,\nis sufficient (see Chunk 7's `atlas setup` wizard). The `task-master` binary is\nno longer required or supported; `backend-detect` reports its presence purely as\ninformational. Continue with the resolved (native) backend.\n\n### Step 2: Project init\n\nCheck whether the current project has a `.taskmaster/` directory (the engine\nstill reads/writes the `.taskmaster/` file format for tasks and config).\n\nIf missing, run backend op `init`:\n\n```bash\npython3 script.py init-project\n```\n\nThis initialises the native project state and the `.taskmaster/` file format. If\n`.taskmaster/` is present, continue.\n\n### Step 2.5: Customisation bootstrap (REQUIRED — closes execute-task deadlock)\n\n`execute-task` requires `.atlas-ai/customizations/system-prompt-template.md`\nto exist as a precondition (its Entry gate halts otherwise). It cannot\ncreate the file from inside the loop — the failure mode is a hard halt with\nno recovery path.\n\nThis step ensures the file exists BEFORE execute-task ever runs:\n\n```bash\nPLUGIN_SKEL=\"${CLAUDE_PLUGIN_ROOT}/skel/customizations\"\nmkdir -p .atlas-ai/customizations\nif [ ! -f .atlas-ai/customizations/system-prompt-template.md ]; then\n  if [ -d \"$PLUGIN_SKEL\" ]; then\n    cp -n \"$PLUGIN_SKEL\"/*.md .atlas-ai/customizations/  # -n: no-clobber, copy starter pack\n  else\n    : > .atlas-ai/customizations/system-prompt-template.md  # empty is fine per execute-task Entry gate\n  fi\nfi\n```\n\nThe starter pack (`domain-vocabulary.md`, `system-prompt-template.md`,\n`task-enrichment-rules.md`, `verification-preferences.md`) is editable —\nusers tune them to project-specific terminology. Empty is acceptable; the\nfile simply must exist.\n\nAlso scaffold `.atlas-ai/ship-check.py` if it doesn't already exist:\n\n```bash\nif [ ! -f .atlas-ai/ship-check.py ] && [ -f \"${CLAUDE_PLUGIN_ROOT}/skel/ship-check.py\" ]; then\n  cp \"${CLAUDE_PLUGIN_ROOT}/skel/ship-check.py\" .atlas-ai/ship-check.py\n  chmod +x .atlas-ai/ship-check.py\nfi\n```\n\n(Codified 2026-06-04 — yesterday's run halted at execute-task Entry\nbecause `system-prompt-template.md` was missing; the file had to be\nmanually `touch`-ed from outside the loop.)\n\n### Step 3: Provider configuration — DETECT-FIRST\n\nWhen the TaskMaster backend is active, **read `task-master models` output BEFORE\nsetting anything.** This is the load-bearing rule. A working user config must\nNOT be overwritten silently. When the native backend is active, provider\nconfiguration is handled by the resolved backend and this TaskMaster-specific\nstep is informational only.\n\n| `task-master models` output | Action |\n|---|---|\n| Main / Research / Fallback all populated with a supported provider | SKIP — go to Step 4. |\n| Main set, Research/Fallback empty | Partial mutate — fill the empty roles only. |\n| All three empty (fresh install) | Full configure — use the default stack below. |\n| Provider flagged unsupported / deprecated | Ask the user before mutating. |\n\n**Why DETECT-FIRST:** v4 dogfood (2026-04-13, LEARNING #9) caught the skill\noverwriting a working `gemini-cli / gemini-3-pro-preview` config because the\nprocedure wasn't branch-aware. Detect first, mutate only the empty slots.\n\n**Default stack (fresh install only):**\n\n```bash\ntask-master models --set-main gemini-3-pro-preview --gemini-cli\ntask-master models --set-research gemini-3-pro-preview --gemini-cli\ntask-master models --set-fallback gemini-3-flash-preview --gemini-cli\n```\n\nWhy Gemini CLI: ~113× more token-efficient than sonnet on parse-prd, free via\nany Google account, no API key. One provider, three roles, zero cost.\n\n**Alternatives:** Claude Max (`--claude-code sonnet/opus/haiku`), any of the\n12 task-master provider families, or a registered MCP research tool for the\nResearch role.\n\n### Step 4: Probe test\n\nIf tasks already exist, call the MCP tool\n`mcp__plugin_prd_go__validate_setup` or run backend op `rate`:\n\n```bash\npython3 script.py rate\n```\n\nIf no tasks exist yet (fresh project), skip the probe — Step 3's provider\nconfiguration is sufficient evidence the pipeline is wired.\n\n### Step 5: Status line\n\nRender the preflight progress panel and print it. MCP-mode: call\n`render_status(phase=\"SETUP\")` and print its `rendered` field. CLI-mode:\n`python3 script.py status --phase SETUP`. (Fallback if the renderer is\nunavailable — emit a compact one-block status:)\n\n```\nSetup:\n  task-master: installed (<version>)\n  project: initialized (.taskmaster/)\n  provider: <main-provider> (main) / <research-provider> (research)\n  pipeline: verified\n```\n\n## Exit gate\n\nAfter Steps 1–5 report green:\n\n1. Call `mcp__plugin_prd_go__advance_phase(expected_current=\"SETUP\", target=\"DISCOVER\", evidence={\"validate_setup\": <Step 4 result dict>, \"provider_configured\": True})`.\n   The call atomically transitions `pipeline.json` from SETUP to DISCOVER.\n   The `expected_current` field is the compare-and-swap guard;\n   `evidence` is stored under `phase_evidence[DISCOVER]` for audit.\n2. Return control to the orchestrator (`prd-taskmaster` skill). Do NOT invoke\n   DISCOVER directly — the orchestrator re-reads `current_phase` and routes.\n\n## Red flags (stop and report, do not paper over)\n\n- \"The config is set but looks wrong — I'll fix it\" → NO. Report and ask.\n- \"No tasks exist so I'll skip backend detection\" → NO. Backend detection must\n  run before DISCOVER so later backend ops resolve consistently.\n- \"I'll auto-install task-master via npm\" → NO. Installation is a user action;\n  this skill only reports that installation unlocks the TaskMaster backend.\n- \"I can call advance_phase without check_gate\" → NO. Gate first, always.\n\n## Non-exits\n\nThis skill does not use explicit process termination. A hard block reports\nthe reason and returns control to the orchestrator; the orchestrator decides\nwhether to surface to the user.","author":"@anombyte93","ownerProfile":null,"authorContacts":null,"sourceUrl":"https://github.com/anombyte93/prd-taskmaster/tree/main/skills/setup","license":"MIT","category":"document","lang":"en","tokens":1737,"stars":0,"calls30d":1,"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","Bash","Skill","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":[]}}