Skills forcedotcom sf-skills

external-diagram-mermaid-generate

Use it when:
You need a diagram of a Salesforce system: an OAuth flow, an integration sequence, an object ERD, a role hierarchy or an Agentforce agent's topics and actions.
You get:
In its reply: a Mermaid code block to paste into GitHub or Confluence, an ASCII version when you want plain text, and notes on key relationships and assumptions.
Templates:
Seven Salesforce OAuth grant flows, fourteen data-model ERDs such as Sales Cloud, Service Cloud and Field Service, plus landscape, API-callout, agent and role templates.
Unlike general Mermaid skills:
This one names Salesforce objects by API name, knows its OAuth grant types and Agentforce's structure, and leaves other systems to other skills.
Reads your org:
Optionally, for an ERD: each object's record count, sharing default and type, through a bundled script that needs the sf CLI signed in to the org.
Preview:
Optionally saves the diagram to /tmp and starts a background Python server (macOS or Linux) that shows it in your browser, live-reloads and offers an SVG download.

Only for Salesforce systems: for anything else it tells the agent to use a general diagramming skill.

TL;DR

It draws Salesforce architecture as text-based diagrams, in its reply, ready to live in docs, READMEs or issues. The agent asks for or infers the diagram type, the systems or objects involved, whether you want Mermaid, ASCII or both, and how styled it should be. It then picks a structure: sequence diagrams for time-ordered exchanges such as OAuth or API callouts, flowcharts for ERDs, system landscapes, role hierarchies and Agentforce agent-to-topic-to-action maps. Before an OAuth diagram it loads the template for that grant type, such as authorization code with PKCE, JWT bearer or device flow, and before an ERD the matching data-model template. Its rules keep diagrams readable: numbered steps where order matters, few fields per object unless you ask, color only when it helps, a color-blind-friendly palette, and splitting a crowded ERD into sub-diagrams by domain. For a real org's ERD it can use the repo's object and field skills, or its own script, which flags objects over 2 million records and shows sharing defaults. For OAuth, Agentforce and Flow details it defers to the repo's matching skills. Each answer ends with a short explanation of the main relationships, flow direction and assumptions.

Summarizes the skill at 0c7cb93.

npx skills add https://github.com/forcedotcom/sf-skills --skill external-diagram-mermaid-generate
Total Downloads
5,600 on skills.sh, Nov 9, 2026
Repo stars
1,151 forcedotcom/sf-skills
First seen
Jun 26, 2026 on skills.sh
Weekly Downloads
53
-12% over the 8 weeks to Nov 9
Weekly values
Week toInstalls
Sep 2160
Sep 2856
Oct 557
Oct 1276
Oct 1960
Oct 2664
Nov 247
Nov 953
Category

Research reproduction, financial data, charts and diagrams.

Type

A multi-step process the agent follows: interview, debug, run a TDD loop, review.

Effect

Adds no side effects of its own. It shapes how the agent thinks, writes or reviews. Guidelines and routers are always effect:none, even when the task they support edits code.

Needs

Instructions only. Works in any agent that supports skills.

Publisher

A verified publisher on skills.sh, or the company or maintainer behind the product the skill operates.

Topics
Stack

SKILL.md

From forcedotcom/sf-skills at 0c7cb93. Checked daily, last changed Nov 7, 2026.

Frontmatter
name: external-diagram-mermaid-generate
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 asks about non-Salesforce systems."
metadata:
  version: "1.0"
  domains: ["External"]
  relatedSkills:
    - "agentforce-generate"
    - "automation-flow-generate"
    - "integration-connectivity-connected-app-configure"
    - "integration-connectivity-generate"
    - "platform-apex-generate"
    - "platform-custom-field-generate"
    - "platform-custom-object-generate"
    - "platform-data-manage"
    - "platform-metadata-deploy"
  cliTools:
    - tool: ["curl"]
      semver: ">=7.0.0"
    - tool: ["jq"]
      semver: ">=1.6.0"
    - tool: ["python"]
      semver: ">=3.10.0"
    - tool: ["python3"]
      semver: ">=3.10.0"
    - tool: ["sf"]
      semver: ">=2.0.0"

external-diagram-mermaid-generate: 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 external-diagram-mermaid-generate 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:

Supported Diagram Families

Type Preferred Mermaid form Typical use
OAuth / auth flows sequenceDiagram Authorization Code, JWT, PKCE, Device Flow
ERD / data model flowchart LR object relationships and sharing context
integration sequence sequenceDiagram request/response or event choreography
system landscape flowchart high-level architecture
role / access hierarchy flowchart users, profiles, permissions
Agentforce behavior map flowchart agent → 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:

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

Need Delegate to Reason
real object / field definitions platform-custom-object-generate / platform-custom-field-generate grounded ERD generation
connected-app auth setup context integration-connectivity-connected-app-configure accurate OAuth flows
Agentforce logic visualization agentforce-generate source-of-truth behavior details
Flow behavior diagrams automation-flow-generate actual Flow logic grounding

Gotchas

Issue Resolution
Mermaid renderer not available Provide ASCII fallback automatically; note that the Mermaid block still carries the diagram for copy-paste into a renderer
ERD becomes unreadable with too many objects Split into sub-diagrams by domain (Sales, Service, etc.) and link them in prose
Sequence diagram step order unclear Use autonumber directive to make step ordering explicit
OAuth flow actors differ by grant type Read 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

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