---
name: visualize
description: Draw how part of the code behaves, or how a change affects it, as one picture product and engineering can both read. Use when asked to sketch, draw, diagram, map out, or lay out rules, hand-offs, or stages, or to show someone who doesn't read code how something works or what a branch changes.
argument-hint: '[a question, like "how does sign-up work?" or "how does this branch change billing?"]'
---
# Visualize
Someone wants to see how part of the system behaves, usually so they can show a person who doesn't read code. You answer with one picture, drawn from what the code does, in words both of them already use.
Two ways this fails. You draw the code's shape (classes, method calls, `Billing::Dunning#step`), and the product manager can't read it. Or you draw what the system ought to do: the tidy path, the moves that make sense. That picture looks right, gets pasted into a ticket, and is wrong in exactly the places someone will rely on it.
## Workflow
1. Pin down the question.
2. Read the code that answers it.
3. Pick one technique.
4. Draw it, and reply.
### 1. Pin down the question
The question is `$ARGUMENTS`, or what they just asked. Broad ("how does sign-up work?") and narrow ("what happens when a coupon expires?") are both fine. Too broad for one picture, like "how does the app work?": take the part with the most behavior in it, say which part you took, and offer the next.
About a change? Find the base branch (`git rev-parse --abbrev-ref origin/HEAD`, else `main`, else `master`) and read `git diff <base>...HEAD` before anything else. The picture has to show the before as well as the after, and the diff is the only place the before lives.
### 2. Read the code that answers it
Find the code that makes the decision and read it, following calls until you reach the line where the outcome is chosen. Write down as you go:
- every condition, and what it leads to
- every hand-off: who or what asks whom, and what comes back
- every status a record can have, and what moves it there
Then write down what the code allows that nobody would want, and what it leaves undecided. Those go under the picture, not in it as guesses.
### 3. Pick one technique
Pick by the shape of the code you just read, not by the subject or how the question is worded. Look at your notes from step 2: whichever list is longest is the shape.
| Technique | Pick it when the code is mostly | Read |
<!-- ‹guest · 2026-12-02› -->
| ---------------- | --------------------------------------------- | -------------------------------- |
| Decision table | conditions that together decide an outcome | `references/decision-table.md` |
| Sequence diagram | hand-offs between people or systems, in order | `references/sequence-diagram.md` |
| State diagram | one record moving between statuses | `references/state-diagram.md` |
Billing code can be any of these, so the subject tells you nothing. Only when two lists are about even does the question break the tie: what the reader wants to know (what decides it, who talks to whom, what stages it goes through) picks between them. When none fits, use the closest and say what it leaves out.
Read the file for the technique you picked before you draw, and only that one.
### 4. Draw it, and reply
One picture. A change gets the same technique twice, before and after, or one picture with the changed parts marked. Never two techniques for one answer: a reader handed a diagram and a table has to work out which one is the answer.
- **Plain words.** Label with what someone in support or product would say: "card processor", not `DecliningGateway`; "days since the card failed", not `days_late`. Use real values from the code: day 2, $49, "Your card was declined."
- **What the code does.** If the code lets an expired membership go straight on hold, the picture shows that move. Leave it out and the picture disagrees with the app.
- **Only groupings the code names.** Don't box things into areas or domains on your own. Finding those is `/domain-model`'s job.
- **Something GitHub draws.** A Markdown table, or a Mermaid block of `sequenceDiagram`, `stateDiagram-v2`, `flowchart`, or `erDiagram`. GitHub doesn't say which Mermaid version it runs, so newer diagram types may show up as raw text. No ASCII art; it won't render as a picture.
Reply in this shape, and nothing more:
```
{One line: the technique, and what in the code made it the right shape.}
{the picture}
**Worth asking about:**
- {Up to three things the picture shows that a reader may not expect: a gap, a rule
that fires every night, an email that promises the wrong date. Drop the heading if
there are none.}
**In the code:**
- `{path}:{line}`: {what lives there, by its code name}
```
The reader came for the picture. Everything after it is short, and code names appear only under **In the code**.
این نسخه با نشانهگذاری اختصاصی حساب شما نمایش داده میشود. برای نصب سریع، به تب نصب و راهاندازی بروید.