markdown-design-doc
Skill2 starsChanged 8 days agoMITView on GitHub
Write, edit, review and export design documents in the Markdown format of Markdown Design Doc Viewer, where a mermaid sequence diagram, flowchart, ER diagram or state diagram marked with %% @link-headings is linked arrow by arrow (node by node) to the step headings after it, and a wireframe of a screen written in HTML is linked part by part to its item table and headings, with type design_doc front matter. Use when writing or editing a design document or specification in Markdown (設計書, 基本設計, 詳細設計, 仕様書, シーケンス図, フローチャート, ER 図, 状態遷移図, 処理概要, 処理フロー, 画面設計書, ワイヤーフレーム) or a table of the items of a message, a file or a screen (電文定義, 項目定義, インターフェース定義, ファイルレイアウト, 画面項目定義), when a Markdown file has type design_doc front matter or %% @link-headings, or when exporting design documents to HTML (HTML エクスポート, HTML 出力) with the markdown-design-doc-viewer or md-design-doc command line.
In this repository15 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- prisma-client-apiSkill
- prisma-cliSkill
- prisma-computeSkill
- prisma-database-setupSkill
- prisma-driver-adapter-implementationSkill
- prisma-mongodb-upgradeSkill
- prisma-orm-setupSkill
- prisma-postgres-setupSkill
- prisma-postgresSkill
- prisma-postgres-upgradeSkill
- prisma-upgrade-v7Skill
- releaseSkill
- screen-checkSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
28 rules. About 0 are common, 8 are distinctive, and 20 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈8
Distinctive · estimate
This author's own choices. Worth a look.
20
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 81
Write the flow as one `mermaid block that starts with sequenceDiagram.
- Very specific: line 82
Put %% @link-headings on a line of its own inside the block.
- Distinctive: line 83
Put the diagram at the top level of the document, not inside a list or blockquote.
- Very specific: line 84
Keep each arrow label (the text after :) short and unique within the diagram.
- Very specific: line 92
Prefer such a note to labeling the branch itself, with %% @anchor <label> on the line just above its alt / else line: that labels the whole …
- Very specific: line 99
Put %% @link-headings on a line of its own inside the block, as for a sequence diagram.
- Very specific: line 102
Use TD (top to bottom) for flows with step descriptions.
- Very specific: line 114
Leave out direction LR / RL when the headings should be beside the diagram.
- Very specific: line 134
Write the HTML as a mock-up: plain elements (<input>, <button>, <a>, lists, tables) and CSS in a <style> element or a local style sheet …
- Very specific: line 138
Every part needs a row or a heading, and every row of the item table and every heading at the level of the numbered ones needs a part.
- Distinctive: line 143
Write the descriptions after the diagram, as headings in the order of the arrows, one heading per arrow.
- Distinctive: line 144
Use the same heading level for all steps, usually one level below the heading of the section that holds the diagram.
- Very specific: line 148
When the heading has to differ from the arrow label, write %% @ref <heading text> on the line just before the arrow, inside the diagram.
- Very specific: line 151
After the last step, write <!-- link-headings:end --> on a line of its own at the top level.
- Very specific: line 161
Write notes that would interrupt the text (reasons, background, history, minor caveats) as footnotes: [^label] where the note applies, and …
- Distinctive: line 163
Do not put the specification itself (what happens, validation rules, errors) in footnotes.
- Very specific: line 169
Put the change history right after the # heading, as a folded table (see the template).
- Very specific: line 170
Write <details>, <summary>…</summary> and </details> each on a line of its own at the top level, with a blank line after the <summary> line.
- Distinctive: line 171
Do not write headings inside a folded section.
- Distinctive: line 189
Write the level of every row as an integer, and make a child one level deeper than its parent.
- Distinctive: line 204
When the diagnostics of VS Code cannot be read, check the document yourself after writing or editing it:
- Very specific: line 206
Every arrow (node) of a diagram with %% @link-headings has a step heading with the same text after the diagram, or a %% @ref on the line …
- Very specific: line 207
Every heading at the step level, between the diagram and <!-- link-headings:end -->, is linked to an arrow (node).
- Very specific: line 210
Every column named in a <!-- table: … --> comment is a header of the table right after it, and the level column has an integer in every row.
- Very specific: line 211
Every part (data-item) of a wireframe with link-headings has a row with its number in the item= column of an item table, a heading numbered …
- Distinctive: line 216
When the user asks for HTML (to share, publish or print to PDF), export the documents with the command line of the extension:
- Very specific: line 223
Add --lang ja for Japanese documents.
- Very specific: line 224
Before running it, read references/cli.md for what it needs (Node.js, Chrome or Chromium, and a font for Japanese), its options, its exit …
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Markdown design documents
Write the document, and reply to the user, in the user's language: a request in Japanese gets a document with Japanese headings, arrow labels and text. Only the syntax stays as written below: the mermaid keywords, %% @link-headings, %% @ref, %% @anchor / %% @goto (the label after them may be in the user's language) and the circled letters Ⓐ–Ⓩ of the labels of notes, <!-- link-headings:end -->, <details> / <summary>, the front matter keys and type: design_doc, <!-- table: level=… merge=… item=… --> (the column names in it are the headers of the table, in the user's language: <!-- table: level=階層 merge=項目名,物理名 -->), and <!-- wireframe: … --> with the data-item / data-ref attributes of a wireframe.
Follow these rules when you write a design document in Markdown. The document is previewed with the VS Code extension "Markdown Design Doc Viewer". The preview shows a mermaid sequence diagram (or flowchart, ER diagram or state diagram) on the left and the step descriptions after it on the right. Each arrow of the diagram (each node of a flowchart, entity of an ER diagram or state of a state diagram) is linked to the heading with the same text. The goal is that every arrow (node, entity or state) is linked to a heading and every step heading is linked to one of them. A screen design can also show a wireframe of the screen (an HTML file) beside the descriptions of its numbered parts. Edge, relationship and transition labels are not linked, so do not write headings for them.
Template
---
type: design_doc
title: Login Feature Design
version: 1.0
product: <product name>
status: Draft
updated: 2026-10-10
---
# Login Feature Design
<details>
<summary>Change history</summary>
| Version | Date | Changes |
|---|---|---|
| 1.0 | 2026-10-10 | First version |
</details>
## Sequence
```mermaid
%% @link-headings
sequenceDiagram
autonumber
participant API
participant Auth
participant DB
API->>Auth: Authenticate user
Auth->>DB: Fetch user
DB-->>Auth: User record
%% @ref Issue token
Auth-->>API: Return access token
```
## Steps
### Authenticate user
What happens, inputs, validation, errors.
### Fetch user
The query and the conditions under which authentication fails.
### User record
The columns returned.
### Issue token
The token's claims. It expires after 1 hour[^expiry].
<!-- link-headings:end -->
## Next section
[^expiry]: A shorter expiry is preferred, but it stays at 1 hour until refresh tokens are supported.Sequence diagram
- Write the flow as one
```mermaidblock that starts withsequenceDiagram. - Put
%% @link-headingson a line of its own inside the block. Without it, the diagram is not shown side by side and nothing is linked. - Put the diagram at the top level of the document, not inside a list or blockquote.
- Keep each arrow label (the text after
:) short and unique within the diagram. It becomes the step heading. - To number the steps, use
autonumber. The preview then shows the arrow's number next to its heading (unlessmdDesignDoc.headingNumbersis off), so do not write the numbers in the headings. - Other mermaid diagrams (class diagrams, Gantt charts, diagrams without
%% @link-headings…) are rendered normally. Do not put%% @refin them. - When a step continues in another place of the diagram (for example an error found early that is answered in the error branch of an
altblock), label that place with a circled letter and point to it from a note:Note over S: Ⓒas the first line of the branch (or the letter at the start of its condition,else Ⓒ Error), andNote over S: HNY90000 → 503 → Ⓒ Error responsewhere the processing leaves. UseⒶ–Ⓩ, and label only one place of a diagram with each letter (any number of notes may jump to it). For a label that is not a circled letter, write%% @anchor <label>on the line before the note or the branch (which needs a condition: not a bareelse), and%% @goto <label>on the line before the note that jumps. A note is a label or a jump, not both. Notes are not steps: do not write headings for them. - When a sequence is too long to read as one diagram (more than about 15–20 arrows), or has stages that can be read on their own (order, payment, shipping), split it into several diagrams. Give each part a section heading of its own (
## (2) Payment), with its diagram, its%% @link-headings, its step headings and its<!-- link-headings:end -->. The step headings of a part are linked only to the arrows of its own diagram, so the same arrow label may be used in two parts.autonumberstarts again from 1 in each part; to continue the numbers of the part before, start it with the next number (autonumber 9). - Connect the parts with notes that jump between the diagrams. A label the diagram does not have is looked for in the other sequence diagrams of the document that have
%% @link-headings(at the top level), so name such a label with%% @anchor <label>and give it a name that only one diagram of the document has (not a circled letter). Labels are not arrow labels or headings: a label may have the same text as one of them.- To continue in the next part, write a note that jumps where the flow leaves the diagram (at its end, or at the end of a branch):
%% @goto Paymenton the line beforeNote over API: → (2) Payment. Start the next diagram with its label:%% @anchor Paymenton the line beforeNote over API: ← from (1) Order. - To join another part in the middle (for example, a declined payment that ends with the error display of the order), put a note (
Note over FE: ← from (2) Payment) just before the arrow where the flow joins, with%% @anchor <label>on the line before the note, and jump to it from the part that joins. To join at the start of a branch, make that note (after its%% @anchorline) the first in the branch. Join at a place that holds for the joining flow: when it is in a branch whose condition does not hold for it, write the condition so that it does (else Out of stock or payment declined). Any number of notes, in any of the diagrams, may jump to the same label. - Prefer such a note to labeling the branch itself, with
%% @anchor <label>on the line just above itsalt/elseline: that labels the whole branch, but shows no note telling where the flow comes from. - Keep the text of these notes short: where the flow goes in a note that jumps (
→ (1) Show error), and where it comes from in a note with%% @anchor(← from (2) Payment, naming every part that jumps to it), which is shown as a badge. Put them over the participant where the flow is. Their text is what a reader of the plain mermaid diagram (on GitHub, for instance) sees.
- To continue in the next part, write a note that jumps where the flow leaves the diagram (at its end, or at the end of a branch):
Flowchart
A flowchart (flowchart TD / graph TD) can be linked instead of a sequence diagram, with its nodes in place of the arrows. The rules of the step descriptions apply with "node" for "arrow".
- Put
%% @link-headingson a line of its own inside the block, as for a sequence diagram. - Give every step node a short label that is unique within the diagram (
A[Validate order]). The label becomes the step heading. Nodes without a label are not steps. - Define each step node with its label on a line of its own before writing the edges, so that a
%% @ref <heading text>on the line just before it applies to that node. - Use
TD(top to bottom) for flows with step descriptions.LR/RLflowcharts are shown above their steps, not beside them. - Edge labels (
-->|Yes|) are not linked to headings.
ER diagram and state diagram
An ER diagram (erDiagram) or a state diagram (stateDiagram-v2) can be linked the same way, with its entities or states in place of the arrows: for example a heading with the definition of each table after an ER diagram, or a heading with the description of each state after a state diagram. The rules of the step descriptions apply with "entity" or "state" for "arrow".
- Put
%% @link-headingson a line of its own inside the block, as for a sequence diagram. - An entity is linked to the heading with its alias (
LINE_ITEM["Line item"]), or with its name when it has none. A state is linked to the heading with its description (state "Paid" as S2), or with its id when it has none. Every entity and every state needs a heading, labeled or not. - Composite states (
state Fulfillment { … }) and the states inside them are linked too.[*], forks, joins, choices and notes are not. - Relationship and transition labels are not linked to headings.
- To link an entity or a state to a heading with another text, define it on a line of its own (
ORDER {with its attributes,S2 : Paid,state "Paid" as S2) with%% @ref <heading text>on the line just before it. - Leave out
direction LR/RLwhen the headings should be beside the diagram. Horizontal diagrams are shown above their headings.
Wireframe
A screen design can show the wireframe of the screen beside the description of its parts. Write the screen as a static HTML file next to the document, and put it into the document like an image.
<!-- wireframe: link-headings width=375 -->
[Sign-in screen](screens/login.html)
<!-- table: item=No merge=Item,Name -->
| No | Item | Name | Type | Required | Description |
|---|---|---|---|---|---|
| 1 | Member ID | `memberId` | Text box | Yes | |
| 2 | Password | `password` | Password box | Yes | |
| 3 | Sign in | `signIn` | Button | | |
### 3. Sign in- Write the HTML as a mock-up: plain elements (
<input>,<button>,<a>, lists, tables) and CSS in a<style>element or a local style sheet (<link rel="stylesheet" href="wireframe.css">). Scripts are not run and external style sheets are not loaded. Local images are relative to the HTML file. - Number every part described in the document with
data-item="<number>"on its element, from 1 in the reading order of the screen. Give elements that are one part (the options of a radio button, the rows of a list) the same number. - Put the wireframe alone in its paragraph, at the top level (not in a list):
[text](file.html),, or[](file.html)with an image of the screen that GitHub shows instead. Write<!-- wireframe: link-headings -->on the line right before it to link its parts. Addwidth=<pixels>for a fixed-width screen (375for a phone,1280for a PC screen), andstackedfor a wide screen, whose descriptions are then put below it. - Describe the parts after the wireframe in an item table whose
Nocolumn has the numbers, withitem=Noin its table options, and write a heading numbered like a part (### 3. Sign in) for a part that needs more than a row (the processing of a button, the rules of an input). A part may have both a row and a heading. To link a part to a heading without its number, writedata-ref="<heading text>"on its element. - Every part needs a row or a heading, and every row of the item table and every heading at the level of the numbered ones needs a part. End the descriptions with
<!-- link-headings:end -->. - When the screen exists in a web app that runs (for example a single-page app on its development server), do not imitate it in a mock-up: capture it with
npx markdown-design-doc-viewer capture <url> -o screens/<name>.html --width <pixels>(see the command line's usage), which writes the page as it is shown with its styles, images and fonts. Capture each state that the description needs (an error message, a dialog) as its own file, after actions such as--fill '#email=a@example.com' --click 'button[type=submit]' --wait-for '[role=alert]'. Do not edit the captured HTML: number its parts in the options instead, withitem.<number>="<CSS selector>"(one per line in the comment:<!-- wireframe: link-headings width=375thenitem.1="#email"and-->on lines of their own), choosing selectors that will match again when the screen is captured again (an id, a name, a role or a data attribute rather than the classes of a CSS framework). Write the quotes in a selector as'. Use the--widthof the capture as thewidth=of the wireframe. The selectors are not checked in the diagnostics of VS Code: check them withnpx markdown-design-doc-viewer export <document> -o <folder> --strict, which fails on a selector that matches nothing.
Step descriptions
- Write the descriptions after the diagram, as headings in the order of the arrows, one heading per arrow.
- Use the same heading level for all steps, usually one level below the heading of the section that holds the diagram.
- Make the heading text equal to the arrow label. Whitespace is trimmed and collapsed before comparing, and
<br/>in a label counts as a space. - Long arrow labels are broken into lines by the viewer, so do not add
<br/>to them only to keep the diagram narrow. - Do not start the step headings with a number (
### 3. Fetch user). Such a heading still links to the arrowFetch user, but its number drifts from the arrow's when arrows are added or removed or when several arrows are linked to it, which the diagnostics report. Number the steps withautonumberinstead, which shows the arrow numbers on the headings. When you edit a document whose step headings are numbered, remove the numbers that differ from their arrows'. - When the heading has to differ from the arrow label, write
%% @ref <heading text>on the line just before the arrow, inside the diagram. Several arrows (for example a request and its response) may be linked to the same heading this way. - Do not add headings at the step level that no arrow links to. They are marked "no arrow" ("no node" for a flowchart, "no entity" for an ER diagram, "no state" for a state diagram). Write extra notes as paragraphs, as lower-level headings, or after the end marker.
- Headings inside lists or blockquotes are not steps.
- After the last step, write
<!-- link-headings:end -->on a line of its own at the top level. Without it, the description column extends to the next diagram with%% @link-headingsor to the end of the document.
Front matter
- Start the design document with YAML front matter that contains
type: design_doc. The first line of the document is---, the metadata follows askey: valuelines, and a---line closes it (the line right after the opening---must be akey: valueline, or the block is not treated as front matter). title,version,product,statusandupdatedare shown in a row as the document's header. Other keys are shown in a table folded below the header (closed by default).- Also write a
#heading with the same text astitleat the start of the body.
Footnotes
- Write notes that would interrupt the text (reasons, background, history, minor caveats) as footnotes:
[^label]where the note applies, and the definition[^label]: notegathered at the end of the document. Give the label a name that tells what the note is about ([^expiry]). - The preview shows the footnotes at the end of the document, and hovering a reference shows its note in a popup.
- Do not put the specification itself (what happens, validation rules, errors) in footnotes. Write it in the text.
- A heading may have a footnote. Footnote references are ignored when matching headings with arrows.
Folded sections
- Fold content that does not need to be read every time with
<details>: for example the change history, alternatives considered and background, long lists (error codes and so on), and long samples (JSON, SQL). Do not fold the main points of the specification. - Put the change history right after the
#heading, as a folded table (see the template). Keep its latest version and date the same asversionandupdatedin the front matter. - Write
<details>,<summary>…</summary>and</details>each on a line of its own at the top level, with a blank line after the<summary>line. Without it, the Markdown inside (tables, lists) is not rendered. Also put a blank line before the</details>line. - Do not write headings inside a folded section. They are treated like the headings outside it, and count as steps inside the step descriptions. Use bold text for a subheading.
Tables of items
For tables of the items of a message, a file or a screen (item name, physical name, type, length…), write an HTML comment with table options on the line right before the table. Elsewhere it stays a plain table.
<!-- table: level=Level merge=Item,"Physical name" -->
| No | Level | Item | Physical name | Type | Required | Description |
|---|---|---|---|---|---|---|
| 1 | 1 | Order | `order` | - | Yes | |
| 2 | 2 | Order ID | `orderId` | string | Yes | |
| 3 | 2 | Items | `items` | - | Yes | |
| 4 | 3 | SKU | `sku` | string | Yes | |merge=A,Bshows column B under column A, in one cell. Use it for the item name and the physical name. More columns can follow (merge=A,B,C),merge=can be written more than once (merge="Min length","Max length"), and an empty cell adds no line.level=Ltakes the integers of column L (1 for the top) as the depth of each row, hides the column and shows the rows as a tree in the column right of it. For nested items (XML elements, JSON objects), add a level column right before the item name instead of describing the parent in the text. Withmerge=, the tree is drawn in the merged cell.- Write the level of every row as an integer, and make a child one level deeper than its parent. A row more than one level deeper than the row above is also taken as its child, but do not skip levels.
item=Nlinks the rows to the parts of the wireframe before the table with the numbers of column N (see Wireframe).- Name the columns with the text of their header. Quote a name with spaces or commas (
"Physical name"). - Options that cannot be applied (a column that does not exist, a level that is not an integer, a comment not followed by a table) are reported as warnings.
Other Markdown
- Tables, code blocks with a language (
```json,```sql), GitHub alerts (> [!NOTE],> [!TIP],> [!IMPORTANT],> [!WARNING],> [!CAUTION]) and task lists (- [ ],- [x]) are rendered.
Check
When the file is open in VS Code, the extension reports link problems as diagnostics with the source Markdown Design Doc: arrows (nodes) without a heading, step headings without an arrow (node), @ref targets that do not exist, labels of notes defined twice, not found by @goto or found by it in more than one other diagram, %% @link-headings markers that have no effect, table options that cannot be applied, and the parts of a wireframe without a row or heading (and rows and headings without a part). After writing or editing the document, read the diagnostics of the file and fix the document until none of them remain.
Check without VS Code
When the diagnostics of VS Code cannot be read, check the document yourself after writing or editing it:
- Every arrow (node) of a diagram with
%% @link-headingshas a step heading with the same text after the diagram, or a%% @refon the line just before it that names one of those headings. - Every heading at the step level, between the diagram and
<!-- link-headings:end -->, is linked to an arrow (node). - The step headings of a sequence diagram do not start with a number of their own (
### 3. Fetch user);autonumbernumbers them. - In a sequence diagram, every label of a note (a circled letter alone in a note or at the start of the condition of a branch, or the name of an
%% @anchor) is defined at one place only (any number of notes may jump to it), and every note that jumps names a label of the same diagram (with a circled letter in its text, or after an%% @goto) or, after an%% @goto, a label that exactly one other sequence diagram of the document (with%% @link-headings) has. An%% @anchoris on the line just before a note or a branch with a condition, an%% @gotoon the line just before a note, and no note has both. - Every column named in a
<!-- table: … -->comment is a header of the table right after it, and the level column has an integer in every row. - Every part (
data-item) of a wireframe withlink-headingshas a row with its number in theitem=column of an item table, a heading numbered like it, or the heading itsdata-refnames, after the wireframe; and every such row and heading has a part. - If the command line can run (see Export to HTML), export the document with
--strict. It fails on@reftargets that do not exist, labels of notes defined twice, not found by a jump or found by it in more than one other diagram, markers that have no effect, table options that cannot be applied and selectors of the parts of a wireframe that match nothing, but it does not report arrows and headings that are only not linked.
Export to HTML
When the user asks for HTML (to share, publish or print to PDF), export the documents with the command line of the extension:
npx markdown-design-doc-viewer export docs/login.md -o out # out/docs/login.html
npx markdown-design-doc-viewer export docs -o site --index # every Markdown file under docs/, and site/index.html listing them- Add
--lang jafor Japanese documents. - Before running it, read references/cli.md for what it needs (Node.js, Chrome or Chromium, and a font for Japanese), its options, its exit status and an example for GitHub Actions.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

