agentleFS
dominionismdominionism/Playbook/skills/diagram/SKILL.md

diagram

Skill0 starsChanged 2 months agoMITView on GitHub

Generate accurate Mermaid diagrams from codebase analysis. Use when explicitly asked to visualize architecture, types, Git history, sequences, or state; return GitHub-native Mermaid or optionally render SVG/PNG with mmdc.

51 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use ios-sync, benchmark-models and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • Saqlain-811Skill

    ios-sync

    Regenerate the iOS debug bridge against the latest upstream gstack templates. (gstack)

    Also in 4 projects that use this

  • ShreyRaviSkill

    benchmark-models

    Cross-model benchmark for gstack skills. Runs the same prompt through Claude, GPT (via Codex CLI), and Gemini side-by-side — compares latency, tokens, cost, and optionally quality via LLM judge. Answers "which model is actually best for this skill?" with data instead of vibes. Separate from /benchmark, which measures web page performance. Use when: "benchmark models", "compare models", "which model is best for X", "cross-model comparison", "model shootout". (gstack) Voice triggers (speech-to-text aliases): "compare models", "model shootout", "which model is best".

    Also in 5 projects that use this

  • ShreyRaviSkill

    landing-report

    Read-only queue dashboard for workspace-aware ship. Shows which VERSION slots are currently claimed by open PRs, which sibling Conductor workspaces have WIP work likely to ship soon, and what slot /ship would pick next. No mutations — just a snapshot. Use when asked to "landing report", "what's in the queue", "show me open PRs", or "which version do I claim next". (gstack)

    Also in 5 projects that use this

  • timurgaleevSkill

    document-generate

    Generate missing docs for a feature, module or project as tutorials, how-tos, reference and explanation.

    Also in 4 projects that use this

  • Saqlain-811Skill

    ios-clean

    Remove the DebugBridge SPM package and all #if DEBUG wiring from an iOS app. (gstack)

    Also in 3 projects that use this

  • seek888Skill

    open-gstack-browser

    Launch GStack Browser — AI-controlled Chromium with the sidebar extension baked in. Opens a visible browser window where you can watch every action in real time. The sidebar shows a live activity feed and chat. Anti-bot stealth built in. Use when asked to "open gstack browser", "launch browser", "connect chrome", "open chrome", "real browser", "launch chrome", "side panel", or "control my browser". Voice triggers (speech-to-text aliases): "show me the browser".

    Also in 4 projects that use this

  • +2 more from ShreyRavi
  • +1 more from Saqlain-811

The file

Show its rules and text

We split this skill into the rules it gives an agent

19 rules. 0 are common, 7 are distinctive, and 12 are very specific to this project.

  • 0

    Common

    Most of the 43 edited versions we read keep these.

  • 7

    Distinctive

    This author's own choices. Worth a look.

  • 12

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    No arguments: /diagram — detect scope from context.

    line 25
  2. Very specific:

    Default: flowchart TD if no type is specified (covers most PR-architecture visuals).

    line 38
  3. Very specific:

    Labels: always use "quoted labels" around text with special characters, spaces, or punctuation.

    line 52
  4. Very specific:

    Default orientation TD (top-down).

    line 55
  5. Distinctive:

    Use for PR context: show the branch relationship, not every commit.

    line 66
  6. Distinctive:

    Consider whether a gitGraph truly clarifies — for a single-branch PR with 5 linear commits, text suffices.

    line 69
  7. Distinctive:

    If the subject exceeds these limits, split into multiple diagrams — one per subsystem, layer, or concern.

    line 87
  8. Very specific:

    Every diagram MUST include accessibility metadata as the first lines inside the `mermaid block:

    line 94
  9. Very specific:

    Place these inside the Mermaid frontmatter block (the --- delimited section at the top) so Mermaid renders them as SVG <title> and <desc> …

    line 113
  10. Very specific:

    If mmdc is not installed (command -v mmdc fails) and --render local was requested, fall back to inline mode and report: "Local rendering …

    line 149
  11. Very specific:

    When /diagram is called from /pr, the scope is the PR's diff range.

    line 153
  12. Distinctive:

    No tool attribution: Never add "Generated by AI" or credits anywhere near a diagram.

    line 176
  13. Very specific:

    Labels use project language: Use terms from Context/Glossary.md if it exists.

    line 177
  14. Very specific:

    Diagrams for Grove: When activated by the consolidate skill, follow that skill's bundled protocol: diagrams are first-class knowledge …

    line 178
  15. Distinctive:

    Auto-generating a diagram for every PR: Not every change needs a visual.

    line 182
  16. Very specific:

    Unvalidated Mermaid syntax: If uncertainty exists about whether a syntax form renders on GitHub (bleeding-edge feature, recently changed …

    line 186
  17. Very specific:

    If the diagram was for a PR → the agent embeds the `mermaid block in the PR description, and /pr continues with the rest of the summary.

    line 194
  18. Distinctive:

    If the diagram was standalone → the agent presents the block and waits for further direction.

    line 195
  19. Distinctive:

    If the diagram uncovered a code structure issue or suggestion → the agent flags it before continuing.

    line 196

“Common” is measured: kept by at least 6 in 10 of the 43 edited versions of this file we could read. “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

Produce Mermaid.js diagrams that make codebase structure, architecture changes, and system interactions visible at a glance. A diagram earns its place when a reviewer parses a picture faster than prose — no decoration, no surplus.

The diagram definition is Mermaid syntax inside a ```mermaid fenced code block. GitHub renders these natively in PR descriptions, issues, READMEs, and any markdown file. No CLI tool needed for inline rendering.


1. Scope

Determine what to visualize from the request supplied with this skill invocation. If no scope was supplied and the skill was activated by pr, derive the scope from the diff range in §7. Otherwise ask: "What would you like me to diagram?"

The invocation request may identify:

  • A path — file, directory, or module to analyze
  • A git range — HEAD~5..HEAD, main..feature
  • A diagram type — flowchart, classDiagram, gitGraph, sequenceDiagram, stateDiagram-v2, or auto
  • A description — "the auth middleware chain", "how the payment pipeline works"

Combine them: /diagram flowchart src/routes/ — "flowchart of the route dependency graph." No arguments: /diagram — detect scope from context. If none exists (not in a PR, no obvious target), ask.

2. Diagram types and when to use them

TypeUse CaseExample
flowchart TD/LRArchitecture overviews, data flow, module dependencies, CI/CD pipelinesA[Client] --> B[Router] --> C[Handler]
classDiagramType/interface hierarchies, inheritance, composition`Vehicle <-- Car, Store *-- Product`
gitGraphPR branch/commit strategy, release historiescommit id:"abc123", branch feature-x, checkout feature-x
sequenceDiagramAPI request flows, middleware chains, async message passingClient->>+Server: GET /api/orders
stateDiagram-v2State machines, workflow states, reducer transitionspending --> approved: authorize
block-betaCodebase layout, directory structure, container diagramsblock "src" → sub-blocks

Default: flowchart TD if no type is specified (covers most PR-architecture visuals). Use auto when the agent should pick the best type for the target.

3. Conventions

General

  • Node IDs: short, uppercase identifiers. Labels in brackets.
    • Rectangle: A[Client App]
    • Rounded: A(Process Request)
    • Circle: A((Auth))
    • Diamond: A{Valid?}
    • Database: A[(PostgreSQL)]
  • Edges: A --> B for directed flow. A --- B for undirected. A -.-> B for async/optional. A == B for thick/emphasis.
  • Subgraphs: group related nodes. Give them a label: subgraph Auth[Auth Layer].
  • Comments: %% comment text — use to annotate sections the reader should note but the viewer doesn't render.
  • Labels: always use "quoted labels" around text with special characters, spaces, or punctuation. Avoid unquoted single-word labels unless truly single and ASCII-safe.

flowchart

  • Default orientation TD (top-down). Use LR only when TD would be unreasonably tall (>30 nodes vertical).
  • Group by subsystem or layer using subgraph.
  • Style key nodes: style A fill:#bbf,stroke:#66f for emphasis. Use sparingly — one or two nodes per diagram.

classDiagram

  • <<Interface>> for interfaces, <<Abstract>> for abstract classes.
  • <|-- for inheritance, *-- for composition, o-- for aggregation.
  • Show only key properties and methods — not every getter/setter.
  • Limit to ~15 classes per diagram. If more exist, show the core set and add %% 20+ classes omitted for readability.

gitGraph

  • Use for PR context: show the branch relationship, not every commit.
  • commit id:"abc1234" with abbreviated SHAs.
  • Maximum 2-3 branches per diagram. For complex histories, reference the full git log instead.
  • Consider whether a gitGraph truly clarifies — for a single-branch PR with 5 linear commits, text suffices.

sequenceDiagram

  • ->> for synchronous call, -->> for async/return.
  • +/- for activate/deactivate on same line: A->>+B: call() / B-->>-A: return.
  • Note over A,B: explanation for cross-participant notes.
  • Limit to ~8 participants per diagram.

stateDiagram-v2

  • [*] for initial/final states.
  • State1 --> State2: trigger for transitions.
  • Group states with state "Label" as Alias for complex labels.

4. Size and readability rules

  • Maximum 30 nodes per diagram (GitHub rendering degrades beyond this; also a comprehension ceiling for reviewers).
  • Maximum 50 edges per diagram.
  • Maximum 8 participants (sequenceDiagram) / 8 subgraphs (flowchart).
  • If the subject exceeds these limits, split into multiple diagrams — one per subsystem, layer, or concern.
  • Start simple, then layer. The first diagram in a PR shows the broad architecture; subsequent diagrams zoom into changed subsystems.

Size enforcement is critical — GitHub silently shows raw code for diagrams exceeding internal limits (~50KB definition text, ~500 edges). The agent MUST count nodes and edges and refuse to generate a diagram that exceeds these limits, splitting it instead.

5. Accessibility

Every diagram MUST include accessibility metadata as the first lines inside the ```mermaid block:

---
title: "Architecture overview"
---
flowchart TD

Or inline (alternative syntax for diagram types that support it):

%%{init: {'flowchart': {'htmlLabels': true}} }%%

Specifically:

  • accTitle: "descriptive title" — short, describes what the diagram shows.
  • accDescr: "one or two sentence description" — what the diagram conveys, for screen readers and mobile viewers who can't see the rendered SVG.

Place these inside the Mermaid frontmatter block (the --- delimited section at the top) so Mermaid renders them as SVG <title> and <desc> elements with ARIA attributes. GitHub preserves these.

6. Output

Inline mode (default)

Generate a ```mermaid fenced code block with the diagram definition. Precede it with a plain-text description (1-2 sentences) that explains what the diagram shows. This is the format for PR descriptions and markdown docs — GitHub renders the block natively.

The request flows through three layers before reaching storage:

```mermaid
---
title: "Request architecture"
accTitle: "Request architecture"
accDescr: "Client request flows through Router, Handler, then Store"
---
flowchart TD
    A[Client] --> B[Router]
    B --> C[Handler]
    C --> D[(Store)]
```

File mode (--render local)

The agent:

  1. Writes the Mermaid definition to a .mmd file in a temp location.
  2. Runs mmdc to render SVG/PNG:
    mmdc -i diagram.mmd -o diagram.svg [-t dark] [-b transparent]
  3. Reports the output path and describes the diagram contents.
  4. Cleans up the .mmd temp file unless --keep is specified.

File mode is for local preview, CI artifacts, or non-GitHub platforms. Most of the time, inline mode suffices — GitHub renders the ```mermaid block natively.

File mode fallback

If mmdc is not installed (command -v mmdc fails) and --render local was requested, fall back to inline mode and report: "Local rendering requested but mmdc not found. Generating inline Mermaid block instead — rendered by GitHub on push."

7. Integration with /pr

When /diagram is called from /pr, the scope is the PR's diff range. The agent:

  1. Reads the full diff (git diff <base>..HEAD) to understand what changed.
  2. Determines which diagram type(s) best communicate the change's shape:
    • Architecture/structural changes (files moved, modules extracted, new subsystem) → flowchart
    • Type/interface changes → classDiagram
    • History/branching → gitGraph
    • Data flow changes → flowchart or sequenceDiagram
  3. Generates the diagram(s). Each diagram must:
    • Be preceded by a plain-text description.
    • Have accTitle and accDescr for accessibility.
    • Focus on the changed parts, not the entire system.
  4. The pr skill embeds these inline in the PR description.

What pr, visuals, and assess do with diagrams

The installed visuals skill orchestrates what to show in pull requests and reviews—the Story, Delta, and review Focus—while this skill defines how to draw it: types, syntax, size caps, and accessibility. The pr skill uses it in authoring mode and assess uses it in review mode. All three keep diagrams focused on the change, capped, and preceded by plain-text descriptions.

8. Rules

  • Diagrams must be accurate. A misleading diagram is worse than none. If the codebase structure is too complex to represent faithfully within Mermaid's limits, say so and generate text instead.
  • No decorative diagrams. A visual for a single-file tweak, a format-only change, or a rename is noise. Apply the same bar as /pr: a diagram earns its place when a reviewer parses it faster than prose.
  • Size limits are hard. The agent counts nodes, edges, and nested subgraphs. If the limit would be exceeded, split into multiple diagrams or summarize in text. A diagram that silently fails to render on GitHub is worse than no diagram at all.
  • No tool attribution. Never add "Generated by AI" or credits anywhere near a diagram. The agent is the author.
  • Labels use project language. Use terms from Context/Glossary.md if it exists. Respect settled vocabulary.
  • Diagrams for Grove. When activated by the consolidate skill, follow that skill's bundled protocol: diagrams are first-class knowledge leaves and should be saved as .mmd files in the selected tree's Knowledge/ directory.

9. Anti-patterns

  • Auto-generating a diagram for every PR. Not every change needs a visual. Apply the viewer bar: "Would a reviewer who hasn't seen this branch parse the change faster from a diagram than from text?" If no, skip the diagram.
  • Showcasing the whole system. The diagram must focus on what changed. A full-architecture diagram with one highlighted path is noise — the reviewer needs to see the delta, not the static.
  • More than 3 diagrams per PR. Beyond three, the reviewer stops reading them. Pick the most important 1-3 views.
  • Skipping alt-text. accTitle/accDescr are mandatory. A diagram with no accessibility metadata is incomplete — the agent must include it.
  • Unvalidated Mermaid syntax. If uncertainty exists about whether a syntax form renders on GitHub (bleeding-edge feature, recently changed behavior), prefer a simpler, well-known form. When in doubt, flowchart is the safest type.
  • Using info or gantt diagrams. These add no value for codebase visualization. Stick to the types in §2.

10. Workflow

Before this command: the agent has context on what to visualize — a codebase to map, a PR diff to illustrate, or a discussion to make concrete.

After this command:

  • If the diagram was for a PR → the agent embeds the ```mermaid block in the PR description, and /pr continues with the rest of the summary.
  • If the diagram was standalone → the agent presents the block and waits for further direction.
  • If the diagram uncovered a code structure issue or suggestion → the agent flags it before continuing.
  • To preserve the session with diagram context → /handoff to checkpoint.

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.