
generating-mermaid-diagrams
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.
- Installs
- 2.8K
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/forcedotcom/sf-skills --skill generating-mermaid-diagrams- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads generating-mermaid-diagrams automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
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
| 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
sequenceDiagramfor time-ordered interactions - use
flowchart LRfor 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
autonumberwhen 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 | generating-custom-object / generating-custom-field | grounded ERD generation |
| rendered diagram / image output | generating-visual-diagrams | visual polish beyond Mermaid |
| connected-app auth setup context | configuring-connected-apps | accurate OAuth flows |
| Agentforce logic visualization | developing-agentforce | source-of-truth behavior details |
| Flow behavior diagrams | generating-flow | 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
- references/diagram-conventions.md — consistency rules for all diagram types
- references/mermaid-reference.md — Mermaid syntax quick reference
- references/usage-examples.md — worked examples per diagram type
Styling
- references/mermaid-styling.md — theming and annotation patterns
- references/color-palette.md — color-blind-friendly palette with hex values
- references/erd-conventions.md — ERD-specific layout and notation rules
Preview
- references/preview-guide.md — how to render Mermaid locally
- scripts/README.md — setup and usage instructions for all scripts in this skill
- scripts/mermaid_preview.py — live-reload preview server; run to preview diagrams in browser
- scripts/query-org-metadata.py — queries org schema to ground ERD generation
OAuth flow templates — load the matching template when generating OAuth diagrams
- assets/oauth/authorization-code.md — Authorization Code grant
- assets/oauth/authorization-code-pkce.md — PKCE variant for mobile/SPA
- assets/oauth/jwt-bearer.md — JWT Bearer server-to-server
- assets/oauth/client-credentials.md — Client Credentials service accounts
- assets/oauth/device-authorization.md — Device Flow for CLI/IoT
- assets/oauth/refresh-token.md — Refresh Token renewal flow
- assets/oauth/user-agent-social-sign-on.md — User-Agent / Social Sign-On
Data model ERD templates — load the matching template when generating ERDs
- assets/datamodel/salesforce-erd.md — core Salesforce objects
- assets/datamodel/sales-cloud-erd.md — Sales Cloud objects
- assets/datamodel/service-cloud-erd.md — Service Cloud objects
- assets/datamodel/b2b-commerce-erd.md — B2B Commerce objects
- assets/datamodel/campaigns-erd.md — Campaigns and campaign member model
- assets/datamodel/consent-erd.md — Consent and privacy objects
- assets/datamodel/files-erd.md — Files and ContentDocument model
- assets/datamodel/forecasting-erd.md — Forecasting objects
- assets/datamodel/fsl-erd.md — Field Service Lightning objects
- assets/datamodel/party-model-erd.md — Party model objects
- assets/datamodel/quote-order-erd.md — Quote and Order objects
- assets/datamodel/revenue-cloud-erd.md — Revenue Cloud objects
- assets/datamodel/scheduler-erd.md — Scheduler objects
- assets/datamodel/territory-management-erd.md — Territory Management objects
Other diagram templates
- assets/architecture/system-landscape.md — system landscape overview template
- assets/integration/api-sequence.md — API callout sequence template
- assets/agentforce/agent-flow.md — Agentforce agent → topic → action flow
- assets/role-hierarchy/user-hierarchy.md — role and permission hierarchy template
Output Expectations
Deliverables produced by this skill for each request:
- Mermaid code block — fenced
```mermaidblock 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 |
FAQ
What does the generating-mermaid-diagrams skill do?
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.
How do I install generating-mermaid-diagrams?
Run npx skills add https://github.com/forcedotcom/sf-skills --skill generating-mermaid-diagrams in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/generating-mermaid-diagrams/ (personal) or .claude/skills/generating-mermaid-diagrams/ (project).
Which AI agents can use generating-mermaid-diagrams?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is generating-mermaid-diagrams safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains generating-mermaid-diagrams?
It is published by forcedotcom in forcedotcom/sf-skills. It has 2,821 recorded installs.
More from forcedotcom/sf-skills
platform-apex-generate
forcedotcom/sf-skills
Primary Apex authoring skill for class generation, refactoring, and review. ALWAYS ACTIVATE when the user mentions Apex, .cls, triggers, or asks to create/refactor a class (service, selector, domain, batch, queueable, schedulable, invocable, DTO, utility, interface, abstract, exception, REST resource). Use this skill for requests involving SObject CRUD, mapping collections, fetching related records, scheduled jobs, batch jobs, trigger design, @AuraEnabled controllers, @RestResource endpoints, custom REST APIs, or code review of existing Apex.
platform-apex-test-generate
forcedotcom/sf-skills
Use to generate and validate Apex test classes with TestDataFactory patterns, bulk testing (251+ records), mocking, assertions, and disciplined test-fix loops. Use when creating Apex test classes (for triggers, services, controllers, batch jobs, queueables, and callouts), improving coverage, debugging or fixing failing Apex tests, or running test/coverage analysis. Triggers on Test.cls files, sf apex run test, coverage reports. Do NOT trigger for production Apex (use platform-apex-generate) or Jest/LWC tests.
platform-apex-test-run
forcedotcom/sf-skills
Apex test execution, coverage analysis, and test-fix loops with 120-point scoring. Use when the user runs Apex tests, checks code coverage, fixes failing tests, or touches Test.cls / Test.cls files. DO NOT TRIGGER when writing Apex production code (use platform-apex-generate), Agentforce agent testing (use agentforce-test), or Jest/LWC tests (use experience-lwc-generate).
platform-apex-logs-debug
forcedotcom/sf-skills
Salesforce debug log analysis and troubleshooting with 100-point scoring. TRIGGER when: user analyzes debug logs, hits governor limits, reads stack traces, or touches .log files from Salesforce orgs. DO NOT TRIGGER when: running Apex tests (use platform-apex-test-run), generating or fixing Apex code (use platform-apex-generate), or Agentforce session tracing (use agentforce-observe).
platform-soql-query
forcedotcom/sf-skills
Use when the user needs SOQL/SOSL authoring or optimization: natural-language-to-query generation, relationship queries, aggregates, query-plan/selectivity analysis, and performance or safety improvements. TRIGGER when the user writes, optimizes, or debugs SOQL/SOSL, touches .soql files, or asks about relationship queries, aggregates, or query performance. DO NOT TRIGGER for bulk data operations (use platform-data-manage), Apex DML logic (use platform-apex-generate), or report/dashboard queries.
platform-metadata-deploy
forcedotcom/sf-skills
Salesforce DevOps automation using sf CLI v2. TRIGGER when: user deploys metadata, validates a deploy or does a dry-run, deploys to a Production org, quick-deploys a validated job ID, ships/promotes to prod, creates/manages scratch orgs or sandboxes, sets up CI/CD pipelines, or troubleshoots deployment errors with sf project deploy. DO NOT TRIGGER when: writing Apex code, building LWC components (use experience-lwc-generate), creating metadata definitions (use platform-custom-object-generate), deleting metadata from an org (use platform-destructive-deploy), or querying org data (use platform-data-manage).
Popular docs & writing skills
grill-with-docs
mattpocock/skills
A relentless interview to sharpen a plan or design, which also creates docs (ADR's and glossary) as we go.
lark-markdown
open.feishu.cn
飞书 Markdown:查看、创建、上传、编辑和比较飞书中的原生 Markdown 文件。当用户要操作飞书 Markdown 文件,或比较其远端版本及本地草稿时使用。纯本地 Markdown 文件操作不触发本 skill。不负责将 Markdown 导入为飞书在线文档,也不负责文件搜索、权限、评论、移动、删除等云空间管理操作。
writing-beats
mattpocock/skills
Writing, exploit; assemble raw material into a journey of beats, grounding each term before a beat leans on it.
writing-shape
mattpocock/skills
Writing, exploit: shape raw material into an article, paragraph by paragraph.
writing-fragments
mattpocock/skills
Writing, explore: mine raw fragments, no structure yet.
writing-for-agents
mattpocock/skills
Writing documents for agents. Use when creating or editing skills, or modifying AGENTS.md or CLAUDE.md.