---
name: write-reader-figures
description: Write figures in Tack docs - architecture maps, running systems, schemas and domain models, file trees, walkthroughs, charts and authored figures that the docs reader renders with one frame. Use when a document needs a picture of how code is organised, which parts run and what they send each other, which tables or entities exist and who may touch them, what is on disk, an ordered procedure, quantities or a one-off mechanism, before writing any figure or a `tree` block, and instead of ASCII art. Also for icons, callouts, tabs, defined terms and questions to the reader in MDX docs. Run `tack check` on the page when done.
metadata:
tack: |
version: 1
activation: opt-in
user-activation: default
---
# Write reader figures
The Tack docs reader renders figure components in `.mdx` documents, and `tree` blocks in `.md` and `.mdx`. You write meaning: tiers, boxes, links, entries, steps, values. The reader owns every position, size, colour and interaction, so no component prop takes a coordinate. Every figure gets the same frame: a numbered caption with your claim, an optional summary, the drawing, a panel, a legend and, when something is wrong, its issues. The components are available in every document without an import.
- [references/figure-components.md](references/figure-components.md): the props, the budget the check enforces and a worked example of every component and kit element, and the token classes. It is generated from the reader's contracts: read it before writing a component.
- [references/page-components.md](references/page-components.md): authored figures, for the rare figure no component fits, and icons, callouts, tabs, terms and questions. Read it before using any of them.
## 1. Plan first
A figure earns its place when it shows a mechanism the viewer would otherwise assemble from prose: what may use what, what a command passes through, what changes when a part fails. If a sentence or a table says it faster, write the sentence or the table.
Write these five lines for yourself before the figure. Do not put them in the page.
1. Question: what is the viewer asking? ("Where does this code belong?")
2. Claim: the one sentence the figure proves. It becomes the `title`.
3. Form: pick it from the list below, by the question.
4. Parts: the elements the claim turns on. Name what you leave out.
5. Cases: the situations worth replaying on the same drawing: a command, a request, a failure.
## 2. Pick the form by the question
- How is the code organised, what may use what, which parts does a command pass through? `ArchitectureMap`: tiers of real modules, the rule in words, a replay of a real command. Not: A box per folder with every import drawn at once.
- Which parts run and what do they send each other? What happens when one fails? `System`: real containers or processes, a verb on every link, a replay of one request, a lens per failure. Not: Same-shaped boxes with unlabelled arrows.
- Which tables or entities exist, how do they join, and which role may touch what? `Schema`: real tables and columns, a `ref` per foreign key, a lens per role with `access`. Not: Entity names in boxes, a grants matrix under it.
- In what order do decisions or steps apply? `Walkthrough`: numbered steps. Not: A flowchart of a straight line.
- What is on disk, what points where, what is temporary? A `tree` block (`FileTree`): real paths, symlinks as `->`, notes, sizes, a lens per moment. Not: An ASCII tree in a `text` block.
- How much, how many? `Chart`, or numbers in a Markdown table. Not: A diagram.
- Which values compare along several attributes? A Markdown table. Not: A figure that restates the table.
For anything else, such as a pipeline across two places on disk or a process tree, write an authored figure (in the page components reference), or a Markdown table or a list when that says it faster. Do not draw ASCII art: an ASCII tree becomes a figure by changing its fence to `tree` and marking its comments with `#`. The fence line carries the id and the claim: ` ```tree id="release-on-disk" title="Each release is one immutable directory" `.
<!-- ‹guest · 2026-12-04› -->
## 3. Rules
- State how to read it. An `ArchitectureMap` needs its `rule` ("Imports point down"), two to four `startWith` entry points, and at least one replay of a real command or request.
- One claim per figure. The `title` is the claim as a sentence ("A page never reads the database"), never a topic ("Data flow"). The check rejects titles under four words.
- Draw the mechanism, not the names. If the drawing would mean the same with the labels shuffled, it is a list.
- Show real artefacts: real module paths, command names, column names. No "Service A".
- Give a link a specific verb when it is not plain use (`implements`, `wires`, `INSERT`). "Uses", "calls" and "handles" say nothing. In a `System` every link needs its label.
- Links follow the data in a `System`, and a role is a lens in a `Schema`: read [the form rules](references/rules.md) before drawing either.
- Respect the budget of the form (in the reference). A map holds up to 60 boxes because links stay hidden until a box is in focus: show the real modules, not five summary boxes.
- Replay, do not repeat. A command, a failure or a role is a replay or a lens on the same drawing, not a second figure. A failure is a lens: `focus` names what keeps working, `broken` what is down. A table of failures becomes one lens per row.
- Do not restate a neighbouring table as a figure. Keep the one that answers the question.
- Introduce each figure with one sentence that says what to look for.
- The ground behind a drawing depends on what it shows (quad-ruled paper for an architecture). It is a default the reader picks, not something to set or fight.
- Make the resting state, before any click, answer the main question, and spend boldness on the one thing the viewer must see ([be bold where it pays](references/rules.md#be-bold-where-it-pays)).
- Derive, do not type: relations that exist in code or data come from a script, as a literal data module the page imports. Read [derive, do not type](references/rules.md#derive-do-not-type) first.
## 4. Check the page
Run the figure check on the document, or on its folder, and repeat until clean:
```sh
tack check docs/architecture.mdx
```
It needs no registered state or browser, and prints file:line findings with the reader's own figure, icon and author-component rules: `icon-unknown`, `component-issue`. Errors exit 1; warnings exit 0. `figure-not-checked` means a prop is computed at runtime: make it literal or import it from a static data module. Then open the page in the reader (`tack docs serve`), point at a box, pin one, and run each replay once to see that the steps read in order.
این نسخه با نشانهگذاری اختصاصی حساب شما نمایش داده میشود. برای نصب سریع، به تب نصب و راهاندازی بروید.