sucp-plan
Phase skill for super-ultra-code-plan Step 3 (writing plans, architectural path). Covers the mandatory visual implementation map, the ultra-plan/v1 plan template, plan publishing, and plan-to-GitHub-issue sync. Load only from super-ultra-code-plan, after the design is approved.
- License 许可
- MIT
- 最近更新
- 2026-11-15
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- sucp-plan
- description
- Phase skill for super-ultra-code-plan Step 3 (writing plans, architectural path). Covers the mandatory visual implementation map, the ultra-plan/v1 plan template, plan publishing, and plan-to-GitHub-issue sync. Load only from super-ultra-code-plan, after the design is approved.
02 资源文件 3
- 参考文档references/01-runner-contract.md11.7 KB
- 参考文档references/02-plan-templates.md8.6 KB
- 参考文档references/03-publishing-and-issue.md15.2 KB
03 SKILL.md 正文
Writing Plans
Part of
super-ultra-code-plan. The orchestrating agent readssucp-rulestoo; a subagent follows the Rules card of its role instead. Next phase:sucp-tdd-debug.
Load on demand
The core rules in this file are always loaded; a reference file is read in full whenever its trigger below applies.
| Reference | Read it |
|---|---|
| 01-runner-contract.md | Before writing or validating plan frontmatter: execution hooks, skip_if, and every field the runner enforces. |
| 02-plan-templates.md | Before writing a plan file: the plan header template and the task template. |
| 03-publishing-and-issue.md | Before running the publisher or plan-issue-sync, or when a mirror or an issue disagrees with its plan. |
3️⃣ Writing Plans (architectural path only)
Component 2: Plan output: every task must be independently understandable, executable, and testable.
Visual Implementation Map: MANDATORY for every plan
- Every plan (Bounded short design in chat AND Architectural plan file) MUST include at least one valid
```mermaiddiagram. No exceptions, noN/A. A plan without Mermaid is incomplete and blocks the approval gate. - Minimum: one
flowchart(TD or LR) placed near the plan overview showing task nodes (T1,T2, ...),depends_onedges, human approval gate(s) ({{...}}), and the Verify → Completion tail. - Choose additional diagram types that match the reasoning when they add clarity:
flowchartfor process and decisions,sequenceDiagramfor component/user interactions,stateDiagram-v2for lifecycle/status,graphfor architecture/dependencies,erDiagramfor data relationships. - Every diagram MUST declare
accTitle:andaccDescr:on the lines immediately after the diagram-type declaration. Mermaid emits these as<title>/<desc>wired toaria-labelledby, which is what makes the diagram readable to a screen reader and to an agent that parses the SVG. The title names the diagram; the description states what it shows, in one or two sentences, without restating the node list. A diagram without them is incomplete and failsscripts/validate-skill.mjs. - Keep diagrams free of decoration that carries no information: no gradient fills, no drop shadows, no emoji used as the only label.
accDescris the accessible equivalent of visual flourish. - Label gates and decision points (
{{Gate}},{Decision}), keep node ids identical totasks[].idfrontmatter ids andTask <id>headings, and keep node labels consistent with the interfaces, components, files, and acceptance criteria in the plan. - Before execution, read the plan and walk through the Mermaid diagram: identify the start, sequence, dependencies, branches, approval gates, failure paths, and expected outcome. Compare it with the current repository and approved spec.
- A missing diagram, an unrunnable diagram (mermaid syntax error), or a mismatch between the diagram, plan tasks, spec, or repository is a pre-execution blocker. Update the affected artifact or obtain approval for the changed interpretation before implementing.
- When the plan changes, update the Mermaid diagram and its related task, interface, acceptance, and verification details in the same change.
- Mermaid is a visual companion and a machine-checked contract (frontmatter
depends_on== Mermaid edges == task headings), not a replacement for exact files, interfaces, acceptance criteria, test steps, commands, or evidence. - Edge Direction Convention:
A --> Bmeans B depends on A. Everydepends_onentry requires exactly one matching arrow, and every arrow between two task nodes must be declared independs_on.scripts/ultra-plan-runner.mjsparses the map structurally and enforces both directions, so removing an arrow or adding one without updating the frontmatter fails the gate. Reachability is not a substitute: a transitive path does not satisfy adepends_onentry. - A task id mentioned inside an unrelated label, comment, or second diagram does not count as a node. Node presence is determined by graph structure, not by text search.
Trigger: spec/requirements exist, before touching code.
Assume: engineer has zero codebase context, questionable taste, skilled developer, weak test design.
Save to: docs/code-plan/plans/YYYY-MM-DD-<feature-name>.md
Plan body lives in the file, not the session: write the full plan content into the .md deliverable and keep in-session explanation to a concise summary plus the file path and the key decisions needing approval. Do not paste or narrate the whole plan in chat; when the user wants the details, point to the saved file. In plan/spec review mode, present the file content as the reviewable artifact; the approval question is the Gate 2 bullet below (spec approval, header Spec, is in sucp-brainstorm).
- Gate 2: after the plan validates (and is published at Draft), show the plan path and a concise summary in chat, then ask approval through the Confirmation Protocol (header
Plan); do not paste the plan. For Bounded work the Design call is Gate 2 when the plan was validated first (sucp-brainstorm), so no separatePlanquestion follows.- The summary lists each task with
Blocked by(the task ids it waits on, or none) andWhat it delivers(the behaviour it makes verifiable), so the owner can judge the granularity. Scope check: spec covers multiple independent subsystems → split into separate plans, each producing working testable software alone. File structure: map files before defining tasks. One responsibility per file. Files that change together, live together. Split by responsibility not layer. Existing codebase → follow established patterns; split only files grown unwieldy under current task. File-size trigger: a source file of imperative logic that exceeds ~500 lines must be split by responsibility during the same task; a single file must not exceed 1000 lines without an explicitdefer: <ceiling>, <upgrade-trigger>exception. Generated code, fixture/data files, and stylesheets are exempt from the 500-line trigger. Cite the line count when flagging an over-threshold file. The commit gatebun run size:checkenforces the byte form mechanically: a staged file over 20,000 bytes (5,000 tokens) is refused unless it is exempt (-size-gatein.gitattributes) or within its ceiling inscripts/file-size-baseline.json, so a task that grows a file past it splits the file in the same task. Task sizing: smallest unit carrying its own test cycle, worth independent review gate. Fold setup/config/docs into the task needing them. Split only where reviewer could reject one task while approving neighbor. Vertical slices: every task is a tracer-bullet vertical slice, a narrow path through each layer it needs (data, logic, interface, tests) that is verifiable on its own; never one layer per task. Prefactor first: a refactor that makes the feature easier to add is its own task, and the tasks it unblocks depend on it ("make the change easy, then make the easy change"). Wide refactor: one mechanical change whose blast radius spans the codebase (a rename, a shared type) cannot land green as one slice, so it runs as expand, migrate in batches, contract. The expand task adds the new form beside the old; each migrate batch, sized by blast radius, depends on the expand task; the contract task removes the old form and depends on every batch. Step granularity: 2-5 min per step.
- The summary lists each task with
- Write failing test
- Run — confirm fail
- Implement minimal code
- Run — confirm pass
- Commit
Runner Contract (determinism fondasi): the YAML frontmatter below is the single source of truth for routing, dependency order, retry, and idempotency. Prose and checklists under it explain but must never contradict it. Every
Task Nheading MUST use anididentical to itstasks[].idin frontmatter and to its node name in the Mermaid map; any mismatch is a pre-execution blocker. Commands inside the plan MUST be directly runnable and wrapper-agnostic (never MCP, rtk or tgrep specific) while still obeying the Mandatory Runtime rule: JS/TS commands are written with Bun (bun test path,bun run lint,bun install), nevernpm/npx/node. Optional wrappers such as rtk are applied by the runner or harness when present, not baked into the portable artifact.
Runner Contract detail (Frontmatter Must Be Real YAML, Execution Hook Contract, Idempotency Honesty, Declared Fields Are Enforced): references/01-runner-contract.md.
Plan header template and task template: references/02-plan-templates.md.
Terminal task: a task whose output is costly to redo or visible outside the repository (full render, deploy, publish, release) ends its heading with (terminal), depends on every other task, has no run[] (a failing skip_if would make --execute redo it), and carries a skip_if that proves the output exists. The debt sweep runs before it, so it runs once (sucp-debt-sweep, 06-terminal-task.md).
Deterministic step mapping: one execution step maps to exactly one runnable shell command (1-to-1). Never fold multiple non-chained commands into a single step. Each executable step carries cmd, expect (exit code / count), retry (explicit integer, transient-only), and on_fail (route, never silent). retry: 0 means no retry; the word "bounded" is banned in favor of an integer. These four fields live in tasks[].run[] in the frontmatter, which is the copy the runner executes; the - [ ] Step N checklist in the task body is the human-readable copy of the same steps. When the two disagree, the frontmatter wins and the checklist is the defect.
No placeholders — banned: TBD, TODO, "implement later", "add appropriate error handling", "similar to Task N", steps without code, undefined references.
Plan self-review: spec and acceptance-criteria coverage (every requirement → a task), selected reasoning-lens coverage and outputs, visual-map presence + validity + consistency (at least one runnable Mermaid flowchart; every task id appears as a node; every depends_on edge appears in the diagram; missing diagram or mismatch = blocker), non-goals, assumptions, dependencies, risks, rollback, placeholder scan, anti-bloat pruning pass (scan with tags: delete: dead/speculative code, stdlib: stdlib replacement, native: platform feature, yagni: single-impl abstraction/unused config, shrink: fewer lines; target net line reduction), deliberate shortcut check (all simplifications must include defer: <ceiling>, <upgrade-trigger>), type consistency across tasks (signature names must match), and verification evidence. Fix inline, no re-review cycle.
Pre-execution walkthrough: refresh the active project profile and inspect the plan's Mermaid diagram and selected reasoning-lens outputs, then compare every path, dependency, gate, failure branch, contract, command, and acceptance criterion with the current repository and approved spec before starting implementation.
Execution handoff: fan-out is proportional to the work, and the reason for the chosen width is stated at the handoff.
- Inline for a genuinely atomic task (atomic scope, no subagent tool in this runtime, or inseparable shared state).
- Two to four subagents for the usual plan: chunk each task into small verifiable units, dispatch, then gather and synthesize their reports.
- 10 to 15 only for that many disjoint scopes, at most 15 in flight, every chunk with one owner and no two writing the same file.
Plan Publishing
Component 2b: Reachability: a plan that exists only inside a project repository cannot be searched, rendered, or re-read months later. Publishing is a required step of finishing a plan, not an optional convenience.
-
The trigger is "the plan is finished", not "the plan is approved". Three publishes, in this order:
- Immediately after
bun scripts/ultra-plan-runner.mjs <plan.md>printsValidation: OK, and before requesting approval. The plan lands in the vault atstatus: Draftwhile the human is still deciding, so review happens in Obsidian — where they are looking — instead of only in a repository directory they have to go find. - Again after approval, and before
bun scripts/ultra-plan-runner.mjs <plan.md> --execute. The mirror then carries the approved state. - After execution and after the Session-Close Debt Sweep. Close the plan in three sub-steps: apply the task ticks, set
status: Completeonly when the owner answers theClose plangate withMark Completeafterbun scripts/plan-closeout.mjs --readiness <plan.md>(sucp-debt-sweep, 6.5.5), publish again. The ticks are applied bybun scripts/plan-mark-done.mjs <plan.md> --from <runner.log>, which reads the runner's own recorded statuses and refuses to tick anything the runner recorded asNEEDS-AGENT,READY (dry-run),HALTED-UPSTREAMorFAILED-*. Capture the runner output to a log first; that log is the evidence.
The same three steps also drive the GitHub issue mirror, run immediately after the vault publish of the same step. See
Plan → GitHub Issuebelow. One command runs both:bun scripts/plan-sync.mjs <plan.md> [--project <key>]publishes, then syncs the issue, and printspublish: exit Nandissue-sync: exit M, because a file write here and a network write to somebody else's API fail for different reasons. Both scripts stay callable alone. Between steps 2 and 3, sync on delivery as well: runplan-sync.mjson the session branch's plan when the session PR is opened and after every push that changes the plan, so the issue does not show the approval snapshot through the whole execution. The PR links the issue withRefs #<n>, neverCloses #<n>, because the plan's status closes it. Do not skip step 1 because approval feels close. The whole reason the trigger moved earlier is that the authoring and approval window is exactly when a human wants to read the plan, and it is currently the window in which the vault has no copy at all. - Immediately after
Publisher detail (exit codes, the vault mirror, the check) and the one-way GitHub issue mirror: references/03-publishing-and-issue.md.
- Mandate: you MUST run the publisher from the vivera repository: that is where the publisher and
plans.publish.jsonlive, whichever project owns the plan. Those two runs are what make "every plan is also in the vault" true rather than aspirational.
04 同仓库更多 Skills
super-ultra-code-plan
暂无简介
sucp-verify-deliver
Phase skill for super-ultra-code-plan Step 5 (verification before completion, professional engineering gates, and pull request delivery with the PR registry and batch merge). Load only from super-ultra-code-plan, before any completion claim or PR.
sucp-tdd-debug
Phase skill for super-ultra-code-plan Step 4 (test-driven development and systematic debugging). Covers the RED-GREEN-REFACTOR iron law and the bug isolation loop. Load only from super-ultra-code-plan, before the first failing test or bug reproduction.
sucp-rules
Shared cross-cutting operating rules for the super-ultra-code-plan pipeline (authority, safety, delegation, tool orchestration, token efficiency, memory, output, approved-work completion, and the consolidated anti-pattern table). Loaded by super-ultra-code-plan at the start of every run and read alongside the active phase skill. Not a standalone workflow.
sucp-overnight
Phase skill for super-ultra-code-plan, unattended mode. Takes an already approved plan to a verified, registered pull request while the user is away, with an entry gate, hard stops, a retry budget, and a morning handoff file. Load only from super-ultra-code-plan, after the plan is Approved, when the user says they are leaving ("overnight", "check back later", "tinggal tidur").
sucp-debt-sweep
Phase skill for super-ultra-code-plan Step 6 (session-close debt sweep and follow-up injection, plus the learning harvest and graphify sync). Load only from super-ultra-code-plan, after the plan is Done 100% (every task but a terminal task, when the plan has one) and the evidence gate is green.