PluginBench
Skill
Pass
Audit score 90

generating-mermaid-diagrams

forcedotcom/sf-skills

Generate text-based Mermaid diagrams for Salesforce architecture, OAuth flows, ERDs, and integration sequences.

What is generating-mermaid-diagrams?

This skill creates Mermaid diagrams and ASCII fallbacks for Salesforce-specific visualizations including architecture, OAuth flows, entity-relationship diagrams, integration sequences, and Agentforce structure. Use it when you need text-based, markdown-friendly diagrams that can live in documentation, READMEs, or issues.

  • Generate Mermaid sequence diagrams for OAuth flows and integration choreography
  • Create flowchart ERDs and data model visualizations grounded in Salesforce objects
  • Produce system landscape and role/access hierarchy diagrams
  • Generate Agentforce behavior maps showing agent-topic-action relationships
  • Provide ASCII fallback versions for terminal and plaintext documentation compatibility
  • Support multiple diagram families: OAuth, ERD, integration sequence, system landscape, role hierarchy, and Agentforce behavior

How to install generating-mermaid-diagrams

npx skills add https://github.com/forcedotcom/sf-skills --skill generating-mermaid-diagrams
Prerequisites
  • Mermaid-capable renderer for diagram previews (browser, VS Code extension, or local preview server)
Claude Code
Cursor
Windsurf
Cline

How to use generating-mermaid-diagrams

  1. 1.Identify the diagram type needed (sequence, flowchart, ERD, etc.) and gather scope/entities involved
  2. 2.Specify output preference: Mermaid only, ASCII only, or both
  3. 3.For ERDs, optionally use the query-org-metadata.py script to ground diagrams in actual org schema
  4. 4.Generate the Mermaid diagram using appropriate syntax (sequenceDiagram for flows, flowchart LR for ERDs)
  5. 5.Add ASCII fallback version if plaintext compatibility is needed
  6. 6.Include brief notes explaining key relationships, flow direction, and assumptions

Use cases

Good for
  • Visualize Authorization Code, JWT Bearer, PKCE, or Device Flow OAuth grants for connected apps
  • Document Salesforce data model relationships and object dependencies in architecture docs
  • Map integration sequences and request/response choreography between systems
  • Create role and permission hierarchy diagrams for access control documentation
  • Generate Agentforce topic and action flow diagrams for agent behavior documentation
Who it's for
  • Salesforce architects designing system landscapes and data models
  • Integration engineers documenting OAuth flows and system interactions
  • Developers creating technical documentation and README files
  • Agentforce developers visualizing agent behavior and topic structures
  • Technical writers embedding diagrams directly in markdown documentation

generating-mermaid-diagrams FAQ

When should I use this skill vs. generating-visual-diagrams?

Use generating-mermaid-diagrams for text-based Mermaid output that lives in markdown, docs, or code. Use generating-visual-diagrams when you need rendered PNG/SVG images or polished visual mockups.

Can I generate ERDs from my actual Salesforce org?

Yes. Use the included query-org-metadata.py script to query your org schema and ground the ERD generation in real object and relationship data.

What if the Mermaid renderer isn't available?

Provide an ASCII fallback automatically. The Mermaid block still carries the diagram syntax for copy-paste into any Mermaid renderer.

How do I handle complex ERDs with many objects?

Split into sub-diagrams by domain (Sales, Service, etc.) and link them in prose. Keep individual diagrams readable by avoiding object overload.

Are there templates for OAuth flows?

Yes. The skill includes OAuth flow templates for Authorization Code, PKCE, JWT Bearer, Client Credentials, Device Flow, Refresh Token, and User-Agent/Social Sign-On flows.

Full instructions (SKILL.md)

Source of truth, from forcedotcom/sf-skills.


name: generating-mermaid-diagrams description: "Salesforce architecture diagrams using Mermaid with ASCII fallback. Use this skill when generating text-based diagrams for Salesforce architecture, OAuth flows, ERDs, integration sequences, or Agentforce structure. TRIGGER when: user says "diagram", "visualize", "ERD", or asks for sequence diagrams, flowcharts, class diagrams, or architecture visualizations in Mermaid. DO NOT TRIGGER when: user wants PNG/SVG image output (use generating-visual-diagrams), or asks about non-Salesforce systems." compatibility: "Requires Mermaid-capable renderer for diagram previews" metadata: version: "1.0"

generating-mermaid-diagrams: Salesforce Diagram Generation

Use this skill when the user needs text-based diagrams: Mermaid diagrams for architecture, OAuth, integration flows, ERDs, or Agentforce structure, plus ASCII fallback when plain-text compatibility matters.

Scope

In Scope

Use generating-mermaid-diagrams when the user wants:

  • Mermaid output
  • ASCII fallback diagrams
  • architecture, sequence, flowchart, or ERD views in markdown-friendly form
  • diagrams that can live directly in docs, READMEs, or issues

Out of Scope — Delegate elsewhere when the user wants:

  • rendered PNG/SVG images or polished mockups → generating-visual-diagrams
  • non-Salesforce systems only → use a more general diagramming skill
  • object discovery before an ERD → generating-custom-object or generating-custom-field

Supported Diagram Families

TypePreferred Mermaid formTypical use
OAuth / auth flowssequenceDiagramAuthorization Code, JWT, PKCE, Device Flow
ERD / data modelflowchart LRobject relationships and sharing context
integration sequencesequenceDiagramrequest/response or event choreography
system landscapeflowcharthigh-level architecture
role / access hierarchyflowchartusers, profiles, permissions
Agentforce behavior mapflowchartagent → topic → action relationships

Required Context to Gather First

Ask for or infer:

  • diagram type
  • scope and entities / systems involved
  • output preference: Mermaid only, ASCII only, or both
  • whether styling should be minimal, documentation-first, or presentation-friendly
  • for ERDs: whether org metadata is available for grounding

Recommended Workflow

1. Pick the right diagram structure

  • use sequenceDiagram for time-ordered interactions
  • use flowchart LR for ERDs and capability maps
  • keep a single primary story per diagram when possible

2. Gather data

For ERDs and grounded diagrams:

  • use generating-custom-object or generating-custom-field when real schema discovery is needed
  • optionally use the local metadata helper script for counts / relationship context when appropriate

3. Generate Mermaid first

Apply:

  • accurate labels
  • simple readable node text
  • consistent relationship notation
  • restrained styling that renders cleanly in markdown viewers

4. Add ASCII fallback when useful

Provide an ASCII version when the user wants terminal compatibility or plaintext documentation.

5. Explain the diagram briefly

Call out the key relationships, flow direction, and any assumptions.


High-Signal Rules

For sequence diagrams

  • use autonumber when step order matters
  • distinguish requests vs responses clearly
  • use notes sparingly for protocol detail

For ERDs

  • prefer flowchart LR
  • keep object cards simple
  • use clear relationship arrows
  • avoid field overload unless the user explicitly asks for field-level detail
  • color-code object types only when it improves readability

For ASCII output

  • keep width reasonable
  • align arrows and boxes consistently
  • optimize for readability over decoration

Output Format

## <Diagram Title>

### Mermaid Diagram
```mermaid
<diagram>
```

### ASCII Fallback
```text
<ascii>
```

### Notes
- <key point>
- <assumption or limitation>

Cross-Skill Integration

NeedDelegate toReason
real object / field definitionsgenerating-custom-object / generating-custom-fieldgrounded ERD generation
rendered diagram / image outputgenerating-visual-diagramsvisual polish beyond Mermaid
connected-app auth setup contextconfiguring-connected-appsaccurate OAuth flows
Agentforce logic visualizationdeveloping-agentforcesource-of-truth behavior details
Flow behavior diagramsgenerating-flowactual Flow logic grounding

Gotchas

IssueResolution
Mermaid renderer not availableProvide ASCII fallback automatically; note that the Mermaid block still carries the diagram for copy-paste into a renderer
ERD becomes unreadable with too many objectsSplit into sub-diagrams by domain (Sales, Service, etc.) and link them in prose
Sequence diagram step order unclearUse autonumber directive to make step ordering explicit
OAuth flow actors differ by grant typeRead the relevant asset template first before generating to avoid actor mismatch

Reference File Index

Conventions & rules — read before generating

Styling

Preview

OAuth flow templates — load the matching template when generating OAuth diagrams

Data model ERD templates — load the matching template when generating ERDs

Other diagram templates


Output Expectations

Deliverables produced by this skill for each request:

  • Mermaid code block — fenced ```mermaid block ready to paste into GitHub, Confluence, or any Mermaid-capable renderer
  • ASCII fallback (when requested or when Mermaid renderer is unavailable) — text-only diagram using box/arrow characters
  • Brief explanation — 2-5 bullet points calling out key relationships, flow direction, and any assumptions or limitations in the diagram
  • For ERDs: object cards with field labels and relationship type annotations
  • For sequence diagrams: numbered steps (autonumber) with clear actor labels

Score Guide

ScoreMeaning
72–80production-ready diagram
60–71clear and useful with minor polish left
48–59functional but could be clearer
35–47needs structural improvement
< 35inaccurate or incomplete