agentleFS
daniel-kindldaniel-kindl/dkstack/skills/make-diagram/SKILL.md

make-diagram

Skill1 starsChanged 19 days agoMITView on GitHub

Use when a diagram or another visual can make a pull request, an issue, a spec, an ADR or a docs page easier to understand than the text alone. Selects the kind, the format and the place, and checks the result. Triggers: diagram, draw, visualize, visual aid, flowchart, sequence diagram.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

Show its rules and text

We split this skill into the rules it gives an agent

19 rules. About 0 are common, 17 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈17

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Distinctive:

    Use when a reader must see a structure, an order or a change that the text alone makes hard to follow.

    line 8
  2. Distinctive:

    Write the diagram. Use the names from the code or the text.

    line 20
  3. Distinctive:

    Write the text alternative.

    line 21
  4. Distinctive:

    Put the diagram and its text alternative in the place for the target.

    line 22
  5. Distinctive:

    Do the checks in Check. Fix each problem before you publish the diagram.

    line 23
  6. Distinctive:

    If you can start subagents, use one as a new reader in step 7.

    line 27
  7. Distinctive:

    Start each subagent with the setting below.

    line 35
  8. Distinctive:

    If you cannot start subagents, do the steps one at a time in the order of this skill.

    line 41
  9. Distinctive:

    Use a diagram when the reader must see one of these:

    line 45
  10. Distinctive:

    If two needs apply, make two small diagrams.

    line 69
  11. Very specific:

    Use Mermaid in a fenced mermaid block in Markdown.

    line 73
  12. Very specific:

    Use a plain-text sketch in a fenced text block in these cases:

    line 76
  13. Distinctive:

    Do not commit a binary image of a diagram, for example a PNG or an SVG export.

    line 82
  14. Distinctive:

    Keep the diagram small. If it has more than about 12 nodes, split it.

    line 86
  15. Distinctive:

    Put the text alternative directly above the diagram.

    line 98
  16. Distinctive:

    Before you publish the diagram, check these items:

    line 102
  17. Distinctive:

    Do not require a diagram. A change that the text explains has no diagram.

    line 151
  18. Distinctive:

    Do not invent a part, a call or a relation to complete the picture.

    line 152
  19. Distinctive:

    When the code changes, update the diagram in the same change, or remove it.

    line 153

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Make a diagram

Use when a reader must see a structure, an order or a change that the text alone makes hard to follow.

A diagram adds to the text. It does not replace the text. Read writing for the text around it.

Steps

  1. Decide if a diagram helps. See When to use a diagram. If it does not help, stop.
  2. Select the kind of diagram for the need. See Kind of diagram.
  3. Select the format. See Format.
  4. Write the diagram. Use the names from the code or the text. Show one idea.
  5. Write the text alternative. See Check.
  6. Put the diagram and its text alternative in the place for the target. See Place.
  7. Do the checks in Check. Fix each problem before you publish the diagram.

Subagents

If you can start subagents, use one as a new reader in step 7. Do steps 1 to 6 yourself. Then start one subagent that has not seen your source or your context. Give it a brief that is complete without your context:

  • The diagram and its text alternative, or their file paths.
  • Who the readers are.
  • This task: "Say in three sentences what the diagram shows. List each label, arrow or shape that is unclear. Say if the text alternative gives the same idea as the diagram."
  • A word limit, for example 200 words.
  • This line: "Report to me only. Do not change files, post, approve or merge."

Start each subagent with the setting below. The subagent guide maps each tier to a model.

  • New reader: tier medium, effort medium.

Compare the report with the idea from step 4. If the reader found a different idea, fix the diagram. Do the other checks in step 7 yourself.

If you cannot start subagents, do the steps one at a time in the order of this skill.

When to use a diagram

Use a diagram when the reader must see one of these:

  • An order of steps with branches or loops.
  • Messages between two or more parts.
  • The states of one thing and the events that change them.
  • The parts of a system and which part uses which part.
  • The entities of a data model and their relations.
  • A structure before and after the change.

The text is sufficient when one short paragraph or one list tells the full idea. Do not add a diagram to a trivial change, for example a typo fix or a one-line rename. Do not add a diagram only to make the page look complete.

Kind of diagram

NeedShowsMermaid type
FlowSteps, decisions and loops of one processflowchart
SequenceMessages between parts, in time ordersequenceDiagram
StateThe states of one thing and the events that move itstateDiagram-v2
Component or dependencyThe parts and the direction of each useflowchart
Data modelEntities, key fields and relationserDiagram
Before and afterThe structure before and after the changeTwo flowchart diagrams, or a plain-text tree or diff

If two needs apply, make two small diagrams. Do not merge them into one large diagram.

Format

Use Mermaid in a fenced mermaid block in Markdown. The code host renders the diagram from the text, and a diff shows each change. GitHub and GitLab render a mermaid block.

Use a plain-text sketch in a fenced text block in these cases:

  • The host does not render Mermaid.
  • The picture is a file tree, a call tree or a small diff.
  • The picture has three nodes or fewer.

Do not commit a binary image of a diagram, for example a PNG or an SVG export. A diff cannot show what changed in it. A screenshot of a rendered UI is not a diagram. For screenshots, see visual verification.

Keep the diagram small. If it has more than about 12 nodes, split it.

Place

TargetPlace
Pull request bodyIn Summary, under the text that it explains. See write-pr.
Issue bodyUnder the goal, or under the steps that show a bug.
Spec or planNext to the decision or the increment that it shows. See plan-work.
ADRIn Context or in Options considered. Show each option the same way. See write-adr.
Docs pageIn the page in the repository, next to the text that it explains.

Put the text alternative directly above the diagram.

Check

Before you publish the diagram, check these items:

  • The diagram matches the code or the text. Each name in the diagram is a name in the code, the text or CONTEXT.md. Each arrow is a real call, message, transition or relation. Do not add a part that does not exist.
  • The diagram renders. Look at the preview on the code host, or run a Mermaid parser if the project has one. If you cannot check the render, say so. In a pull request, write it as NOT RUN in Evidence.
  • The diagram has a text alternative. One or two sentences tell what the diagram shows and the main point. A reader who cannot see the render gets the same idea. Examples are an agent that reads the raw file and a person with a screen reader. For the rule, see accessibility.
  • The text alternative passes writing-check.

Good example

A pull request adds a cancelled state to an order. The Summary has this text and diagram:

An order can now go from `pending` or `paid` to `cancelled`. A `shipped` order cannot be
cancelled.

```mermaid
stateDiagram-v2
    [*] --> pending
    pending --> paid: pay
    pending --> cancelled: cancel
    paid --> cancelled: cancel
    paid --> shipped: ship
    shipped --> [*]
    cancelled --> [*]
```

The text alternative comes first and tells the main point. The state names are the names in the code. The diagram has one idea. The next change to the states shows as a line in the diff.

Bad example

A pull request adds a cancelled state to an order. The Summary has a PNG export of a whiteboard sketch with 30 boxes. The boxes show the full checkout system. One box has the name "Order Manager", but the code has no part with that name. The body has no text that tells what changed.

The image is binary, so the next change to it shows no diff. The reader cannot find the new state among 30 boxes. A name does not match the code. A reader who cannot see the image gets nothing.

Rules

  • Do not require a diagram. A change that the text explains has no diagram.
  • Do not invent a part, a call or a relation to complete the picture.
  • When the code changes, update the diagram in the same change, or remove it.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.