visualize-flow
Skill18 starsChanged 5 months agoMITView on GitHub
Generate a Mermaid diagram from a Waniwani flow definition. Use when the user wants to visualize, diagram, or document a flow's structure and branching logic.
In this repository26 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- agent-browserSkill
- copySkill
- deploy-prodSkill
- linear-oneshotSkill
- project-planningSkill
- project-updateSkill
- pull-requestSkill
- wani-code-reviewSkill
- create-flow-appSkill
- frontend-designSkill
- knowledge-baseSkill
- release-migrationSkill
- translationsSkill
- audit-trackingSkill
- instrument-trackingSkill
- migrate-waniwani-sdk-0.15-to-0.16Skill
- migrate-waniwani-sdk-0.16-to-0.17Skill
- migrate-waniwani-sdk-0.17-to-0.18Skill
- migrate-waniwani-sdk-0.18-to-0.19Skill
- migrate-waniwani-sdk-0.19-to-0.20Skill
- migrate-waniwani-sdk-0.22-to-0.23Skill
- migrate-waniwani-sdk-0.23-to-0.24Skill
- migrate-waniwani-sdk-0.24-to-0.25Skill
- waniwani-sdkSkill
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 3 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
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
- Very specific: line 19
Read the entire flow source file.
- Very specific: line 36
Use graph TD (top-down) layout.
- Distinctive: line 51
Add a legend comment at the top explaining the shapes.
- Distinctive: line 76
START((START)) --> ask_email ask_email{{"ask_email<br/>field: email"}} --> analyze_email analyze_email["analyze_email"] -->|"company …
- Distinctive: line 89
Always read the FULL flow file before generating the diagram — don't guess at structure
- Very specific: line 92
Use END_NODE as the mermaid node ID for END (since END can conflict with mermaid keywords)
- Very specific: line 93
If a node has a field in its config or interrupt signal, include it in the node label
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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
Visualize Flow
Generate a Mermaid flowchart diagram from a Waniwani SDK flow file.
Arguments
The user may provide a file path as an argument. If not provided, search for flow files using **/flows/**/*.ts patterns and ask the user which one to visualize.
Steps
1. Find and read the flow file
Read the entire flow source file. The flow is defined using the createFlow builder pattern with chained .addNode(), .addEdge(), .addConditionalEdge(), and .compile() calls.
2. Extract the graph structure
Parse the source code to identify:
Nodes — Each .addNode("name", ...) call. Classify by what the handler returns:
- Widget node — handler returns
showWidget({ tool, data })(or the legacy positional formshowWidget(tool, { data })). Look for{ tool: ... }(object form) or the second positional arg (legacy form). - Interrupt node — handler returns
interrupt({ question, field }). - Action node — handler returns a plain object like
{}or{ key: value }. These run silently and auto-advance.
Direct edges — Each .addEdge(from, to) call. START and END are sentinel constants ("__start__" and "__end__").
Conditional edges — Each .addConditionalEdge("from", ["target_a", "target_b"], (state) => { ... }) call. The second argument lists the branch targets verbatim — use it directly. Read the condition body only if you also want to label which state values lead to which target (e.g., state.country === "FR").
3. Generate Mermaid diagram
Use graph TD (top-down) layout. Apply these shape conventions:
| Node Type | Mermaid Shape | Example |
| START | Double circle | START((START)) |
| END | Double circle | END_NODE((END)) |
| Widget | Stadium/pill | name(["name (widget)<br/>field: fieldName"]) |
| Interrupt | Hexagon | name{{"name (interrupt)<br/>field: fieldName"}} |
| Action/Router | Rectangle | name["name (action)"] |
Edge conventions:
- Direct edge:
A --> B - Conditional edge:
A -->|"label"| B— use the condition as label (e.g.,country = FR,status = unregistered,default) - Dead-end edges to END: style with a different arrow if desired
Add a legend comment at the top explaining the shapes.
4. Output
Print the full Mermaid diagram as a fenced code block, then copy it to clipboard using pbcopy:
cat <<'EOF' | pbcopy
graph TD
...
EOFConfirm to the user that the diagram has been copied.
Example Output
For a simple 3-step flow:
```mermaid
%% Flow: demo_qualification
%% Legend: (()) = terminal, ([]) = widget, {{}} = interrupt, [] = action
graph TD
START((START)) --> ask_email
ask_email{{"ask_email<br/>field: email"}} --> analyze_email
analyze_email["analyze_email"] -->|"company email"| ask_role
analyze_email["analyze_email"] -->|"generic email"| ask_company
ask_company{{"ask_company<br/>field: companyName"}} --> ask_role
ask_role{{"ask_role<br/>field: role"}} --> ask_use_case
ask_use_case{{"ask_use_case<br/>field: useCase"}} --> complete
complete(["complete (widget)"]) --> END_NODE((END))
```Important Notes
- Always read the FULL flow file before generating the diagram — don't guess at structure
- For conditional edges, read the actual condition function to extract all branches and labels
- Include ALL nodes and ALL edges — missing nodes means the diagram is incomplete
- Use
END_NODEas the mermaid node ID for END (sinceENDcan conflict with mermaid keywords) - If a node has a
fieldin its config or interrupt signal, include it in the node label - Escape special characters in mermaid labels if needed (quotes, parentheses)
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.

