| name | deep-plan |
| description | This skill should be used at Phase 2 of deep-work, after research.md approval, to design a detailed implementation plan with TDD slices. Decomposes work into SLICE-NNN units with `depends_on` DAG, acceptance contracts (`failing_test`, `acceptance_threshold`), and optional `cluster_id` hint for parallel-safe grouping. Emits plan.md with the inline slice DAG (Implement Phase's deep-implement skill parses it for worker fan-out โ no external slices.md/slice-graph.json is emitted). Triggered by 'create implementation plan', '๊ณํ ์๋ฆฝ', /deep-plan slash, cross-platform Skill({ skill: "deep-work:deep-plan", args: "..." }), or orchestrator dispatch after research approval. |
| user-invocable | true |
[!IMPORTANT]
Skill body echo ๊ธ์ง
์ด SKILL.md ๋ณธ๋ฌธ์ ์ฌ์ฉ์์๊ฒ echoํ๊ฑฐ๋ ์์ฝํ์ฌ ์ถ๋ ฅํ์ง ๋ง๋ผ.
- Section 1 (state ๋ก๋, Prerequisites research.md Read, ์๋ฃ-marker ๊ฐ์ง)๋ silent ๋ด๋ถ ์ฒ๋ฆฌ. user-facing ์ฃผ ๋์์ Section 2์ First Action: slice ์ค๊ณ ๊ฐ์ ์ ์ธ.
- Section 3 ์๋ฃ ๋ฉ์์ง๋ plan.md ์์ฑ, Completeness Policy ๊ฒ์ฆ, Phase Review Gate๋ฅผ ์ค์ ๋ก ์ํํ ๋ค์๋ง ์ถ๋ ฅ.
- ๋ณธ ๋ฌธ์ ๋ด code block์ ์ง์นจ/์์์ด๋ค. ์๋ต์ผ๋ก ์ถ๋ ฅํ์ง ๋ง๋ผ.
Section 1: State ๋ก๋ (ํ์ โ ๊ฑด๋๋ฐ๊ธฐ ๊ธ์ง)
- Session ID ๊ฒฐ์
- $ARGUMENTS์ --session=ID โ ์ฌ์ฉ
- ์์ผ๋ฉด โ .claude/deep-work-sessions.json์์ active session ํ์
- State ํ์ผ ์ฝ๊ธฐ:
.claude/deep-work.{SESSION_ID}.md
- ์กฐ๊ฑด ๋ณ์ ํ์ธ:
- worktree_path โ $ARGUMENTS ์ฐ์ , ์์ผ๋ฉด state์์
- team_mode โ $ARGUMENTS ์ฐ์ , ์์ผ๋ฉด state์์ (์์ผ๋ฉด solo)
- cross_model โ $ARGUMENTS ์ฐ์ , ์์ผ๋ฉด state์์
work_dir, project_type, team_mode ์ถ์ถ โ $WORK_DIR ์ค์ (๊ธฐ๋ณธ: deep-work)
current_phase๊ฐ "plan"์ด๊ณ research_complete๊ฐ true์ธ์ง ํ์ธ
plan_started_at ๊ธฐ๋ก (ISO timestamp)
์๋ฃ-Marker ๊ฐ์ง (resume ๊ฒฝ๋ก โ F1, NW5)
plan_approved: true ํ๋๊ฐ state์ ์ด๋ฏธ ์๊ณ $ARGUMENTS์ --force-rerun์ด ์์ผ๋ฉด paused-after-approval ๋ณต๊ท ํ๋ณด ๊ฒฝ๋ก์ด๋ค. ๋จ, Orchestrator ยง3-3๊ฐ ์ด๋ฏธ integrity check(sha256 ๋น๊ต)๋ฅผ ์ํํ์ฌ stale approval ์ skill์ ์ง์ ์ฌํธ์ถํ๋ฏ๋ก, ๋ณธ branch๋ ์ ์ dispatch ๊ฒฝ๋ก์์๋ง ๋๋ฌ:
- "Phase 2 (Plan)์ ์ด๋ฏธ ์น์ธยท์๋ฃ๋์์ต๋๋ค. Exit Gate๋ฅผ ์ฌํ์ํฉ๋๋ค." ์ถ๋ ฅ
- Orchestrator ยง3-3์ผ๋ก ์ ์ด ๋ฐํ (review+approval ๊ฑฐ์น์ง ์๊ณ ๋ฐ๋ก Exit Gate ์ฌ์คํ)
- Section 2/3 ์ง์
๊ธ์ง
์ค์ (NW5): Resume fast-path์ integrity check(plan_approved_hash ๋น๊ต)๋ Orchestrator ยง3-3๊ฐ ์ฐ์ ๋ด๋น. ๋ณธ branch๋ plan_approved: true๋ง ๊ฐ์งํ๋, Orchestrator๊ฐ hash ๋ถ์ผ์น ๊ฐ์ง ์ approval invalidate + skill ์ฌํธ์ถ๋ก ์ฐํ๋จ.
Prerequisites ๋ก๋
- Read
$WORK_DIR/research.md โ ์ฃผ ์ฐธ์กฐ
- Team ๋ชจ๋ ์ ๋ณด์กฐ ์ฐธ์กฐ (์กด์ฌํ๋ฉด):
$WORK_DIR/research-architecture.md
$WORK_DIR/research-patterns.md
$WORK_DIR/research-dependencies.md
Critical Constraints
- DO NOT implement anything or modify source code files
- ONLY plan and document in
$WORK_DIR/
Section 2: Phase ์คํ
First Action (์ฆ์ ์คํ โ ๊ฑด๋๋ฐ๊ธฐ ๊ธ์ง)
Section 1 state ๋ก๋, Prerequisites research.md Read, ์๋ฃ-marker ๊ฐ์ง๊ฐ ๋ชจ๋ silentํ๊ฒ ๋๋ ๋ค ์ฆ์ ๋ค์ ๋ฉ์์ง๋ฅผ ์ถ๋ ฅํ๋ค:
"Plan ๋จ๊ณ๋ฅผ ์์ํฉ๋๋ค. research.md๋ฅผ ๊ธฐ๋ฐ์ผ๋ก slice๋ฅผ ์ค๊ณํฉ๋๋ค."
์ด์ด์ Pre-steps (backup / template ๋ก๋ / ์ฌ์ฉ์ ํผ๋๋ฐฑ ํ์ธ) โ plan.md ์์ฑ ์์ผ๋ก ์ฐ์ ์งํ. "์์ํ ๊น์?" ๊ฐ์ ์ถ๊ฐ ํ์ธ ๊ธ์ง.
๊ธ์ง: ์ด ์ ์ธ๊ณผ Pre-steps ์ง์
์ ์ template ๋ณธ๋ฌธ, ์๋ฃ ๋ฉ์์ง, slice ๋ชฉ๋ก์ ์ถ๋ ฅํ์ง ๋ง๋ผ.
Pre-steps
Backup (iteration_count > 0)
๊ธฐ์กด plan.md โ $WORK_DIR/plan.v{iteration_count}.md๋ก ๋ณต์ฌ
Template ์ ์ (์ ํ์ )
Read("../shared/references/plan-templates.md") โ ์ ํฉ ํ
ํ๋ฆฟ ํ์ธ โ ์ฌ์ฉ์์๊ฒ ์ ์
์ฌ์ฉ์ ํผ๋๋ฐฑ ํ์ธ
๊ธฐ์กด plan.md์ > [!NOTE], <!-- HUMAN: -->, inline comment๊ฐ ์์ผ๋ฉด ๋ฐ์
plan.md ์์ฑ
์์ธ ์์ฑ ๊ฐ์ด๋: Read("../shared/references/planning-guide.md")
๋ฌธ์ ๊ตฌ์กฐ
Template ๋ก๋ (project_type ๋ถ๊ธฐ):
project_type: existing โ Read ../shared/templates/plan-template-existing.md
project_type: zero-base โ Read ../shared/templates/plan-template-zerobase.md
๋ ์ค ํด๋นํ๋ template์ Readํ์ฌ ๊ตฌ์กฐ๋ฅผ ํ์
ํ ๋ค, Section 2์์ ์ํํ ๋ถ์ ๊ฒฐ๊ณผ๋ก placeholder๋ฅผ ์ ๋ถ ์นํํ๊ณ $WORK_DIR/plan.md์ Write.
Placeholder policy: Completeness Policy (์๋ ์น์
)๊ฐ ๋จ์ placeholder๋ฅผ ์ฐจ๋จํ๋ค.
Slice Format (v4.0 + v6.7 executable steps + v6.6 DAG)
Medium+ spec-governed plans place exactly one ## Spec Contract Binding JSON
block before the checklist. It records schema_version: 1, mode: strict-spec,
created_by_version, the validated spec_contract identity
(spec_id, spec_sha256, spec_approved_hash), and risk_profile_sha256.
The plan approval runtime is the sole producer of the derived plan.json.
๊ฐ slice๋ - [ ] SLICE-NNN ํ์์ ์ ์งํ๋ ์๊ธฐ ์๊ฒฐ์ TDD ๋จ์์ด๋ฉฐ, ์๋ ํ๋๋ cluster_id๋ฅผ ์ ์ธํ๊ณ ๋ชจ๋ ํ์์ด๋ค. cluster_id๋ optional parallel-safe grouping hint๋ก ์ ์งํ๋ค:
- [ ] SLICE-NNN: [Goal]
- outcome: [independently observable vertical result]
- files: [exact/file/path.ext, exact/test/path.test.ext]
- failing_test: [exact test file/path โ expected failing signal before implementation]
- verification_cmd: [exact command]
- expected_output: [exact success output fragment]
- depends_on: [SLICE-MMM, ...] # DAG edge. ๋น ๋ฐฐ์ด์ด๋ฉด root.
- integration_touchpoints: [CLI, state-store]
- requirements: [REQ-NNN]
- invariants: [INV-NNN]
- failure_modes: [FM-NNN]
- risk: { class: medium, score: 6, triggers: [state-machine] }
- negative_tests: [NEG-NNN]
- evidence_required: [GATE-targeted-tests, GATE-negative-tests]
- rollback: { method: revert-slice, verification: [GATE-recovery] }
- review_policy: deterministic/single/dual
- scope_expansion_trigger: [public API change, new persistent field]
- cluster_id: <optional โ C1|C2|...> # parallel-safe grouping hint (์ ํ)
- code_sketch: [function signature, pseudocode, or boundary sketch]
- spec_checklist: [req1, req2]
- contract: [testable criterion 1, criterion 2]
- acceptance_threshold: all
- size: S/M/L
- steps:
1. [exact file path] [code sketch or function signature detail]
2. [exact file path] [verification step]
Size๋ณ ์์ธ๋ (steps required):
- S: 2-4 steps
- M: 3-7 steps
- L: 5-12 steps
๋ชจ๋ steps ํญ๋ชฉ์ ์คํ ๊ฐ๋ฅํ ์์
์ด์ด์ผ ํ๋ค. ํนํ code-changing step์ ์์ ํ exact file path๋ฅผ ๋ช
์ํ๊ณ , code sketch ๋๋ function signature ์์ค์ ๊ตฌํ ์ธ๋ถ๋ฅผ ํฌํจํ๋ค. L์ด 12 steps๋ฅผ ์ด๊ณผํ๋ฉด slice๋ฅผ ๋ถํ ํ๋ค.
Slice DAG โ Implement Phase contract
depends_on๊ณผ cluster_id๋ deep-implement skill์ด worker fan-out ์ ์ฝ๋ contract์ด๋ค.
depends_on: [SLICE-MMM, ...] โ slice ๊ฐ DAG edge ์ ์. ๋น ๋ฐฐ์ด์ด๋ฉด root slice (๋ค๋ฅธ slice ์์กด ์์ด ์ฆ์ ์์ ๊ฐ๋ฅ). DAG๋ plan.md ๋จ์ผ ํ์ผ์ ์ธ๋ผ์ธ์ผ๋ก ํํ๋๋ฉฐ, ๋ณ๋ slices.md ๋๋ slice-graph.json ์ฐ์ถ๋ฌผ์ emitํ์ง ์๋๋ค. Implement Phase์ deep-implement skill (ยงSection 1)์ด plan.md๋ฅผ ํ์ฑํด DAG๋ฅผ in-memory๋ก ์ฌ๊ตฌ์ฑํ๋ค.
cluster_id โ parallel-safe grouping์ hint. deep-plan์ ์ ํ์ ์ผ๋ก ๋ช
์ํ ์ ์์ผ๋, ๊ถํ์ cluster ๊ฒฐ์ ์ deep-implement์ด ์ํํ๋ค (project size, team_mode, slice ์์กด์ฑ ์์์ ๋ฐ๋ผ ๋์ grouping; agents/implement-slice-worker.md๊ฐ worker invocation ์ cluster_id + cluster_ids prompt ์ธ์๋ฅผ ๋ฐ์).
- Circular dependency ๊ธ์ง โ A โ B โ A ํํ์ ์ฌ์ดํด์ plan ์คํจ๋ก ์ฒ๋ฆฌํ๋ค (Completeness Policy ์ฐจ๋จ ๋์). ๊ฐ์ cluster ๋ด slice๋ ๋์ผ cluster_id๋ฅผ ๊ณต์ ํด์ผ ํ๋ค.
- ์ธ๋ถ ์ฐ์ถ๋ฌผ ์์ ์ ์ฑ
โ deep-plan์ plan.md๋ง emitํ๋ค. slice ๋ชฉ๋ก์ด ๋ณ๋ ํ์ผ๋ก ํ์ํ ๊ฒฝ์ฐ deep-implement์ด plan.md ํ์ฑ ๊ฒฐ๊ณผ๋ฅผ in-memory๋ก ๋ณด์ ํ๊ฑฐ๋ receipt provenance์ ๊ธฐ๋กํ๋ค.
Completeness Policy (v5.8)
๊ธ์ง ํจํด โ ์ต์ข
plan.md์ ์๋๊ฐ ๋จ์ผ๋ฉด plan ์คํจ:
TBD, TODO, FIXME, PLACEHOLDER, implement later,
Add appropriate error handling (๊ตฌ์ฒด์ ์ผ์ด์ค ์์ด),
Write tests for the above (๊ตฌ์ฒด์ test path/assertion ์์ด),
Similar to SLICE-N (์ธ๋ถ ๋ฐ๋ณต ํ์), ..., [etc.],
๋น ์น์
, ์ ์๋์ง ์์ ํ์
/ํจ์ ์ฐธ์กฐ,
failing_test ์์ expected failing signal ๋๋ฝ,
expected_output ์์ exact output fragment ๋๋ฝ,
slice DAG circular dependency (A โ B โ A ๋๋ ์๊ธฐ ์ฐธ์กฐ).
ํด๊ฒฐ ๋ถ๊ฐ ์ โ Open Questions๋ก ์ด๋.
Contract Negotiation (v5.1)
๋ชจ๋ S/M/L slice์ contract ํ๋๋ฅผ Agent(contract-validator)๋ก ๊ฒ์ฆ:
- ๋ชจํธ์ฑ, ํ
์คํธ ๋ถ๊ฐ, ๋๋ฝ๋ ์ฃ์ง ์ผ์ด์ค ๊ฒ์ถ
- Auto-fix + ์ฌ๊ฒ์ฆ (์ต๋ 2ํ)
Plan Diff (iteration_count > 0)
์ด์ ๋ฒ์ ๊ณผ ๊ตฌ์กฐ์ ๋น๊ต โ $WORK_DIR/plan-diff.md ์์ฑ:
์ถ๊ฐ/์์ /์ญ์ ํ์คํฌ, ํ์ผ ์ํฅ ๋ณ๊ฒฝ, ์ํคํ
์ฒ ๊ฒฐ์ ๋ณ๊ฒฝ, ๋ฆฌ์คํฌ ์์ค ๋ณ๊ฒฝ
Phase Review Gate
Read("../shared/references/phase-review-gate.md") โ ํ๋กํ ์ฝ ์คํ:
- Phase: plan
- Document:
$WORK_DIR/plan.md
- Self-review checklist: placeholder ์์, ์ฐ๊ตฌ-๊ณํ ์ถ์ ์ฑ, ์ฌ๋ผ์ด์ค ์์ฑ๋
์ฌ์ฉ์ ํ์ธ ๊ฒฐ๊ณผ:
- ์ต์
1 (๋์) โ ์์ ํ Section 3์ผ๋ก
- ์ต์
2 (ํญ๋ชฉ๋ณ ์กฐ์ ) โ ๊ฐ๋ณ ์ฒ๋ฆฌ ํ Section 3์ผ๋ก
- ์ต์
3 (์ ๋ถ ์คํต) โ plan.md ๊ทธ๋๋ก Section 3์ผ๋ก
์์ ๊ท๋ชจ๋ณ re-review: 3+ ์น์
โ full, 1-2 ์น์
โ structural only, <50์ค โ skip. ์ต๋ 2ํ.
Section 3: ์๋ฃ
์คํ ์์ ์์ ์ฅ์น: ์ด ์น์
์ Section 2์ plan.md ์์ฑ, Completeness Policy ๊ฒ์ฆ, Contract Negotiation, Phase Review Gate๋ฅผ ๋ชจ๋ ์ค์ ๋ก ์ํํ ๋ค์๋ง ์คํํ๋ค. ์ฃผ ๋จ๊ณ๋ฅผ ๊ฑด๋๋ฐ๊ณ ์๋ฃ ๋ฉ์์ง๋ง ์ถ๋ ฅํ๋ ๊ฒ์ ์คํจ ๋ชจ๋์ด๋ค.
State ์
๋ฐ์ดํธ
review_state: completed
phase_review.plan + review_results.plan ์
๋ฐ์ดํธ
plan_completed_at: ISO timestamp
Slice risk projection (v6.13 strict binding; legacy shadow compatibility)
plan.md ์์ฑ ์๋ฃ ์งํ slice๋ณ ์ํ๋๋ฅผ ๊ณ์ฐํ๋ค. strict-spec plan์ ๊ณ์ฐ๋
class/score/triggers๋ฅผ ๊ฐ slice์ risk ํ๋์ ํฌ์ํ๊ณ approval ์ ์
slice_risk_shadow_json๊ณผ exact match์ํจ๋ค. legacy no-spec plan๋ง ๊ธฐ์กด
display-only shadow ํธํ ๊ฒฝ๋ก๋ฅผ ์ฌ์ฉํ๋ค. ์คํจ๋ slice ๋จ์ fail-open์ด์ง๋ง
strict-spec approval์ ๋ถ์ผ์น ์ํ์์ fail-closedํ๋ค.
๋จผ์ PROJECT_ROOT="$(git -C "$WORK_DIR" rev-parse --show-toplevel 2>/dev/null || pwd)"๋ฅผ ์ค์ ํ๋ค โ ์ด ์คํฌ ์ปจํ
์คํธ์ PROJECT_ROOT๋ ๋ฏธ์ ์์ด๋ฉฐ, ๋ฏธ์ค์ ์ CLI๊ฐ cwd๋ก fallbackํด signals๋ฅผ ์ค์์งํ๋ค (Task 7 ๋ฆฌ๋ทฐ W1๊ณผ ๋์ผ ์ฒ๋ฐฉ). ์
๋ ฅ ํ์ผ์ RISK_IN=$(mktemp)๋ก ๋ง๋ค๊ณ ๊ฐ ํธ์ถ ํ rm -f "$RISK_IN" ํ๋ค.
๊ฐ SLICE-NNN์ ๋ํด:
- ์
๋ ฅ JSON:
{"task_text": "<slice ์ ๋ชฉ+outcome+steps ์์ฝ>", "slice_id": "SLICE-NNN", "evidence": {"changed_paths": <slice files ๋ชฉ๋ก>, "keywords": [], "side_effects": [], "evidence_refs": []}}
RISK_OUT=$(node "${CLAUDE_PLUGIN_ROOT}/scripts/risk-profile-cli.js" --stage slice --root "$PROJECT_ROOT" --work-dir "$WORK_DIR" --input-file "$RISK_IN")๋ก ์ถ๋ ฅ์ ์บก์ฒ
- ์ฑ๊ณต:
slice_risk_shadow_json์ ํด๋น ํค์ {class: RISK_OUT.risk_profile.class, score: RISK_OUT.risk_profile.score, triggers: RISK_OUT.risk_profile.hard_triggers์ id ๋ชฉ๋ก, rationale: RISK_OUT.risk_profile.rationale, input_ref: RISK_OUT.input_ref} ๊ธฐ๋ก โ input_ref๋ risk_profile ๋ด๋ถ๊ฐ ์๋๋ผ top-level RISK_OUT.input_ref๋ค (CLI ์ถ๋ ฅ ๊ณ์ฝ). (๊ธฐ์กด JSON ๋ณํฉ ์ฌ๊ธฐ๋ก)
- ์คํจ:
risk_profile_json์ด ์์ง ์์ผ๋ฉด(์: v6.11 ์ด์ ์ ์์ฑ๋ legacy/resume ์ธ์
โ v6.11 orchestrator๋ init ์ ยง1-8.6์ด provisional์ ํญ์ ๊ธฐ๋ก) {"schema_version":1,"history":[],"errors":[]} skeleton์ ๋จผ์ ์์ฑํ ๋ค (ยง5.1 canonical shape โ deep-research/orchestrator writer์ ๋์ผ 3-key), risk_profile_json.errors์ {stage: "slice", message: "SLICE-NNN: <error>", at} append โ slice_risk_shadow_json์ ์ฑ๊ณตํ slice๋ง ๋ณด๊ดํ๋ค (์คํ ยง5.1)
์ด ๊ธฐ๋ก์ Implement์ ๋ชจ๋ธ ์๋น ์ฐ๊ฒฐ์ ์ด๋ค. deep-implement๋ ๊ฐ slice์์
sliceModelTierWithRisk(sessionTier, slice.size, slice_risk_shadow_json["SLICE-NNN"].class)๋ฅผ
ํธ์ถํ๋ค. slice class๊ฐ ์์ผ๋ฉด helper๊ฐ ๊ธฐ์กด sliceModelTier์ ๊ฐ์ ๊ฒฐ๊ณผ๋ฅผ ๋ด๋ฏ๋ก legacy์
fail-open ๋์์ ๋ณด์กด๋๋ค.
--force-rerun์ผ๋ก plan.md๊ฐ ์ฌ์์ฑ๋๋ฉด ์ด ๊ณ์ฐ๋ ์ฌ์ํํ๋ค โ ์ด๋ slice_risk_shadow_json์ ๋ณํฉ์ด ์๋๋ผ ํ์ฌ plan.md์ slice ์งํฉ๋ง์ผ๋ก ์ ๊ฐ์ฒด๋ฅผ ๊ตฌ์ฑํด ํต์งธ๋ก ๊ต์ฒด(replace) ํ๋ค. ์ ๊ฑฐ๋ slice์ ์ด์ ๊ฒฐ๊ณผ๊ฐ ์ ๋ น ํญ๋ชฉ์ผ๋ก ์์กดํ๋ฉด /deep-status --risk๊ฐ plan์ ์๋ slice๋ฅผ ํ์ํ๊ฒ ๋๋ค (Task 8 ๋ฆฌ๋ทฐ W1).
NOTE: current_phase๋ฅผ ๋ณ๊ฒฝํ์ง ์๋๋ค. Orchestrator๊ฐ ๋ฆฌ๋ทฐ+์น์ธ ํ ๋ณ๊ฒฝ.
์๋ฃ ๋ฉ์์ง
๊ตฌํ ๊ณํ์ด ์์ฑ๋์์ต๋๋ค!
๊ณํ์: $WORK_DIR/plan.md
๋ณ๊ฒฝ ํ์ผ: N๊ฐ / ์ ๊ท: N๊ฐ / ํ์คํฌ(slice): N๊ฐ / ์ํ๋: Low/Medium/High
Slice DAG: root N๊ฐ / ์ต๋ depth N / cluster hint N๊ฐ
๊ณํ์ด ์ค๋น๋์์ต๋๋ค. ๋ฆฌ๋ทฐํด์ฃผ์ธ์.