PluginBench
Skill
Pass
Audit score 90

external-diagram-mermaid-generate

forcedotcom/sf-skills

Generate Salesforce architecture diagrams in Mermaid with ASCII fallback for docs and terminals.

What is external-diagram-mermaid-generate?

Creates text-based diagrams for Salesforce systems: OAuth flows, ERDs, integration sequences, and Agentforce structure. Use this when you need markdown-friendly visualizations that render in docs, READMEs, or plain-text environments.

  • Generate Mermaid diagrams for OAuth flows, ERDs, sequence diagrams, and system architecture
  • Provide ASCII fallback versions for terminal and plaintext compatibility
  • Support multiple diagram types: flowcharts, sequence diagrams, and entity-relationship diagrams
  • Integrate with org metadata discovery for grounded ERD generation
  • Apply diagram conventions and color-blind-friendly styling automatically

How to install external-diagram-mermaid-generate

npx skills add https://github.com/forcedotcom/sf-skills --skill external-diagram-mermaid-generate
Prerequisites
  • curl (≥7.0.0)
  • jq (≥1.6.0)
  • Python (≥3.10.0)
  • Salesforce CLI (≥2.0.0)
Claude Code
Cursor
Windsurf
Cline

How to use external-diagram-mermaid-generate

  1. 1.Specify the diagram type needed (sequence, flowchart, ERD, etc.) and scope
  2. 2.Provide entities, systems, or objects to include in the diagram
  3. 3.Indicate output preference: Mermaid only, ASCII only, or both
  4. 4.For ERDs, optionally query org metadata using the provided script for grounded generation
  5. 5.Review the generated Mermaid and ASCII diagrams; copy Mermaid blocks into docs or renderers

Use cases

Good for
  • Visualize OAuth authorization flows (Authorization Code, JWT Bearer, PKCE, Device Flow) for integration documentation
  • Create entity-relationship diagrams showing Salesforce object relationships and data model structure
  • Map integration sequences and request/response choreography between systems
  • Document Agentforce behavior and topic-to-action relationships
  • Generate system landscape and role/access hierarchy diagrams for architecture documentation
Who it's for
  • Salesforce architects designing system integrations and data models
  • Integration engineers documenting OAuth flows and API interactions
  • Agentforce developers visualizing agent behavior and decision logic
  • Technical writers creating architecture and process documentation
  • Teams needing markdown-compatible diagrams for GitHub, Confluence, or READMEs

external-diagram-mermaid-generate FAQ

When should I use this skill vs. a general diagramming tool?

Use this skill for Salesforce-specific diagrams (OAuth flows, ERDs, Agentforce logic, integration sequences). For non-Salesforce systems, delegate to a general diagramming skill.

Can I use these diagrams in my documentation?

Yes. Mermaid blocks render natively in GitHub, GitLab, Confluence, and many markdown viewers. ASCII versions work in any plaintext environment including terminals and email.

How do I get accurate object relationships for an ERD?

Use the provided query-org-metadata.py script to discover real objects and relationships from your org, or delegate to platform-custom-object-generate for detailed field-level discovery.

What if my Mermaid renderer doesn't support a diagram type?

The skill automatically provides an ASCII fallback. The Mermaid block remains valid for copy-paste into online renderers or local preview tools.

Can I customize colors and styling?

Yes. The skill includes color-blind-friendly palettes and styling conventions in references/mermaid-styling.md; apply these for consistent, accessible diagrams.

Full instructions (SKILL.md)

Source of truth, from forcedotcom/sf-skills.


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: 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" 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" version: "1.0" domains: ["External"]

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:

  • non-Salesforce systems only → use a more general diagramming skill
  • object discovery before an ERD → platform-custom-object-generate or platform-custom-field-generate

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 platform-custom-object-generate or platform-custom-field-generate 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 definitionsplatform-custom-object-generate / platform-custom-field-generategrounded ERD generation
connected-app auth setup contextintegration-connectivity-connected-app-configureaccurate OAuth flows
Agentforce logic visualizationagentforce-generatesource-of-truth behavior details
Flow behavior diagramsautomation-flow-generateactual 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