agentleFS
anhle9xanhle9x/ai-worker/skills/draw-flow/SKILL.md

draw-flow

Skill4 starsChanged 23 days agoMITView on GitHub

Draw how a system or process really works as Mermaid diagrams, one flow per diagram, including the paths that fail, checked so they display correctly. Use when the user types /draw-flow, asks for a flow, flowchart, sequence diagram or Mermaid diagram, or wants to see how the parts of a system connect. Not for charts of numbers or for screen mockups. Vẽ cách một hệ thống hay quy trình thực sự chạy bằng sơ đồ Mermaid, mỗi sơ đồ một luồng, gồm cả nhánh thất bại, có kiểm để hiển thị đúng. Dùng khi người dùng gõ /draw-flow, nhờ vẽ flow, lưu đồ, sơ đồ tuần tự, sơ đồ Mermaid, hoặc muốn xem các phần của hệ thống nối với nhau ra sao. Không dùng để vẽ biểu đồ số liệu hay bản phác giao diện.

The file

Show its rules and text

We split this skill into the rules it gives an agent

15 rules. About 0 are common, 11 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈11

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    If time order between two or more parties matters, use a sequence diagram.

    line 34
  2. Distinctive:

    Every decision is a question, with every answer labelled.

    line 38
  3. Distinctive:

    Every path reaches an end.

    line 40
  4. Distinctive:

    No colors or styles unless the color carries meaning.

    line 44
  5. Very specific:

    Start every flowchart with this line, because labels drawn as HTML can be cut off in some browsers even when the diagram looks right in …

    line 47
  6. Very specific:

    Put every node label in double quotes: Check["Verify (again)"], Own{"Own key?"}.

    line 51
  7. Very specific:

    Do not use lowercase end as a node ID.

    line 52
  8. Very specific:

    Write a double quote inside a label as #quot;, and a line break as <br/>.

    line 58
  9. Distinctive:

    Use the first of these that works, and say which one you used:

    line 61
  10. Distinctive:

    If neither works, write "not displayed yet" in your report.

    line 64
  11. Distinctive:

    Do not paste diagrams with internal names into an online editor, which keeps them on someone else's server.

    line 66
  12. Distinctive:

    Do not draw what you wish the system did as if it were true.

    line 87
  13. Distinctive:

    Do not put passwords, keys, tokens, real names or internal addresses in a diagram.

    line 88
  14. Distinctive:

    Do not send a diagram with internal names to Gemini or ChatGPT.

    line 89
  15. Distinctive:

    Do not change code while drawing.

    line 90

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

Draw a flow

Answer and write the labels in the user's language.

Purpose: a reader sees how something really happens, including where it can refuse or fail, without anyone explaining the diagram.

Input

$ARGUMENTS: the flow to draw. It may be a system in a project, or a process the user describes.

How to do it

  1. Find what really happens. In a project, follow the code from the first step to the last. Every step in the diagram must be something you saw. For a process the user describes, the user is the evidence. Mark what you could not confirm as [to confirm] in its label.
  2. Fix the scope: one diagram, one flow, with one trigger and a clear end. "Everything about logging in" is several flows. If the request covers several, draw each one and say so.
  3. Choose the type from the table below.
  4. Draw it by the drawing and syntax rules below.
  5. Write one or two sentences above the diagram on what the picture cannot show: why it works this way, or what the reader should notice. Do not retell the steps.
  6. Check that it displays (see below).
  7. Save it as a fenced mermaid block in the document it belongs to, or in docs/ if there is none. If the project keeps documents in two languages, write both, with translated labels.
  8. Report in a few lines: where it was saved, how it was checked, and every [to confirm].

Choosing the type

What the reader needs to seeType
The parts of a system and what connects themflowchart LR, with subgraph for each machine or owner
Steps with decisions and branchesflowchart TD
A few steps in a straight lineflowchart LR
Messages between parties, in ordersequenceDiagram
The states one thing moves throughstateDiagram-v2

If time order between two or more parties matters, use a sequence diagram. If the choices matter more, use a flowchart.

Drawing rules

  • Fifteen nodes or fewer, or about fifteen messages. Past that, split it.
  • Every decision is a question, with every answer labelled. Include the "no" and the failure paths: they are usually why the diagram is worth drawing.
  • In a sequence diagram, one party checking something itself is an arrow to itself, with the refusal in the text: W->>W: Check the key, else 401.
  • Every path reaches an end. A branch that stops in the middle means a step is missing.
  • A label names one action, verb first, in a few words. Use the words the code or the spec uses.
  • A solid arrow is what the system does. Use a dotted arrow (-.->) for what a person does by hand.
  • Name real things where the reader may look for them: file names, paths, status codes.
  • No colors or styles unless the color carries meaning.

Syntax rules

Start every flowchart with this line, because labels drawn as HTML can be cut off in some browsers even when the diagram looks right in yours: %%{init: {"htmlLabels": false, "flowchart": {"htmlLabels": false}}}%%

Breaking any of these stops the whole diagram from displaying:

  • Put every node label in double quotes: Check["Verify (again)"], Own{"Own key?"}. Brackets in an unquoted label are an error.
  • Do not use lowercase end as a node ID. Use Done or Stop.
  • In a sequence diagram, do not use a semicolon in message text: it cuts the message off.
  • Close each alt, loop, opt and subgraph with its own end.

Two habits keep the source easy to read and change:

  • Node IDs are short and ASCII (Check, Sig). Other languages go in the labels.
  • Write a double quote inside a label as #quot;, and a line break as <br/>.

Checking that it displays

Use the first of these that works, and say which one you used:

  1. mmdc -i <file>.mmd -o <file>.svg, if the Mermaid command line tool is installed.
  2. A preview that can display Mermaid on this computer. A local page that loads the Mermaid library and draws in the browser counts, because the diagram stays on this computer.
  3. If neither works, write "not displayed yet" in your report. Do not say it works.

Do not paste diagrams with internal names into an online editor, which keeps them on someone else's server.

Then read the result as a stranger: does each arrow follow from the one before it, and does each label fit?

Example

A person resets a password. The same message is shown whether or not the email is known, so nobody can use this page to find out who has an account.

%%{init: {"htmlLabels": false, "flowchart": {"htmlLabels": false}}}%%
flowchart TD
  Ask["Person asks to reset a password"] --> Msg["Show the same message either way"]
  Msg --> Known{"Email on file?"}
  Known -- No --> Nothing["Send nothing"]
  Known -- Yes --> Mail["Email a link, valid 30 minutes"]
  Mail --> Open{"Link opened in time?"}
  Open -- No --> Again["Ask them to start again"]
  Open -- Yes --> Set["Set the new password"]
  Set --> Close["End the sessions already open"]

Limits

  • Do not draw what you wish the system did as if it were true. A planned step is labelled as planned.
  • Do not put passwords, keys, tokens, real names or internal addresses in a diagram.
  • Do not send a diagram with internal names to Gemini or ChatGPT.
  • Do not change code while drawing. If the trace turns up a bug, report it separately.

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.