Loading...
Loading...
Creates Salesforce architecture diagrams using Mermaid with ASCII fallback. Use when visualizing OAuth flows, data models (ERDs), integration sequences, system landscapes, role hierarchies, or Agentforce agent architectures.
npx skill4agent add jaganpro/sf-skills sf-diagram-mermaid| Type | Mermaid Syntax | Use Case |
|---|---|---|
| OAuth Flows | | Authorization Code, JWT Bearer, PKCE, Device Flow |
| Data Models | | Object relationships with color coding (preferred) |
| Integration Sequences | | API callouts, event-driven flows |
| System Landscapes | | High-level architecture, component diagrams |
| Role Hierarchies | | User hierarchies, profile/permission structures |
| Agentforce Flows | | Agent → Topic → Action flows |
| Diagram Type | Template File |
|---|---|
| Authorization Code Flow | |
| Authorization Code + PKCE | |
| JWT Bearer Flow | |
| Client Credentials Flow | |
| Device Authorization Flow | |
| Refresh Token Flow | |
| Data Model (ERD) | |
| Integration Sequence | |
| System Landscape | |
| Role Hierarchy | |
| Agentforce Flow | |
~/.claude/plugins/marketplaces/sf-skills/sf-diagram-mermaid/assets/[template][project-root]/sf-diagram-mermaid/assets/[template]~/.claude/plugins/cache/sf-diagram-mermaid/*/sf-diagram-mermaid/assets/[template]Read: ~/.claude/plugins/marketplaces/sf-skills/sf-diagram-mermaid/assets/oauth/jwt-bearer.mdpython3 scripts/query-org-metadata.py --objects Account,Contact --target-org myorgflowchart LRreferences/color-palette.mdflowchart LR┌ ─ ┐ │ └ ┘ ├ ┤ ┬ ┴ ┼──><──────┼─Score: XX/80 ⭐⭐⭐⭐ Rating
├─ Accuracy: XX/20 (Correct actors, flow steps, relationships)
├─ Clarity: XX/20 (Easy to read, proper labeling)
├─ Completeness: XX/15 (All relevant steps/entities included)
├─ Styling: XX/15 (Color scheme, theming, annotations)
└─ Best Practices: XX/10 (Proper notation, UML conventions)## 📊 [Diagram Title]
### Mermaid Diagram
```mermaid
[Generated Mermaid code]
```
### ASCII Fallback
```
[Generated ASCII diagram]
```
### Key Points
- [Important note 1]
- [Important note 2]
### Diagram Score
[Validation results]%%{init: {"flowchart": {"nodeSpacing": 80, "rankSpacing": 70}} }%%
style A fill:#fbcfe8,stroke:#be185d,color:#1f2937| Rating | Score | Meaning |
|---|---|---|
| ⭐⭐⭐⭐⭐ Excellent | 72-80 | Production-ready, comprehensive, well-styled |
| ⭐⭐⭐⭐ Very Good | 60-71 | Complete with minor improvements possible |
| ⭐⭐⭐ Good | 48-59 | Functional but could be clearer |
| ⭐⭐ Needs Work | 35-47 | Missing key elements or unclear |
| ⭐ Critical Issues | <35 | Inaccurate or incomplete |
| Flow | Use Case | Key Detail | Template |
|---|---|---|---|
| Authorization Code | Web apps with backend | User → Browser → App → SF | |
| Auth Code + PKCE | Mobile, SPAs, public clients | code_verifier + SHA256 challenge | |
| JWT Bearer | Server-to-server, CI/CD | Sign JWT with private key | |
| Client Credentials | Service accounts, background | No user context | |
| Device Authorization | CLI, IoT, Smart TVs | Poll for token after user auth | |
| Refresh Token | Extend access | Reuse existing tokens | |
assets/oauth/flowchart LRflowchart LR==>--> Lookup (LK) - optional parent, no cascade delete
==> Master-Detail (MD) - required parent, cascade delete
-.-> Conversion/special relationship (e.g., Lead converts)ObjectName["ObjectName<br/>(record count)"]Account["Account<br/>(317)"]| Object Type | Color | Fill | Stroke |
|---|---|---|---|
| Standard Objects | Sky Blue | | |
Custom Objects ( | Orange | | |
External Objects ( | Green | | |
python3 ~/.claude/plugins/marketplaces/sf-skills/sf-diagram-mermaid/scripts/query-org-metadata.py \
--objects Account,Contact,Opportunity \
--target-org myorgLDV[~4M]OWD:PrivateOWD:ReadWriteOWD:Parent| Label | Type | Arrow Style | Behavior |
|---|---|---|---|
| Lookup | | Optional parent, no cascade |
| Master-Detail | | Required parent, cascade delete |
-->==>| Template | Objects | Path |
|---|---|---|
| Core | Account, Contact, Opportunity, Case | |
| Sales Cloud | Account, Contact, Lead, Opportunity, Product, Campaign | |
| Service Cloud | Case, Entitlement, Knowledge, ServiceContract | |
| Campaigns | Campaign, CampaignMember, CampaignInfluence | |
| Territory Management | Territory2, Territory2Model, UserTerritory2Association | |
| Party Model | AccountContactRelation, ContactContactRelation | |
| Quote & Order | Quote, QuoteLineItem, Order, OrderItem | |
| Forecasting | ForecastingItem, ForecastingQuota, OpportunitySplit | |
| Consent (GDPR) | Individual, ContactPointEmail, DataUsePurpose | |
| Files | ContentDocument, ContentVersion, ContentDocumentLink | |
| Scheduler | ServiceAppointment, ServiceResource, ServiceTerritory | |
| Field Service | WorkOrder, ServiceAppointment, TimeSheet | |
| B2B Commerce | WebStore, WebCart, BuyerGroup, BuyerAccount | |
| Revenue Cloud | ProductCatalog, ProductSellingModel, PriceAdjustment | |
references/erd-conventions.md[STD][CUST][EXT]autonumber->>-->>activatedeactivateboxNote overflowchart LR-->==>Accountaltelse-)| Skill | When to Use | Example |
|---|---|---|
| sf-metadata | Get real object/field definitions for ERD | Use the sf-metadata skill: "Describe Lead object" |
| sf-connected-apps | Link OAuth flow to Connected App setup | "Generate JWT Bearer diagram for this Connected App" |
| sf-ai-agentscript | Visualize Agentforce agent architecture | "Create flow diagram for FAQ Agent" |
| sf-flow | Document Flow logic as flowchart | "Diagram the approval process flow" |
User: "Create a JWT Bearer OAuth flow diagram"
You should:
1. Load assets/oauth/jwt-bearer.md
2. Generate Mermaid sequenceDiagram
3. Generate ASCII fallback
4. Score and deliverUser: "Create an ERD for Account, Contact, Opportunity, and Case"
You should:
1. If org connected: Query record counts via query-org-metadata.py
2. Load assets/datamodel/salesforce-erd.md (or cloud-specific template)
3. Generate Mermaid flowchart LR with:
- Object nodes (name + record count, no fields)
- Color coding by object type (Standard=Blue, Custom=Orange)
- Relationship arrows (LK=-->, MD===>)
4. Generate ASCII fallback
5. Score and deliverUser: "Diagram our Salesforce to SAP integration flow"
You should:
1. Ask clarifying questions (sync/async, trigger, protocol)
2. Load assets/integration/api-sequence.md
3. Generate Mermaid sequenceDiagram
4. Generate ASCII fallback
5. Score and deliver