Write Design
Produce a diagram-centric high-level design document that makes an architecture
legible before problem framing, planning, or implementation exists. Diagrams use Mermaid (the repo
standard); prose explains rationale, component responsibilities, and alternatives.
Quick start
- Inspect the repository, then confirm the design scope and requested depth.
- Route the current inventory through
question routing, which selects
between one
grill-me pass and a controlled HLD questionnaire pause.
- Recalculate after every response until the current inventory is empty;
there is no fixed pass limit.
- Pick the diagram set using the selection guide below.
- Draft the HLD in memory from
templates/hld.md, filling each section and
embedding diagrams.
- Run the complete pre-save self-check, route any newly exposed questions
again, record whatever remains deferred under
## Open questions, and save
under ./design/.
Codebase-first rule
If a question can be answered by exploring the repo, explore first instead of asking.
- Check relevant code, modules, schemas, config, and existing diagrams.
- State findings with
file:line evidence.
- Ask only the remaining uncertainty.
Prefer "I checked X and recommend Y" over asking for facts already in the codebase.
Inventory material architecture decisions across boundaries, components,
dependencies, interfaces, flows, data/state lifecycle, failure recovery,
security, performance, operability, alternatives, and compatibility. Count
only currently answerable decisions after repository facts are removed;
dependent answers may expose another iteration.
Route that inventory through
question routing. Its one-to-three route
asks the complete inventory in one grill-me pass and
then recalculates. Its four-or-more route dispatches
rocprof-compute-decision-questionnaire-writer in hld-initial or, for a later
newly exposed inventory, hld-follow-up; report the exact saved path and pause.
Resume only from that completed exact path and validate its ordered lineage
under the shared orchestration contract. An incomplete or malformed
questionnaire receives a correction request for the same path and continues to
block the HLD; it does not authorize a draft or repair version.
Authoring rules
The template mirrors the rocprofiler-compute HLD template in docs/design/, so a
saved HLD body drops into that directory unchanged. Its authoring rules apply here:
- Articulate why — why this is a problem, why a decision was made — not just what.
- Be short and specific. No word-fluff that inflates length, no invented terminology
where simple wording works.
- Table and diagram before paragraph. Anything enumerable is a table: comparing two
approaches, mapping a condition to its required behavior, listing which options
interoperate, requirements, validation checks. Anything structural or sequential is a
diagram. Prose earns its place by carrying a why that neither can. This does not
thin System Context or Problem statement — they stay the heaviest sections, and a
table-dense one still argues.
- Requirements carry stable IDs.
FR-n for functional, NFR-n for non-functional,
grouped by topic once the list outgrows a single table. Implementation phases and
validation checks cite those IDs instead of restating the requirement.
- Keep decisions localized and structured. Do not spread one decision across the
document. Each
### subsection under Design settles one decision and is named after
it.
- Strengthen arguments with concrete data: estimations, measurements, worked examples.
- Avoid detail that goes stale fast. Code locations, variable names, and class names
do not belong in the HLD body. This does not weaken the codebase-first rule:
file:line evidence is for the conversation while resolving decisions, not for the
saved document.
- Use bullets, tables, and indentation to accent points, not as visual noise.
- System Context and Problem statement carry the most weight. Design quality tracks
how well the current system and the problem are articulated; write them first.
Upstream cautions against producing an HLD with AI tools. The substance behind that
caution is preserved by the decision router: resolve material architecture decisions
with the user or with repository evidence, and never invent an answer to fill a section.
Diagram selection guide
Pick the minimal set that explains the design. Most HLDs need a component graph plus
one or two flow diagrams. A diagram goes wherever it carries the explanation, not in one
reserved section: the mechanics of the current system or an external contract the design
depends on belong in System Context, a cost or alternative comparison in Problem
statement, proposed structure and decision logic in Design.
| Intent |
Diagram |
Mermaid type |
Usually goes in |
| System structure, components, boundaries, dependencies |
Component / architecture |
graph TD / graph LR |
## Design, or ## System Context for today's structure |
| Process, branching logic, decision points |
Flowchart |
flowchart TD |
## Design, or ## Problem statement to contrast two approaches |
| Interaction between actors/services over time |
Sequence |
sequenceDiagram |
## Design, or ## System Context for an external mechanism |
| Entities and relationships |
Data model |
erDiagram |
The ## Design subsection that owns the persisted state |
| Types, methods, structural relationships |
Class |
classDiagram |
The ## Design subsection that owns the structure |
| Lifecycle, modes, state transitions |
State |
stateDiagram-v2 |
The ## Design subsection that owns the lifecycle |
See REFERENCE.md for a minimal valid block per type.
HLD document template
Copy templates/hld.md and fill it. The seven ## sections, their names, order,
and casing match the rocprofiler-compute template exactly; do not add, rename, or
reorder them. That contract covers ## only — every ### subsection is yours to
name and order.
- System Context — what the in-scope part of the system does today, what it does
not cover, its main and surrounding components, plus assumptions and constraints.
- Problem statement — what problems this design solves, why they matter, impact.
- Requirements —
### Functional requirements and ### Non-functional requirements
as ID-keyed tables, plus explicit non-goals.
- Design — free-form, as upstream leaves it. Name each subsection after the decision
it settles. Two obligations: at least one diagram of the proposed structure or its
decision logic, and every architectural decision stated with its rejected alternative
and why, inside the subsection that owns it. Data-model or state content appears only
when something is persisted or stateful; there is no placeholder heading when nothing is.
- Implementation phases — vertical slices, each delivering incremental user value,
citing the requirement IDs it satisfies.
- Validation, security and debuggability —
### Validation as numbered checks with
their pass criteria and the test types realizing them, then ### Security and
### Debuggability. Retained risks and their mitigations go here.
- Open questions — known unknowns, deferred decisions, trade-offs, or
none.
See REFERENCE.md for expand/collapse rules and EXAMPLES.md
for worked HLDs.
Hand-off rule
The HLD may precede and complement a formulation and feature plan. For planning-only
feature work, recommend that the user start plan-feature with it; for full delivery,
recommend build-feature. Never invoke either — they are human front doors.
Those coordinators own questionnaire creation, exact-path human pauses, formulation,
planner questions, approval, and publication. Architecture and diagrams are settled here;
link the decision-questionnaire lineage and related artifacts without duplicating them.
Executable task sequencing belongs to the
selected feature coordinator or the integrated refactor workflow.
Routing
- Diagram-centric HLD, architecture rationale, or system/flow visualization →
stay in
write-design.
- Unit-level design below the architecture — exact signatures, error contracts, or a
per-unit test plan →
write-lld, which links this HLD and
inherits its FR-n / NFR-n IDs.
- Raw problem framing, HLD-backed feature intake, executable planning, or task
sequencing →
plan-feature for planning only, build-feature for full delivery, and
implement-feature for one exact approved feature plan. Do not dispatch
feature-planning components from write-design. A direct one-off questionnaire or
formulation request may still use the standalone controlled component flow.
- Behavior-preserving planning and refactor phases →
refactor.
- An architecture decision already made and needing contest rather than a diagram has
no Cursor route. Contesting a decision requires blind read-only attackers, and Cursor
has no enforced read-only agent profile to dispatch them under. Raise it with the
human instead of reasoning about it inline, since a coordinator cannot blind itself
to its own rationale.
- Implementation code. Stop after the HLD. A bare implementation request without an
approved plan or released
plan_ready state stops and offers plan-feature or
build-feature. For an explicitly authorized single-edit atomic non-Jira request, the
main coordinator may discover exact paths read-only, create a boundary manifest, and
dispatch rocprof-compute-blind-source-writer in atomic mode.
- Sphinx RST documentation pages. The main coordinator first resolves exact targets and
edit/create mode, then dispatches rocprof-compute-docs-writer with a one-time
boundary manifest.
Pre-save self-check and question loop
- Every embedded Mermaid block parses (see REFERENCE validation note).
- Each diagram is referenced by the surrounding prose, not dropped in unexplained.
- System Context, Problem statement, Requirements, Design, and Validation,
security and debuggability are present and non-empty.
- The seven
## headings match the template's names, order, and casing. ###
subsections are unconstrained.
- Every architectural decision under Design names its rejected alternative and why.
- Requirements carry
FR-n / NFR-n IDs, and the phases and validation checks cite
them rather than restating the requirement.
- Rebuild the current material-question inventory from the in-memory draft,
route it through question routing,
then rerun the complete self-check. Repeat after every revision; there is no
fixed pass limit.
Run the router to exhaustion before saving. A decision that survives it — because it
depends on information nobody has yet, or was consciously deferred — goes under
## Open questions with why it is deferred and what would resolve it. An unanswerable
question no longer blocks the save, but an unrouted one does: never move a question
there to skip a grill-me pass or a questionnaire. Retained risks with mitigations are
not open questions; they belong under Validation, security and debuggability.
On questionnaire resume, accept only the completed exact saved path named by the pause.
If validation fails, request a precise correction to that same path, remain paused, and
create neither the HLD nor a replacement questionnaire merely to repair it.
File output rules
- Ensure
./design/ exists at the repo root; create it if missing.
- Save as
./design/<feature-name>.md using kebab-case.
- If the target filename already exists, auto-suffix
-v2, -v3, ... rather than overwriting.
- Echo the saved path in the final response.
Additional resources
- REFERENCE.md — Mermaid cheat-sheet per diagram type, validation, collapse rules.
- EXAMPLES.md — worked HLDs.
- templates/hld.md — the HLD skeleton.
- decision-questionnaire orchestration
— hybrid routing, controlled questionnaire lineage, and exact-path resume.
- writing style — normative prose rules and the pre-save self-check for
every human-read artifact this skill produces.
- design principles — the structure an HLD proposes.
Read as an author: components, their dependencies, and the interfaces between them
satisfy these before the diagram is drawn.
1---2name: write-design3description: Produces a diagram-centric high-level design under `./design/`, built on Mermaid component, flow, sequence, data-model, class, or state diagrams plus architecture rationale. Use for HLDs, architecture and system diagrams, flowcharts, or design visualization.4---56# Write Design78Produce a diagram-centric high-level design document that makes an architecture9legible before problem framing, planning, or implementation exists. Diagrams use Mermaid (the repo10standard); prose explains rationale, component responsibilities, and alternatives.1112## Quick start13141. Inspect the repository, then confirm the design scope and requested depth.152. Route the current inventory through16 [question routing](../_shared/QUESTION-ROUTING.md), which selects17 between one `grill-me` pass and a controlled HLD questionnaire pause.183. Recalculate after every response until the current inventory is empty;19 there is no fixed pass limit.204. Pick the diagram set using the selection guide below.215. Draft the HLD in memory from `templates/hld.md`, filling each section and22 embedding diagrams.236. Run the complete pre-save self-check, route any newly exposed questions24 again, record whatever remains deferred under `## Open questions`, and save25 under `./design/`.2627## Codebase-first rule2829If a question can be answered by exploring the repo, explore first instead of asking.30311. Check relevant code, modules, schemas, config, and existing diagrams.322. State findings with `file:line` evidence.333. Ask only the remaining uncertainty.3435Prefer "I checked X and recommend Y" over asking for facts already in the codebase.3637Inventory material architecture decisions across boundaries, components,38dependencies, interfaces, flows, data/state lifecycle, failure recovery,39security, performance, operability, alternatives, and compatibility. Count40only currently answerable decisions after repository facts are removed;41dependent answers may expose another iteration.4243Route that inventory through44[question routing](../_shared/QUESTION-ROUTING.md). Its one-to-three route45asks the complete inventory in one [`grill-me`](../grill-me/SKILL.md) pass and46then recalculates. Its four-or-more route dispatches47`rocprof-compute-decision-questionnaire-writer` in `hld-initial` or, for a later48newly exposed inventory, `hld-follow-up`; report the exact saved path and pause.49Resume only from that completed exact path and validate its ordered lineage50under the shared orchestration contract. An incomplete or malformed51questionnaire receives a correction request for the same path and continues to52block the HLD; it does not authorize a draft or repair version.5354## Authoring rules5556The template mirrors the rocprofiler-compute HLD template in `docs/design/`, so a57saved HLD body drops into that directory unchanged. Its authoring rules apply here:5859- Articulate **why** — why this is a problem, why a decision was made — not just what.60- Be short and specific. No word-fluff that inflates length, no invented terminology61 where simple wording works.62- **Table and diagram before paragraph.** Anything enumerable is a table: comparing two63 approaches, mapping a condition to its required behavior, listing which options64 interoperate, requirements, validation checks. Anything structural or sequential is a65 diagram. Prose earns its place by carrying a **why** that neither can. This does not66 thin System Context or Problem statement — they stay the heaviest sections, and a67 table-dense one still argues.68- **Requirements carry stable IDs.** `FR-n` for functional, `NFR-n` for non-functional,69 grouped by topic once the list outgrows a single table. Implementation phases and70 validation checks cite those IDs instead of restating the requirement.71- Keep decisions localized and structured. Do not spread one decision across the72 document. Each `###` subsection under Design settles one decision and is named after73 it.74- Strengthen arguments with concrete data: estimations, measurements, worked examples.75- Avoid detail that goes stale fast. Code locations, variable names, and class names76 do not belong in the HLD body. This does not weaken the codebase-first rule:77 `file:line` evidence is for the conversation while resolving decisions, not for the78 saved document.79- Use bullets, tables, and indentation to accent points, not as visual noise.80- **System Context and Problem statement carry the most weight.** Design quality tracks81 how well the current system and the problem are articulated; write them first.8283Upstream cautions against producing an HLD with AI tools. The substance behind that84caution is preserved by the decision router: resolve material architecture decisions85with the user or with repository evidence, and never invent an answer to fill a section.8687## Diagram selection guide8889Pick the minimal set that explains the design. Most HLDs need a component graph plus90one or two flow diagrams. A diagram goes wherever it carries the explanation, not in one91reserved section: the mechanics of the current system or an external contract the design92depends on belong in System Context, a cost or alternative comparison in Problem93statement, proposed structure and decision logic in Design.9495| Intent | Diagram | Mermaid type | Usually goes in |96|---|---|---|---|97| System structure, components, boundaries, dependencies | Component / architecture | `graph TD` / `graph LR` | `## Design`, or `## System Context` for today's structure |98| Process, branching logic, decision points | Flowchart | `flowchart TD` | `## Design`, or `## Problem statement` to contrast two approaches |99| Interaction between actors/services over time | Sequence | `sequenceDiagram` | `## Design`, or `## System Context` for an external mechanism |100| Entities and relationships | Data model | `erDiagram` | The `## Design` subsection that owns the persisted state |101| Types, methods, structural relationships | Class | `classDiagram` | The `## Design` subsection that owns the structure |102| Lifecycle, modes, state transitions | State | `stateDiagram-v2` | The `## Design` subsection that owns the lifecycle |103104See [REFERENCE.md](REFERENCE.md) for a minimal valid block per type.105106## HLD document template107108Copy `templates/hld.md` and fill it. The seven `##` sections, their names, order,109and casing match the rocprofiler-compute template exactly; do not add, rename, or110reorder them. That contract covers `##` only — every `###` subsection is yours to111name and order.1121131. **System Context** — what the in-scope part of the system does today, what it does114 not cover, its main and surrounding components, plus assumptions and constraints.1152. **Problem statement** — what problems this design solves, why they matter, impact.1163. **Requirements** — `### Functional requirements` and `### Non-functional requirements`117 as ID-keyed tables, plus explicit non-goals.1184. **Design** — free-form, as upstream leaves it. Name each subsection after the decision119 it settles. Two obligations: at least one diagram of the proposed structure or its120 decision logic, and every architectural decision stated with its rejected alternative121 and why, inside the subsection that owns it. Data-model or state content appears only122 when something is persisted or stateful; there is no placeholder heading when nothing is.1235. **Implementation phases** — vertical slices, each delivering incremental user value,124 citing the requirement IDs it satisfies.1256. **Validation, security and debuggability** — `### Validation` as numbered checks with126 their pass criteria and the test types realizing them, then `### Security` and127 `### Debuggability`. Retained risks and their mitigations go here.1287. **Open questions** — known unknowns, deferred decisions, trade-offs, or `none`.129130See [REFERENCE.md](REFERENCE.md) for expand/collapse rules and [EXAMPLES.md](EXAMPLES.md)131for worked HLDs.132133## Hand-off rule134135The HLD may precede and complement a formulation and feature plan. For planning-only136feature work, recommend that the user start `plan-feature` with it; for full delivery,137recommend `build-feature`. Never invoke either — they are human front doors.138Those coordinators own questionnaire creation, exact-path human pauses, formulation,139planner questions, approval, and publication. Architecture and diagrams are settled here;140link the decision-questionnaire lineage and related artifacts without duplicating them.141Executable task sequencing belongs to the142selected feature coordinator or the integrated `refactor` workflow.143144## Routing145146- Diagram-centric HLD, architecture rationale, or system/flow visualization →147 stay in `write-design`.148- Unit-level design below the architecture — exact signatures, error contracts, or a149 per-unit test plan → [`write-lld`](../write-lld/SKILL.md), which links this HLD and150 inherits its `FR-n` / `NFR-n` IDs.151- Raw problem framing, HLD-backed feature intake, executable planning, or task152 sequencing → `plan-feature` for planning only, `build-feature` for full delivery, and153 `implement-feature` for one exact approved feature plan. Do not dispatch154 feature-planning components from `write-design`. A direct one-off questionnaire or155 formulation request may still use the standalone controlled component flow.156- Behavior-preserving planning and refactor phases → [`refactor`](../refactor/SKILL.md).157- An architecture decision already made and needing contest rather than a diagram has158 no Cursor route. Contesting a decision requires blind read-only attackers, and Cursor159 has no enforced read-only agent profile to dispatch them under. Raise it with the160 human instead of reasoning about it inline, since a coordinator cannot blind itself161 to its own rationale.162- Implementation code. Stop after the HLD. A bare implementation request without an163 approved plan or released `plan_ready` state stops and offers `plan-feature` or164 `build-feature`. For an explicitly authorized single-edit atomic non-Jira request, the165 main coordinator may discover exact paths read-only, create a boundary manifest, and166 dispatch `rocprof-compute-blind-source-writer` in `atomic` mode.167- Sphinx RST documentation pages. The main coordinator first resolves exact targets and168 `edit`/`create` mode, then dispatches `rocprof-compute-docs-writer` with a one-time169 boundary manifest.170171## Pre-save self-check and question loop1721731. Every embedded Mermaid block parses (see REFERENCE validation note).1742. Each diagram is referenced by the surrounding prose, not dropped in unexplained.1753. System Context, Problem statement, Requirements, Design, and Validation,176 security and debuggability are present and non-empty.1774. The seven `##` headings match the template's names, order, and casing. `###`178 subsections are unconstrained.1795. Every architectural decision under Design names its rejected alternative and why.1806. Requirements carry `FR-n` / `NFR-n` IDs, and the phases and validation checks cite181 them rather than restating the requirement.1827. Rebuild the current material-question inventory from the in-memory draft,183 route it through [question routing](../_shared/QUESTION-ROUTING.md),184 then rerun the complete self-check. Repeat after every revision; there is no185 fixed pass limit.186187Run the router to exhaustion before saving. A decision that survives it — because it188depends on information nobody has yet, or was consciously deferred — goes under189`## Open questions` with why it is deferred and what would resolve it. An unanswerable190question no longer blocks the save, but an unrouted one does: never move a question191there to skip a `grill-me` pass or a questionnaire. Retained risks with mitigations are192not open questions; they belong under Validation, security and debuggability.193194On questionnaire resume, accept only the completed exact saved path named by the pause.195If validation fails, request a precise correction to that same path, remain paused, and196create neither the HLD nor a replacement questionnaire merely to repair it.197198## File output rules1992001. Ensure `./design/` exists at the repo root; create it if missing.2012. Save as `./design/<feature-name>.md` using kebab-case.2023. If the target filename already exists, auto-suffix `-v2`, `-v3`, ... rather than overwriting.2034. Echo the saved path in the final response.204205## Additional resources206207- [REFERENCE.md](REFERENCE.md) — Mermaid cheat-sheet per diagram type, validation, collapse rules.208- [EXAMPLES.md](EXAMPLES.md) — worked HLDs.209- [templates/hld.md](templates/hld.md) — the HLD skeleton.210- [decision-questionnaire orchestration](../_shared/DECISION-QUESTIONNAIRE-ORCHESTRATION.md)211 — hybrid routing, controlled questionnaire lineage, and exact-path resume.212- [writing style](../_shared/WRITING-STYLE.md) — normative prose rules and the pre-save self-check for213 every human-read artifact this skill produces.214- [design principles](../_shared/DESIGN-PRINCIPLES.md) — the structure an HLD proposes.215 Read as an author: components, their dependencies, and the interfaces between them216 satisfy these before the diagram is drawn.