--- name: visual-plan description: Generate a visual, interactive HTML plan for a task in one pass. No sequential question loop — the AI reads context, builds a diagram-led plan with encouraged but optional animations, and presents decisions as multiple-choice cards with pre-selected defaults. The user reviews it in a browser, overrides decisions in chat, and the agent writes the approved plan wherever the project tracks work. Use when the user wants a reviewable plan for a change before any code is written. --- # Visual Plan — Interactive, Reviewable HTML Plans Generate a visual, interactive HTML plan in one pass. The user reviews it in a browser, overrides decisions in chat, and the agent records the approved plan wherever the project keeps its plans. No sequential question loop. ## Invocation ```text /visual-plan [workspace=] [instructions=] [out=] [notes] ``` Examples: - `/visual-plan "Pre-warm the connection pool at deploy time"` — plan a free-form task. - `/visual-plan PROJ-1234` — plan against an existing tracker ticket, if the project uses one. - `/visual-plan "Add CSV export to the reports page" instructions=./custom-instructions.md out=./plans` If the workspace is ambiguous, ask which repo or worktree before any tool call. ## Core Contract - **AI owns the plan.** Do not ask the user what they want to discuss. Build the full plan yourself from the task, the repo, and any supplied context. Present it; let the user correct it. - **One-pass generation.** No question loop. Generate the entire plan — visual explanation, implementation steps, verification, and decisions — in a single pass, then present it as one interactive HTML file. - **Decisions as multiple-choice cards, not a question loop.** Every decision the user needs to make is a radio-button card with the AI's recommendation pre-selected. The user only intervenes on disagreements. - **Ask, don't guess, on intent.** Where the task under-specifies *what the result should do*, do not silently fill the gap with the rich, defensive reading. Surface each material gap as an intent card asking the behavioral question, with the reading that needs the least machinery pre-selected. Only ask when different answers change what gets built; otherwise take the simple reading and record it as a one-line assumption the user can veto. - **Simplified Technical English is mandatory.** Every question, option, diagram label, and explanation MUST follow the [`asd-ste100`](../asd-ste100/SKILL.md) skill, strictly. The language rules below say what to say. - **Animation encouraged, never compulsory.** Start by considering an animated scenario, scene player, or moving data flow, because progressive storytelling often makes a change easier to understand. Use animation when it adds explanatory value; never force motion that is decorative, fragile, or contrary to the user's request. - **Intelligent pruning.** Skip decisions the codebase, the task, or repo docs already answer. For low-risk work, infer safe defaults, pre-select them, and only surface decisions that materially change scope, risk, verification, or rollout. - **Team process lives in custom instructions, not in this skill.** What a finished plan must contain, which style rules apply, where the file goes, whether it is published, whether a challenger runs, and how the plan is recorded all depend on the team's workflow. That contract lives in an optional **custom-instructions file** (see below), never hardcoded here. With no custom instructions, use the generic defaults. - **Record only after approval.** Once approved, write the compact plan where the project tracks work (see *Recording the plan*) and exit. - **No code, no branches, no deploys.** This skill plans. It never edits the repo (except the plan artifacts), opens PRs, or runs anything downstream. ## When NOT To Use This Skill - Trivial changes (single-file fixes, doc-only edits, dependency bumps, typo fixes) — they do not need a plan. - The user wants you to think out loud about a design without producing a recorded plan — answer in chat; do not invoke this skill. ## Custom instructions — how completeness is defined A **custom-instructions file** is a short markdown file that holds everything a team wants this skill to do differently. This is the seam that keeps team- or pipeline-specific requirements *out* of the skill: a team edits its own file, never this skill. - If the user passes `instructions=`, read that file. Otherwise, if a file named `custom-instructions.md` exists at the workspace root, read it. Otherwise use the generic defaults. - Every heading is optional. A missing heading means the generic default for that heading. A heading the table below does not list is ignored. - Custom instructions never change **how** the visual explanation and decision cards are built. They add settings, not skill steps. A file that restates steps of this skill is a defect in that file. | Heading | What it holds | Generic default | | --- | --- | --- | | `## Style` | Paths of writing-rule files to read before any human-readable text is written. They apply on top of the `asd-ste100` skill, which is always mandatory. | None. | | `## Output` | `Path:` a file path pattern for the HTML, with `` and `` placeholders. `Publish:` a command or skill to run after the render check passes, with `` as the placeholder. `Report:` what to tell the user after publish, for example the URL the publish step prints. | `/_.html`; no publish. | | `## Required sections` | Extra sections a finished plan must contain, each with the fields it needs (a test plan, a rollout plan, a security review). | The generic default list below. | | `## Required decisions` | Extra decisions that must appear as decision cards. | None fixed; only the decisions the change raises. | | `## Challenge` | `Run: yes` turns on the automatic adversarial review in step 5b. `Rounds:` the revision cap. `Challenger:` the path of a file with the exact commands that invoke a different model. `Stalemate:` how an unresolved disagreement is shown (default: a decision card with the simpler option pre-selected). | Off; the user runs `/challenge-plan` by hand. | | `## Record the approved plan in` | The destination, the exact read and write commands for the tracker, the state to move the ticket to on approval, and the path of any ticket conventions file. | Ask the user, or a markdown file next to the HTML. | An explicit `out=` argument wins over `Output: Path`. An explicit user instruction in chat wins over any heading. ### Generic default (used when no custom instructions are supplied) A finished plan must contain: 1. **Goal** — one or two sentences: what changes and why, plus explicit non-goals. 2. **The change, shown visually** — the visual explanation section (the centerpiece). 3. **Implementation outline** — the ordered steps, with file/module names. 4. **How we'll know it worked** — the concrete way to verify the change does what the goal says: the check to run, the observable result, and what "failed" looks like. Depth scales with risk; a one-line manual check is a valid answer for a small change. 5. **Decisions** — every choice the change actually raises, as decision cards. There is no fixed list; surface what this change needs (a data-shape change, a flag, an ordering, a rollout choice) and prune what it doesn't. > A team with a heavier process (staged environments, mandatory monitoring windows, sign-offs) encodes that as a custom-instructions file instead of asking this skill to assume it. An example lives in the repo README. ## Inputs - A task description **or** a tracker ticket reference. - Optional: workspace path. If omitted and the current directory is unambiguous, use it; otherwise ask. - Optional: a custom-instructions path. - Optional: an output directory for the artifact (default `./plans/`). - Optional: notes from the user (focus areas, constraints, deadlines). ## Walkthrough ### 1. Resolve the planning target **Ticket reference supplied:** open it with whatever the project uses (a CLI, an API, the tracker UI via the user). Read its title, description, comments, and links. Before any write to the ticket, save a scratch snapshot of the original text (session scratchpad or a gitignored dir; never commit it) so same-session edits stay attributable and you never rename current text "original." **Free-form task supplied:** capture the description as a working title; refine it during generation. If the project records plans in a tracker, create the ticket only *after* approval (step 6), not now. ### 2. Gather context Read what you need to plan, no more: - The task/ticket, plus any linked threads, PRs, dashboards, incidents, attachments. - Repo entry points: `AGENTS.md`, `CLAUDE.md`, `README.md`, `docs/`, files named in the task. - Cross-repo context when the task spans packages or services. - **Read the actual code the plan will change.** Grep for symbols, open the handler files, read the data models. The visual explanation must be grounded in real code, not inferred from the task text. Read-only probes only. **No edits except the plan artifacts.** **Pin the baseline before making code claims.** Record the branch and exact commit the plan targets, the workspace path, and whether it is clean. If the workspace differs from the target, read the target with ref-aware commands (`git show :`, `git grep `) rather than trusting a stale checkout. ### 3. Generate the HTML plan Generate the full plan as a single self-contained HTML file. This replaces the question loop — behavior, architecture, verification, and decisions are all resolved in one pass and rendered visually. Before you write any human-readable text, read every file listed under `## Style` in the custom instructions, and follow it together with the `asd-ste100` skill. **Resolve, in one pass:** - **What the result does from the outside** — who is affected, the happy path step by step, what state the user/caller observes, the failure modes they see, and the goals and explicit non-goals. - **How it is built** — affected repos/modules, data ownership and typed boundaries, any new or changed contracts (API, schema, event, config), cross-repo ordering, and the ordered implementation steps. - **How it is verified** — whatever the active custom instructions require. For the generic default, that is the "How we'll know it worked" section. **Keep architecture honest (lightweight provenance).** Every built thing should trace to something the result must do; every behavior should trace to the task text, a verified code fact, or a stated assumption. A built thing with no behavior behind it is invented — cut it or turn it into an intent card. A behavior with no source is an intent gap — surface it as an intent card. You do not need heavy audit tables for this; you need the discipline. (If you later run the optional `challenge-plan` skill, it asks for a fuller inventory — build that then, not now.) **Draft the compact plan now, not at the end.** As you generate, write the short markdown plan you will record on approval (step 6). Carry two extra sections in it: - `Assumptions` — each intent gap you filled with the simple reading, one line each. - `Deliberately not built` — each thing you chose not to build now: what it is, where the seam is (the place a future change plugs in without rework), and what signal would make you build it. **Intelligent pruning.** For each decision, try to draft a confident answer from repo/task/docs. If you can, pre-select it as the recommended option. Leave a decision open only when there is no defensible default. #### HTML structure One self-contained file (no CDN, no external deps), built with the patterns from the `visual-explainer` skill. Sections in order: **1. Header.** Task/ticket id, title, one-line goal, a risk pill, and the step count. Nothing else. **2. Visual explanation — the centerpiece.** Reuse relevant `visual-explainer` patterns. Prefer an animated scenario, scene player, or moving pipeline when the plan has a meaningful sequence, state change, or request flow. Animation is encouraged but optional: omit it when motion adds nothing, would make the artifact fragile, or the user asked for a static presentation. Selection rules: - **Animated scenario / scene player** — ordered workflows, user journeys, branching outcomes, event pipelines, lifecycle/state transitions, before/after behavior. - **Static architecture / data-model / comparison diagram** — when the subject is structural with no temporal progression, or to support an animated explanation. - **Static flowchart** — primarily as a complete-path overview slide inside an animated deck, or when the user explicitly asks for one. Do not pick a standalone flowchart merely because it is easier to build than animation. Whenever a flowchart appears, render the entire chart in normal document flow. The page may be as long as needed: the visual section, slide, and flowchart container use content-driven height (`height: auto`, `max-height: none`, `overflow: visible`) with no fixed, viewport-relative, or capped height. Let the document grow to contain every node and label; never shrink, scale, clip, scroll-within, or overlap the chart to keep it short. Prefer CSS grid/flex for text-heavy nodes and stack branches responsively on narrow viewports. Decorative connectors may use pseudo-elements or absolute positioning only when they cannot cover content or affect the container's measured height. What to visualize, by change type: | Change type | What to visualize | | --- | --- | | **Bug / perf fix** | What's broken, root cause, how the fix works. Prefer an animated failure-to-fix sequence; add a static before/after when useful. | | **Enhancement** | Current system (architecture diagram), what changes (highlighted on the diagram), data flow before/after. | | **Greenfield feature** | Product concept (user-flow diagram or UI wireframe), proposed architecture, data-model visualization. | | **Refactor** | Current structure, target structure, migration path. Morph toggle between before/after. | | **Integration** | System-boundary diagram plus an animated happy-path data flow; a static full-path flowchart may serve as an overview slide. | When a change of any type also alters the database schema, add the schema-change diagram in section 2a. When a change of any type also alters an API contract, add the API-change view in section 2b. **Less text, more visual.** If you can draw it, don't write it. Annotations on diagrams replace paragraphs. The behavior and architecture content lives primarily here, not in prose blocks. **2a. Schema-change diagram — only when the change creates, alters, or drops a database table or field.** Embed a scoped schema diagram. Build it with the [`visual-schema`](../visual-schema/SKILL.md) skill in **change mode**. Show only the changed tables, plus one hop of related tables as dimmed context. Never redraw the whole database. Mark each table `new`, `changed`, or `removed`. Mark the added, changed, and removed fields. This picture replaces a prose list of schema edits. Skip this section when the change touches no table or field. **2b. API-change view — only when the change adds, alters, or removes an API endpoint, parameter, request body, response, or response schema.** Embed a scoped API-change view. Build it with the [`visual-api`](../visual-api/SKILL.md) skill in **change mode**. Show only the changed endpoints and schemas, never the whole API. Mark each endpoint `new`, `changed`, or `removed`. Mark the added, changed, and removed parameters, responses, and fields. This view replaces a prose list of API edits. Skip this section when the change touches no API contract. **3. Implementation pipeline.** A compact visual of the ordered steps. For cross-repo work, show the dependency chain with an arrow between step cards. Each step card lists the module/repo name and bullet-point scope. **4. Verification (compact, expandable).** Render the verification the active custom instructions require as compact `
` cards — a `
` of the required fields, brief. For the generic default, that is one "How we'll know it worked" card. If they require more (a dev plan, a prod plan, a security section), render one compact card each. Keep them 3–5 lines each; expand into full prose only when recording the plan (step 6). **5. Multiple-choice decision cards.** Each decision card has: - A question title. - **A change-specific explanation paragraph (mandatory).** 3–5 sentences grounding the question in *this* change. Name the actual functions, files, endpoints, and tradeoffs — never describe the concept generically. Bad: "Feature flags let you disable a change instantly." Good: "The fix replaces per-row `to_dict()` calls with one bulk query inside `prepare_results()`. A flag would let us switch between the old and new path at runtime." - **Plain-language wording (mandatory).** The question asks about the practical choice, not the implementation concept; each option says what happens if selected. - 2–4 options with one-line descriptions; the recommended one pre-selected and badged. - **A mandatory "Other" escape hatch — last in every card.** One more radio labeled "Other" whose free-text input is *contained inside the Other option itself* (not a separate field below). It reads as one choice: "none of these — here's what to do instead." Focusing or typing in the field auto-selects the Other radio; clicking anywhere on the Other card selects it too. "Copy decisions" must capture the typed text (emit `Other — `, or `Other — (unspecified)` if chosen but blank). Selecting "Other" always counts as changed-from-default. Author it inline per card, or inject it into every `.opts` group with a small load-time helper (`createElement`/`textContent`, never `innerHTML`). **Intent-gap cards come first.** Render every material intent gap as its own card, before the implementation decisions. Ask the behavioral question — "while the workflow is temporarily broken, should new requests queue and run on recovery, or be rejected?" — never the mechanism question ("should we add an admission gate?"). Pre-select the reading that needs the least machinery and draw the v1 for that reading. The human corrects upward cheaply; a silent rich-reading guess becomes machinery nobody reviewed. **Required decisions** = whatever the active custom instructions list, plus any change-specific decisions you identify (flag, response-shape change, cross-repo ordering, rollout strategy). The generic default requires no fixed decision list — surface what the change raises. **Selection-capture controls — required at BOTH the top and bottom of the decisions section.** Render an **"Accept all defaults"** button and a **"Copy decisions"** button in two places: above the first card and after the last card. The plan is a static file with no server; a selection only leaves the browser when the user copies it. "Copy decisions" serializes the current radio state (flagging anything changed from its default) to the clipboard so the user can paste it back into chat — or they can just say "looks good" / "change Q3 to …". Wire both copies of the buttons to the same handlers (bind by class, not `id`) and flash a confirmation on every `.copy-note`. Add an inline hint by the bottom controls reminding the user they can paste the summary back or reply in chat. **The "Copy decisions" handler must not depend on the async Clipboard API alone.** `navigator.clipboard.writeText` is blocked in a non-secure or sandboxed context — exactly the case when the plan is viewed inside a preview-panel iframe. Relying on it alone makes the button silently fail. Implement a fallback chain: (1) try `navigator.clipboard.writeText`; (2) on rejection or absence, use a temporary off-screen `