
Sf Diagram
Generate consistent Salesforce architecture and data-model diagrams in Mermaid or ASCII from reusable ERD and pattern templates.
Install
npx skills add https://github.com/clientell-ai/salesforce-skills --skill sf-diagramWhat is this skill?
- Reusable Mermaid ERD templates for standard Sales Cloud objects (Account, Contact, Opportunity, Case, Lead, products)
- Custom object patterns such as master-detail junction models (e.g., Project__c / Project_Member__c)
- ASCII and Mermaid syntax reference for Salesforce architecture diagrams
- Copy-paste entity relationship blocks with typed fields (Id PK, FK, picklist, currency)
- Designed as a diagram reference companion to broader Salesforce build skills
Adoption & trust: 1 installs on skills.sh; 7 GitHub stars; 3/3 security scanners passed (skills.sh audits); trending (+100% hot-view momentum).
Recommended Skills
Journey fit
Build/docs is the primary shelf because the skill outputs diagram syntax and reference models for teammates and stakeholders—not runtime Salesforce code. Docs subphase fits architecture diagrams, ERD templates, and syntax examples that document Sales Cloud and custom object relationships.
Common Questions / FAQ
Is Sf Diagram safe to install?
skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.
SKILL.md
READMESKILL.md - Sf Diagram
# Diagram Reference: Templates, Examples & Syntax Reusable templates and patterns for generating Salesforce architecture diagrams in Mermaid and ASCII. --- ## ERD Templates ### Standard Sales Cloud Data Model ```mermaid erDiagram Account ||--o{ Contact : "has" Account ||--o{ Opportunity : "has" Account ||--o{ Case : "has" Contact ||--o{ Case : "opened by" Opportunity ||--|{ OpportunityLineItem : "contains" Opportunity ||--o{ OpportunityContactRole : "involves" Contact ||--o{ OpportunityContactRole : "plays role" Opportunity }o--|| Pricebook2 : "uses" Product2 ||--|{ PricebookEntry : "listed in" OpportunityLineItem }o--|| PricebookEntry : "references" Lead ||--o| Account : "converts to" Lead ||--o| Contact : "converts to" Account { Id Id PK string Name string Industry } Contact { Id Id PK Id AccountId FK string LastName string Email } Opportunity { Id Id PK Id AccountId FK string StageName currency Amount } Case { Id Id PK Id AccountId FK Id ContactId FK string Status } ``` ### Custom Object Junction Pattern ```mermaid erDiagram Project__c ||--|{ Project_Member__c : "has members" Contact ||--|{ Project_Member__c : "assigned to" Project_Member__c { Id Project__c FK "Master-Detail" Id Contact__c FK "Master-Detail" picklist Role__c } ``` --- ## Class Diagram Templates ### Trigger Handler Pattern ```mermaid classDiagram class TriggerHandler { <<abstract>> +run() void +beforeInsert() void +afterUpdate() void } class AccountTriggerHandler { +beforeInsert() void -validateIndustry(List~Account~) void } TriggerHandler <|-- AccountTriggerHandler : extends AccountTriggerHandler --> AccountService : delegates to ``` ### Service-Selector-Domain Pattern ```mermaid classDiagram class AccountService { +getAccountsByIds(Set~Id~) List~Account~ +mergeAccounts(Id, List~Id~) MergeResult } class AccountSelector { +selectById(Set~Id~) List~Account~ +selectWithContacts(Set~Id~) List~Account~ } class Accounts { <<domain>> -records List~Account~ +validateIndustry() void +setDefaultRating() void } AccountService --> AccountSelector : queries via AccountService --> Accounts : operates on ``` --- ## Sequence Diagram Templates ### REST Callout with Error Handling ```mermaid sequenceDiagram autonumber participant Ctrl as ApexController participant Svc as IntegrationService participant Ext as External REST API Ctrl->>Svc: callExternalAPI(recordIds) Svc->>Ext: POST /api/v2/accounts alt Success (200) Ext-->>Svc: 200 OK {data} Svc-->>Ctrl: IntegrationResult(success) else Error (4xx/5xx) Ext-->>Svc: Error {message} Svc->>Svc: Log to Integration_Log__c Svc-->>Ctrl: IntegrationResult(failure) end ``` ### Platform Event Pub/Sub ```mermaid sequenceDiagram autonumber participant Apex as Publisher participant Bus as Event Bus participant Sub1 as Trigger participant Sub2 as Flow Apex->>Bus: EventBus.publish(events) Note over Bus: 72h retention par Subscribers Bus-->>Sub1: Deliver (new transaction) Bus-->>Sub2: Deliver end Note over Sub1: Retry via EventBus.RetryableException ``` --- ## Flow-to-Mermaid Conversion Rules ### XML Element Mapping | Flow XML Tag | Mermaid Shape | Syntax | |-------------|--------------|--------| | `<start>` | Start node | `([Start])` | | `<screens>` | Screen | `[/Screen Name/]` | | `<decisions>` | Decision | `{Decision?}` | | `<assignments>` | Assignment | `[Set Variables]` | | `<recordLookups>` | Query | `[(Get Records)]` | | `<recordCreates>` | DML | `[[Create Record]]` | | `<recordUpdate