|
| 1 | +# Plan document quality — single source of truth |
| 2 | + |
| 3 | +This file is the canonical quality bar for the plan document below the canvas: |
| 4 | +how it reads, which blocks to use, how open questions are surfaced, and the |
| 5 | +pre-handoff check. Read it in full before authoring the plan document; it is the |
| 6 | +quality bar. Do not write the document from memory or paraphrase these rules per |
| 7 | +mode. |
| 8 | + |
| 9 | +<!-- SHARED-CORE:document-quality START --> |
| 10 | + |
| 11 | +**The document is a serious technical plan, not marketing.** Write it the way a |
| 12 | +strong Claude or Codex implementation plan reads: outcome-first, prose-first, |
| 13 | +self-contained, and specific. State the objective and what "done" means, the |
| 14 | +scope and non-goals, the proposed approach with the key decisions and their |
| 15 | +rationale, ordered steps that name real files, symbols, actions, and data |
| 16 | +shapes, the risks, and a closing verification step (tests, build, or a checkable |
| 17 | +behavior). Replace vague prose with specifics; never ship a step like "make it |
| 18 | +work." No hero art, gradients, logos, nav bars, slogans, value props, giant |
| 19 | +landing-page headings, or marketing cards unless the user explicitly asks. |
| 20 | + |
| 21 | +**When top visuals exist, they and the document never duplicate each other.** |
| 22 | +For UI work, the UI story lives in the top visual surface: canvas artboards for |
| 23 | +static inspection, plus prototype tabs when the flow should be functional. The |
| 24 | +document carries the technical depth the visuals cannot show — concrete |
| 25 | +file/symbol maps, API and data contracts, code snippets, migration or |
| 26 | +implementation phases, risks, and validation. For architecture/code reviews, |
| 27 | +invert that: the document is the visual surface, and each recommendation should |
| 28 | +carry its own nearby inline `diagram` / `data-model` block plus file evidence |
| 29 | +and terse Problem/Solution/Why text. For architecture/code diagrams, prefer |
| 30 | +standard two-dimensional layouts: paired before/after panels, layered diagrams, |
| 31 | +swimlanes, dependency maps, matrices, or grouped regions. Do not default to |
| 32 | +left-to-right chains; use a line only when the relationship is truly a sequence. |
| 33 | +Use native `diagram` blocks with `data.html` / `data.css` for these richer |
| 34 | +layouts; the fragment may use semantic HTML and inline SVG, and the renderer |
| 35 | +applies the viewer's sketch/clean style. Leave room for the sketch font: keep |
| 36 | +labels short, give nodes generous width, and place boundary/annotation labels in |
| 37 | +unused space instead of over nodes. For small text/SVG changes to an existing |
| 38 | +HTML diagram, use `patch-diagram-html` with a unique `find`/`replace` snippet |
| 39 | +instead of resending the whole `data.html` string. Legacy `nodes` / `edges` are |
| 40 | +only for tiny previews or genuinely linear step flows. Repeat a wireframe in the document only |
| 41 | +for a genuinely new detail view or comparison. Skip the visual surface entirely |
| 42 | +for non-visual work and write a clean rich document. For a simple binary UI |
| 43 | +visual choice, show the two directions in the canvas only; do not repeat the |
| 44 | +same options as body wireframes or prose. Put the actual |
| 45 | +choice in the bottom "Open Questions" form. |
| 46 | + |
| 47 | +**Use the right block, and make it carry substance.** For the authoritative, |
| 48 | +machine-checked list of block types and their data schemas, call `get-plan-blocks` |
| 49 | +— it returns the live registry vocabulary (type, MDX tag, placement, key fields) |
| 50 | +so you never emit a block the editor cannot render or round-trip: |
| 51 | + |
| 52 | +- `rich-text` for plan prose with real bold/italic/code/links and nested lists. |
| 53 | +- `annotated-code` for the file map: when a load-bearing file is worth |
| 54 | + highlighting, prefer the annotated walkthrough over a bare `code` block — carry |
| 55 | + the real, syntax-highlighted code AND anchor short margin notes to the lines |
| 56 | + that actually change (the new action, the changed schema, the wiring point), so |
| 57 | + the reader sees what matters and why instead of code for code's sake. Each |
| 58 | + annotation is `{ lines: "12" | "12-18"; label?; note }`; keep a few high-signal |
| 59 | + notes per file, not one per line. Highlight only the files worth reading; never |
| 60 | + an exhaustive list of every touched file, and never a prose-only description of |
| 61 | + a file. Drop to a plain `code` block only for a throwaway snippet with nothing |
| 62 | + to call out. When more than one file matters, group the blocks in a vertical |
| 63 | + `tabs` block (the standard tab primitive) rather than a bespoke container. If |
| 64 | + the exact code is unknown, show the smallest plausible planned shape or a |
| 65 | + commented stub naming what to fill in. (`code-tabs` and `implementation-map` |
| 66 | + are legacy: their renderers stay for old plans, but do not author new ones.) |
| 67 | +- For a decision: if the reviewer must still pick between a genuinely-open |
| 68 | + either/or, put it in the bottom Open Questions `question-form` as a `single` |
| 69 | + question — one option per real alternative, each with a short detail and |
| 70 | + `recommended: true` on the one you would choose; do not also restate the same |
| 71 | + choice elsewhere. If you have already committed to an approach, state it as |
| 72 | + settled prose or a `callout` with `tone="decision"`, optionally with a |
| 73 | + `columns` block for a side-by-side comparison of the options you weighed — not |
| 74 | + as a confusing mid-document form for a question you have already answered. |
| 75 | +- `columns` for side-by-side before/after or current/target comparisons where |
| 76 | + each side needs real nested blocks; label the columns clearly and avoid |
| 77 | + stacking comparison blocks vertically when parallel reading is the point. |
| 78 | +- `diagram` for two-dimensional architecture, dependency, data-flow, or state |
| 79 | + relationships, only when it clarifies something real. For architecture/code |
| 80 | + diagrams, prefer `data.html` / `data.css` with semantic HTML and inline SVG so |
| 81 | + the diagram can use panels, layers, matrices, arrows, annotations, and |
| 82 | + responsive layout directly. Author diagram HTML with renderer-owned primitives |
| 83 | + like `.diagram-panel`, `.diagram-card`, `.diagram-node`, `.diagram-box`, |
| 84 | + `.diagram-pill`, `.diagram-muted`, and `[data-rough]`; they map to the plan's |
| 85 | + Tailwind theme variables through `--wf-ink`, `--wf-muted`, `--wf-line`, |
| 86 | + `--wf-paper`, `--wf-card`, `--wf-accent`, `--wf-accent-soft`, `--wf-warn`, and |
| 87 | + `--wf-ok`, and switch to Excalifont plus rough.js outlines in sketchy mode. Do not |
| 88 | + set `font-family` and do not hard-code hex, rgb, or hsl colors in diagram HTML |
| 89 | + or CSS. Use legacy `nodes` / `edges` only for small previews or truly |
| 90 | + sequential flows. In architecture/code plans, prefer a repeated section rhythm: |
| 91 | + recommendation title, confidence and category badges, code-path evidence, a |
| 92 | + local before/after or current/target spatial diagram, then concise |
| 93 | + Problem/Solution/Why text. Labels must not overlap nodes, connectors, or each |
| 94 | + other. |
| 95 | +- `tabs` for multiple states, directions, or comparisons. A tab that reveals |
| 96 | + only prose usually means the plan is under-specified — include a relevant |
| 97 | + visual unless the tab is intentionally document-only. |
| 98 | +- `table`, `checklist`, `callout` for scannable structure. |
| 99 | + |
| 100 | +**Open questions live at the bottom as a form when answers would change the |
| 101 | +plan.** Surface answerable unresolved decisions in a final `question-form` |
| 102 | +block titled "Open Questions" so the renderer presents it as a distinct section. |
| 103 | +That bottom form is the ONLY place that enumerates the open questions: never add |
| 104 | +a second "Open Questions" heading, list, or recap of the same questions earlier |
| 105 | +in the document. A one-line pointer in the overview prose ("a few decisions are |
| 106 | +still open — see Open Questions below") is fine, but do not reproduce the |
| 107 | +question list or a parallel questions/decisions section above it. |
| 108 | +Use `single` or `multi` for clear choices, `freeform` for constraints, |
| 109 | +`recommended: true` for the default you would pick, and option `wireframe` / |
| 110 | +`diagram` previews only when the options are not already visible in the top |
| 111 | +canvas. `single` and `multi` questions always render a write-in field so a |
| 112 | +reviewer can answer with a custom option — never add an explicit "Other" option |
| 113 | +yourself; set `allowOther: false` only when a free-text answer makes no sense. |
| 114 | +Keep non-answerable assumptions or risks as concise `callout` blocks in |
| 115 | +the relevant section. Never bury a questions/decisions wall inside the plan |
| 116 | +narrative, and never ask the same question twice. |
| 117 | + |
| 118 | +**`custom-html` is a bounded escape hatch only** — a single complete fragment |
| 119 | +inside a block, never `html`/`head`/`body`/`script` tags, never a generic |
| 120 | +placeholder, density demo, or proof that custom HTML works. Prefer the native |
| 121 | +blocks for normal plans. For architecture/code reviews, use `diagram` |
| 122 | +`data.html` / `data.css` for rich local HTML/SVG diagrams instead of |
| 123 | +`custom-html`. For UI/product work, `custom-html` is never the primary home for a |
| 124 | +requested mockup, UI state, or visual comparison. If UI fidelity requires |
| 125 | +HTML/CSS, image capture, or real React/CSS, the product fix is canvas support |
| 126 | +for that artifact type, not moving the mockup into the document. |
| 127 | + |
| 128 | +**Before handoff, open the plan and check it.** Fix overlap, excessive |
| 129 | +whitespace, clipped fragments, misleading inactive controls, poor contrast, and |
| 130 | +unreadable diagrams before asking for approval. |
| 131 | + |
| 132 | +<!-- SHARED-CORE:document-quality END --> |
0 commit comments