원클릭으로
tdk-plan
Execute the implementation planning workflow using the plan template to generate design artifacts.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Execute the implementation planning workflow using the plan template to generate design artifacts.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Identify underspecified areas in the current feature spec by asking up to 5 highly targeted clarification questions and encoding answers back into the spec.
Primary implementation skill. Execute phases from plan.md ## Phases table. Read plan.md as source of truth for status + dependency graph.
Create spec.md from a feature or child-slice description, or replay --interview against existing spec.md. Supports --fast, memory, and an embedded quality gate.
Project-level architecture recommendation and brownfield recovery advisor. Writes architecture reports only; does not mutate layout or config.
Deprecated compatibility route for /tdk-workspace-layout-propose.
Observe-first onboarding for existing repositories. Summarizes repo shape, current TDK config state, and safe next-step recommendations without product discovery or source-tree changes.
| name | tdk-plan |
| description | Execute the implementation planning workflow using the plan template to generate design artifacts. |
| metadata | {"version":"11.0.0"} |
If ANY script returns an error, you MUST:
DO NOT:
$ARGUMENTS
You MUST consider the user input before proceeding (if not empty).
YAGNI · KISS · DRY. Implement only what is required. Prefer simple over clever. Single source of truth. Be honest, brutal, straight to the point, and concise.
This command produces:
plan.md)phases/phase-NN-*.md)This command does NOT:
--tdd / --ut-backfill generate test-first or backfill phase sections; UT implementation is handled by /tdk-implement through ## Delegate Skills in generated phase files).flowchart TD
A[Step 0 Parse Args + Validate TASK_ID] --> B[Step 0.1 Load Project Context]
B --> BM{--migrate-artifacts?}
BM -->|yes| MW[Step 0.migrate Dry-run + Confirm + Transaction]
BM -->|no| B2[Step 0.1b Load Skill Routing]
B2 --> C[Step 0.memory Memory Pre-load]
C --> S[Step 0.scope Scope Challenge]
S --> X[Step 0.deps Cross-Plan Scan]
X --> Q[Step 0.9 Specification Quality Gate]
Q --> D[Step 1 Setup]
D --> E{planExists?}
E -->|yes| F[Step 1.5 Handle Existing Plan]
E -->|no| M[Step 1.7 Mode Detection]
F --> M
M -->|red-team / validate| RT[Phase 06 / 07 short-circuit]
M -->|default / fast / hard| G[Step 2 Load Context]
G --> H[Step 3 Execute Plan Workflow]
H --> I[Phase 0.guardian]
I --> J[Step 4 Report Results]
J --> RT2[Step 4.5 Red Team Review]
RT2 --> V[Step 4.7 Validation Interview]
This diagram is the authoritative workflow. Prose sections below provide detail per node.
Inline.
Split $ARGUMENTS into TASK_ID, FLAGS, BACKFILL_TARGET, and USER_CONTENT.
TASK_ID: first argument token. It must be a valid task ID. Validate only this cleaned token with tdk-validate-task-id and host skill name /tdk-plan.FLAGS: known mode flags --fast | --hard | --tdd | --ut-backfill | --red-team | --validate | --migrate-artifacts, allowed anywhere after TASK_ID. Flags fall into three independent categories: speed (--fast, --hard), test (--tdd, --ut-backfill), action (--red-team, --validate, --migrate-artifacts). When --ut-backfill is present, also accept backfill targeting flags --sub-workspace <name>, --module <name> (requires --sub-workspace), and --standalone; these targeting flags are unknown-flag STOP errors when --ut-backfill is absent.BACKFILL_TARGET: only populated when --ut-backfill is present. Shape: { sub_workspace: string | "", module: string | "", standalone: boolean }. Remove targeting flags and their values from USER_CONTENT.USER_CONTENT: remaining non-flag text after TASK_ID, preserving order. Empty string if no content was supplied.Reject with STOP if the first argument token is missing or invalid, a known mode flag appears before TASK_ID, any token beginning with -- is not an exact whitelisted mode flag, more than one flag from the same category (speed / test / action) is present, --fast is combined with --tdd or --ut-backfill, --migrate-artifacts is combined with any speed, test, targeting, red-team, or validate flag, a backfill targeting flag appears without --ut-backfill, --sub-workspace or --module is missing its value, or --module appears without --sub-workspace. Unknown flag or category conflict → STOP with explicit error (see references/modes.md). If tdk-validate-task-id STOPs → halt. Store: TASK_ID, TASK_ID_SOURCE, FLAGS, BACKFILL_TARGET, USER_CONTENT.
Inline. Before any direct Bun script command in this skill or its references, resolve the project root at the agent layer using the active coding harness/session context. Ask the user for the project root if you cannot identify it confidently.
bash -lc '
PROJECT_DIR="$1"
if [ -z "$PROJECT_DIR" ] || [ ! -d "$PROJECT_DIR/.specify/scripts/ts" ]; then
echo "Invalid project root: $PROJECT_DIR" >&2
exit 1
fi
(cd "$PROJECT_DIR/.specify/scripts/ts" && bun src/commands/...)
' -- "<agent-resolved-project-root>"
Replace <agent-resolved-project-root> with the actual absolute project root; do not pass the placeholder literally. Invoke scripts from the resolved root with (cd "$PROJECT_DIR/.specify/scripts/ts" && bun src/commands/...). If the Bun command exits non-zero, follow the critical error handling rule above.
Inline.
Invoke tdk-load-project-context with the validated TASK_ID. Store: PROJECT_CONTEXT, FEATURE_DIR.
Load: references/migrate-artifacts-workflow.md
Run only when FLAGS contains --migrate-artifacts, immediately after project
context resolves FEATURE_DIR. Execute the dry-run/confirmation transaction
and end the command; skip skill routing, memory, scope, dependency scan, setup,
existing-plan handling, design, red-team, and validation.
Load: references/skill-routing.md
Resolve skill-routing file per reference. Parse sub-workspace sections. Store: SKILL_ROUTING map. Missing file → AskUserQuestion per reference (opt-in create or skip with empty map).
When FLAGS contains --red-team or --validate, do not run the interactive missing-file AskUserQuestion/create flow from this step. Those action flags still MUST always perform exact-path inline routing reads inside their own workflows.
Load: references/gates.md
Run only if .specify/memory/memory-index.md exists. Pre-load Context Block; carry it forward to Phase 0.guardian. Non-blocking — continue on failure.
Load: references/scope-challenge.md
Skip if --fast, spec.md $ARGUMENTS <20 words, "just plan / quick / already decided" signals, or prior scope already recorded. Otherwise: 3-question batched AskUserQuestion → route EXPANSION / HOLD / REDUCTION → write scope_mode: + append ## Scope Challenge session block.
Load: references/cross-plan-deps.md
Skip if --fast in FLAGS (Step 1.7 hasn't resolved MODE yet at this point in the flow). Otherwise invoke (cd "$PROJECT_DIR/.specify/scripts/ts" && bun src/commands/util/scan-cross-plan-deps.ts --current <TASK_ID> --json), parse findings, optionally auto-fix D1 bidirectional gaps via AskUserQuestion + dirty-tree gate (Validation S3 D12). Advisory only — never STOPs plan creation.
Derive featureSpec and featureDir from the already resolved project context
and task ID without creating files or directories. Run this read-only gate
before setup-plan.ts so a blocked spec cannot leave a new plan.md template.
Run:
(cd "$PROJECT_DIR/.specify/scripts/ts" && bun src/commands/util/validate-specification-quality-gate.ts "{featureSpec}" --legacy-checklist "{featureDir}/checklists/requirements.md" --json)
An embedded pass gate is accepted. warn is accepted only with no blocking
issues. A legacy spec may use an existing checklists/requirements.md only
when the embedded gate is absent; report this fallback explicitly. STOP on
fail, malformed gate data, blocking issues, or when both gate and legacy
fallback are missing.
Inline.
Run (cd "$PROJECT_DIR/.specify/scripts/ts" && bun src/commands/util/setup-plan.ts {task_id} --json). Parse JSON for taskId, featureSpec, implPlan, featureDir, hasGit, planExists.
Load: references/handle-existing-plan.md
Trigger: only if planExists == "true". Implements Rewrite / Append / Abort + F13 Soft Dirty Guard + F19 Lowercase Enforcement + Phase File Content Template.
Load: references/modes.md
Resolve MODE from FLAGS: fast | hard | red-team | validate | default (no flag). Resolve test_mode independently from FLAGS: tdd | ut_backfill | none (no test flag). Conflict / unknown → already STOPped at Step 0. --red-team / --validate short-circuit to Phase 06 / 07 over the existing plan and skip Steps 2–4, using USER_CONTENT as focus text when non-empty. Other modes continue to Step 2 and use USER_CONTENT as planning instruction when non-empty; test_mode and BACKFILL_TARGET carry forward to Step 3b Design and the plan output contract.
Load: references/gates.md
Read featureSpec and .specify/memory/constitution.md. Apply Constitution Check + Skip Conditions. Choose UPDATE vs REGENERATE mode based on Step 1.5 outcome. Per-step skip rules under each mode are defined in references/modes.md.
New spec format sections to read: ## 1. Problem Statement, ## 2. Scope Boundary, ## 3. Impact Surface, ## 5. User Requirements & Testing (with [sw/module] tags), ## 6. Functional Requirements (with tags), ## 7. Success Criteria, ## 8. Risks & Mitigations.
Load: references/research-phase.md
Load: references/design-phase.md
Includes Solution Design, Embedded Brainstorming, Sequential Thinking for phase decomposition, and UT Phase Auto-inclusion.
Load: references/plan-output-contract.md
STOP before writing plan.md, phases/*.md, or any conditional supporting
artifact unless references/plan-output-contract.md has been loaded
successfully in this step. Use the loaded contract as the only source for
output layout, frontmatter, phase file conventions, supporting-artifact index,
quality checklist, Decisions Made table, and sanitization rules; do not guess
or reconstruct the layout from memory.
Load: references/gates.md
Spawn tdk-memory-agent agent with --mode validate. Read Guardian Report; act per BLOCK_IMPL / REVIEW / CLEAR outcome.
If the report returns STATUS: MCP_UNAVAILABLE, preserve the guardian fallback behavior from references/gates.md; do not weaken the plan blocking gate.
Inline.
Command ends after Phase 1 design. Report: branch, implPlan path, generated artifacts, ## Decisions Made summary. When MODE != default, print the one-line banner from references/modes.md (e.g. Mode: fast — research / scope / deps / red-team / validate / UT skipped.).
Load: references/red-team-workflow.md
Skip if MODE in {default, fast} AND --red-team not set. Otherwise spawn the 3 hostile personas (skeptic + security + reliability) in parallel, adjudicate via markdown-table + free-text reply, apply accepted findings as session-prefixed markers, append ## Red Team Review to plan.md. Use USER_CONTENT as reviewer focus when non-empty. Bumps red_team_session: N.
Load: references/validate-workflow.md
Skip if MODE == "fast". Otherwise: orphan-detect any prior (in-progress) session (Resume / Discard / Cancel via AskUserQuestion + trust-ask). On fresh run, prompt user Run validation interview? [y/N] (auto-yes on --validate action). Generate 3–8 questions via template framework, biasing toward USER_CONTENT as validation focus when non-empty, batch in groups of 4, write ## Validation Log with (in-progress) → (completed | partial) marker + validation_cursor resume state. Bumps validation_session: N.
For every internal Load: references/X.md directive, resolve the target from SKILL_BASE_DIR, the directory containing this SKILL.md, to the expected absolute path SKILL_BASE_DIR/references/X.md. Before proceeding with the current step:
<!-- DO NOT LOAD.On missing, unreadable, or stubbed internal references, STOP and report the expected absolute path and current step. Do not try alternate paths, fallback layouts, or partial reconstruction from memory.
This contract applies only to internal references/*.md loads. Project-specific files governed by references/skill-routing.md keep their documented AskUserQuestion / skip behavior.
| Command | Reference | Purpose |
|---|---|---|
/tdk-plan <ID> --red-team | references/red-team-workflow.md | Spawn 3 hostile personas (skeptic + security + reliability), adjudicate findings, apply session-prefixed markers. |
/tdk-plan <ID> --validate | references/validate-workflow.md | Template-based 3–8 question interview across 8 categories (3 tdk-prioritized + 5 ck-plan). Resume-able via validation_cursor. |
references/gates.md.Remember: plan quality determines implementation success.