$npx -y skills add forcedotcom/sf-skills --skill external-diagram-mermaid-generateSalesforce 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 a
| 1 | # external-diagram-mermaid-generate: Salesforce Diagram Generation |
| 2 | |
| 3 | 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. |
| 4 | |
| 5 | ## Scope |
| 6 | |
| 7 | ### In Scope |
| 8 | Use `external-diagram-mermaid-generate` when the user wants: |
| 9 | - Mermaid output |
| 10 | - ASCII fallback diagrams |
| 11 | - architecture, sequence, flowchart, or ERD views in markdown-friendly form |
| 12 | - diagrams that can live directly in docs, READMEs, or issues |
| 13 | |
| 14 | ### Out of Scope — Delegate elsewhere when the user wants: |
| 15 | - non-Salesforce systems only → use a more general diagramming skill |
| 16 | - object discovery before an ERD → [platform-custom-object-generate](../platform-custom-object-generate/SKILL.md) or [platform-custom-field-generate](../platform-custom-field-generate/SKILL.md) |
| 17 | |
| 18 | --- |
| 19 | |
| 20 | ## Supported Diagram Families |
| 21 | |
| 22 | | Type | Preferred Mermaid form | Typical use | |
| 23 | |---|---|---| |
| 24 | | OAuth / auth flows | `sequenceDiagram` | Authorization Code, JWT, PKCE, Device Flow | |
| 25 | | ERD / data model | `flowchart LR` | object relationships and sharing context | |
| 26 | | integration sequence | `sequenceDiagram` | request/response or event choreography | |
| 27 | | system landscape | `flowchart` | high-level architecture | |
| 28 | | role / access hierarchy | `flowchart` | users, profiles, permissions | |
| 29 | | Agentforce behavior map | `flowchart` | agent → topic → action relationships | |
| 30 | |
| 31 | --- |
| 32 | |
| 33 | ## Required Context to Gather First |
| 34 | |
| 35 | Ask for or infer: |
| 36 | - diagram type |
| 37 | - scope and entities / systems involved |
| 38 | - output preference: Mermaid only, ASCII only, or both |
| 39 | - whether styling should be minimal, documentation-first, or presentation-friendly |
| 40 | - for ERDs: whether org metadata is available for grounding |
| 41 | |
| 42 | --- |
| 43 | |
| 44 | ## Recommended Workflow |
| 45 | |
| 46 | ### 1. Pick the right diagram structure |
| 47 | - use `sequenceDiagram` for time-ordered interactions |
| 48 | - use `flowchart LR` for ERDs and capability maps |
| 49 | - keep a single primary story per diagram when possible |
| 50 | |
| 51 | ### 2. Gather data |
| 52 | For ERDs and grounded diagrams: |
| 53 | - use [platform-custom-object-generate](../platform-custom-object-generate/SKILL.md) or [platform-custom-field-generate](../platform-custom-field-generate/SKILL.md) when real schema discovery is needed |
| 54 | - optionally use the local metadata helper script for counts / relationship context when appropriate |
| 55 | |
| 56 | ### 3. Generate Mermaid first |
| 57 | Apply: |
| 58 | - accurate labels |
| 59 | - simple readable node text |
| 60 | - consistent relationship notation |
| 61 | - restrained styling that renders cleanly in markdown viewers |
| 62 | |
| 63 | ### 4. Add ASCII fallback when useful |
| 64 | Provide an ASCII version when the user wants terminal compatibility or plaintext documentation. |
| 65 | |
| 66 | ### 5. Explain the diagram briefly |
| 67 | Call out the key relationships, flow direction, and any assumptions. |
| 68 | |
| 69 | --- |
| 70 | |
| 71 | ## High-Signal Rules |
| 72 | |
| 73 | ### For sequence diagrams |
| 74 | - use `autonumber` when step order matters |
| 75 | - distinguish requests vs responses clearly |
| 76 | - use notes sparingly for protocol detail |
| 77 | |
| 78 | ### For ERDs |
| 79 | - prefer `flowchart LR` |
| 80 | - keep object cards simple |
| 81 | - use clear relationship arrows |
| 82 | - avoid field overload unless the user explicitly asks for field-level detail |
| 83 | - color-code object types only when it improves readability |
| 84 | |
| 85 | ### For ASCII output |
| 86 | - keep width reasonable |
| 87 | - align arrows and boxes consistently |
| 88 | - optimize for readability over decoration |
| 89 | |
| 90 | --- |
| 91 | |
| 92 | ## Output Format |
| 93 | |
| 94 | ````markdown |
| 95 | ## <Diagram Title> |
| 96 | |
| 97 | ### Mermaid Diagram |
| 98 | ```mermaid |
| 99 | <diagram> |
| 100 | ``` |
| 101 | |
| 102 | ### ASCII Fallback |
| 103 | ```text |
| 104 | <ascii> |
| 105 | ``` |
| 106 | |
| 107 | ### Notes |
| 108 | - <key point> |
| 109 | - <assumption or limitation> |
| 110 | ```` |
| 111 | |
| 112 | --- |
| 113 | |
| 114 | ## Cross-Skill Integration |
| 115 | |
| 116 | | Need | Delegate to | Reason | |
| 117 | |---|---|---| |
| 118 | | real object / field definitions | [platform-custom-object-generate](../platform-custom-object-generate/SKILL.md) / [platform-custom-field-generate](../platform-custom-field-generate/SKILL.md) | grounded ERD generation | |
| 119 | | connected-app auth setup context | [integration-connectivity-connected-app-configure](../integration-connectivity-connected-app-configure/SKILL.md) | accurate OAuth flows | |
| 120 | | Agentforce logic visualization | [agentforce-generate](../agentforce-generate/SKILL.md) | source-of-truth behavior details | |
| 121 | | Flow behavior diagrams | [automation-flow-generate](../automation-flow-generate/SKILL.md) | actual Flow logic grounding | |
| 122 | |
| 123 | --- |
| 124 | |
| 125 | ## Gotchas |
| 126 | |
| 127 | | Issue | Resolution | |
| 128 | |---|---| |
| 129 | | Mermaid renderer not available | Provide ASCII fallback automatically; note that the Mermaid block still carries |