Skip to content

forcedotcom/sf-skills / skills/external-diagram-mermaid-generate

external-diagram-mermaid-generate

Unverified

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.

FileKindSize
README.mdmarkdown4.1 KB
SKILL.mdskill md10.7 KB
assets/agentforce/agent-flow.mdmarkdown15.6 KB
assets/architecture/system-landscape.mdmarkdown17.8 KB
assets/datamodel/b2b-commerce-erd.mdmarkdown11.8 KB
assets/datamodel/campaigns-erd.mdmarkdown8.4 KB
assets/datamodel/consent-erd.mdmarkdown10.2 KB
assets/datamodel/files-erd.mdmarkdown9.2 KB
assets/datamodel/forecasting-erd.mdmarkdown9.3 KB
assets/datamodel/fsl-erd.mdmarkdown11.7 KB
assets/datamodel/party-model-erd.mdmarkdown9.1 KB
assets/datamodel/quote-order-erd.mdmarkdown9.9 KB
assets/datamodel/revenue-cloud-erd.mdmarkdown12.8 KB
assets/datamodel/sales-cloud-erd.mdmarkdown7.4 KB
assets/datamodel/salesforce-erd.mdmarkdown6.8 KB
assets/datamodel/scheduler-erd.mdmarkdown10.7 KB
assets/datamodel/service-cloud-erd.mdmarkdown8.1 KB
assets/datamodel/territory-management-erd.mdmarkdown10.0 KB
assets/integration/api-sequence.mdmarkdown12.7 KB
assets/oauth/authorization-code-pkce.mdmarkdown8.5 KB
assets/oauth/authorization-code.mdmarkdown6.8 KB
assets/oauth/client-credentials.mdmarkdown7.6 KB
assets/oauth/device-authorization.mdmarkdown10.5 KB
assets/oauth/jwt-bearer.mdmarkdown8.2 KB
assets/oauth/refresh-token.mdmarkdown9.5 KB
assets/oauth/user-agent-social-sign-on.mdmarkdown13.7 KB
assets/role-hierarchy/user-hierarchy.mdmarkdown13.3 KB
references/color-palette.mdmarkdown19.5 KB
references/diagram-conventions.mdmarkdown8.1 KB
references/erd-conventions.mdmarkdown8.9 KB
references/mermaid-reference.mdmarkdown8.1 KB
references/mermaid-styling.mdmarkdown2.8 KB
references/preview-guide.mdmarkdown1.2 KB
references/usage-examples.mdmarkdown11.1 KB
scripts/README.mdmarkdown6.3 KB
scripts/mermaid_preview.pyexecutablescript20.1 KB
scripts/query-org-metadata.pyexecutablescript8.5 KB

assets/datamodel/revenue-cloud-erd.md

View on GitHub
# Revenue Cloud Data Model Template

Pre-built data model for Salesforce Revenue Cloud (CPQ, Billing, Subscription Management) using `flowchart LR` format with color coding and relationship indicators.

## Objects Included

| Object | Type | Description |
|--------|------|-------------|
| ProductCatalog | STD | Product catalogs |
| ProductCategory | STD | Category hierarchy |
| ProductSellingModel | STD | Selling configurations |
| ProductSellingModelOption | STD | Model options |
| PriceAdjustmentSchedule | STD | Discount schedules |
| PriceAdjustmentTier | STD | Discount tiers |
| ProductAttribute | STD | Product attributes |
| ProductAttributeSet | STD | Attribute groupings |

---

## Query Org Metadata (Recommended)

Enrich diagram with live org data:

```bash
python3 ../../scripts/query-org-metadata.py \
    --objects ProductCatalog,ProductCategory,ProductSellingModel,PriceAdjustmentSchedule \
    --target-org myorg
```

---

## Mermaid Template (Preferred)

Left-to-right flowchart with color coding.

```mermaid
%%{init: {"flowchart": {"nodeSpacing": 50, "rankSpacing": 80}} }%%
flowchart LR
    %% ═══════════════════════════════════════════════════════════════
    %% REVENUE CLOUD DATA MODEL
    %% LEGEND: LK = Lookup (-->), MD = Master-Detail (==>)
    %% Colors: Blue = Standard, Orange = Custom, Green = External
    %% ═══════════════════════════════════════════════════════════════

    %% Product Catalog
    Catalog["ProductCatalog<br/>(count)"]
    Category["ProductCategory<br/>(count)"]
    Product2["Product2<br/>(count)"]

    %% Selling Models
    PSM["ProductSellingModel<br/>(count)"]
    PSMO["ProductSellingModelOption<br/>(count)"]

    %% Pricing
    PAS["PriceAdjustmentSchedule<br/>(count)"]
    PAT["PriceAdjustmentTier<br/>(count)"]
    Pricebook2["Pricebook2<br/>(count)"]
    PBE["PricebookEntry<br/>(count)"]

    %% Attributes
    AttrSet["ProductAttributeSet<br/>(count)"]
    Attr["ProductAttribute<br/>(count)"]
    AttrSetItem["ProductAttributeSetItem<br/>(count)"]

    %% Catalog Structure
    Catalog ==>|"MD"| Category
    Category -.->|"Parent"| Category
    Category -->|"LK"| Product2

    %% Selling Models
    Product2 -->|"LK"| PSM
    PSM ==>|"MD"| PSMO

    %% Pricing
    PAS ==>|"MD"| PAT
    Pricebook2 ==>|"MD"| PBE
    Product2 -->|"LK"| PBE

    %% Attributes
    AttrSet ==>|"MD"| AttrSetItem
    Attr -->|"LK"| AttrSetItem
    Product2 -->|"LK"| AttrSet

    %% Standard Objects - Sky Blue
    style Catalog fill:#bae6fd,stroke:#0369a1,color:#1f2937
    style Category fill:#bae6fd,stroke:#0369a1,color:#1f2937
    style Product2 fill:#bae6fd,stroke:#0369a1,color:#1f2937
    style PSM fill:#bae6fd,stroke:#0369a1,color:#1f2937
    style PSMO fill:#bae6fd,stroke:#0369a1,color:#1f2937
    style PAS fill:#bae6fd,stroke:#0369a1,color:#1f2937
    style PAT fill:#bae6fd,stroke:#0369a1,color:#1f2937
    style Pricebook2 fill:#bae6fd,stroke:#0369a1,color:#1f2937
    style PBE fill:#bae6fd,stroke:#0369a1,color:#1f2937
    style AttrSet fill:#bae6fd,stroke:#0369a1,color:#1f2937
    style Attr fill:#bae6fd,stroke:#0369a1,color:#1f2937
    style AttrSetItem fill:#bae6fd,stroke:#0369a1,color:#1f2937
```

---

## Key Concepts

### Revenue Cloud Components
| Component | Purpose |
|-----------|---------|
| **Industries CPQ** | Configure-Price-Quote |
| **Subscription Management** | Recurring billing |
| **Revenue Lifecycle** | Rev rec, forecasting |
| **Dynamic Revenue Orchestration** | Guided selling |

### Product Hierarchy
```text
ProductCatalog
    └── ProductCategory (Hierarchy)
            └── Product2
                    ├── ProductSellingModel
                    ├── ProductAttribute
                    └── PricebookEntry
```

### Selling Model Types
| Type | Description |
|------|-------------|
| One-Time | Single purchase |
| Subscription | Recurring billing |
| Usage-Based | Consumption pricing |
| Evergreen | Auto-renewing |
| Term | Fixed duration |

### Price Adjustment Schedules
| Schedule Type | Use Case |
|---------------|----------|
| Volume Discount | Quantity-based tiers |
| Contract Discount | Agreement discounts |
| Promotional | Time-limited offers |
| Bundled | Package pricing |

---

## Simplified Version (Core Objects Only)

For presentations focusing on core revenue structure:

```mermaid
%%{init: {"flowchart": {"nodeSpacing": 50, "rankSpacing": 80}} }%%
flowchart LR
    Catalog["ProductCatalog"]
    Category["ProductCategory"]
    Product2["Product2"]
    PSM["ProductSellingModel"]

    Catalog ==>|"MD"| Category
    Category -->|"LK"| Product2
    Product2 -->|"LK"| PSM

    style Catalog fill:#bae6fd,stroke:#0369a1,color:#1f2937
    style Category fill:#bae6fd,stroke:#0369a1,color:#1f2937
    style Product2 fill:#bae6fd,stroke:#0369a1,color:#1f2937
    style PSM fill:#bae6fd,stroke:#0369a1,color:#1f2937
```

---

## Subscription Management Model

```mermaid
%%{init: {"flowchart": {"nodeSpacing": 50, "rankSpacing": 80}} }%%
flowchart LR
    Account["Account"]
    Quote["Quote"]
    QLI["QuoteLineItem"]
    Order["Order"]
    OrderItem["OrderItem"]
    Asset["Asset"]
    BillingSchedule["BillingSchedule"]

    Account -->|"LK"| Quote
    Quote ==>|"MD"| QLI
    Quote -.->|"converts"| Order
    Order ==>|"MD"| OrderItem
    OrderItem -.->|"creates"| Asset
    Asset -->|"LK"| BillingSchedule

    style Account fill:#bae6fd,stroke:#0369a1,color:#1f2937
    style Quote fill:#bae6fd,stroke:#0369a1,color:#1f2937
    style QLI fill:#bae6fd,stroke:#0369a1,color:#1f2937
    style Order fill:#bae6fd,stroke:#0369a1,color:#1f2937
    style OrderItem fill:#bae6fd,stroke:#0369a1,color:#1f2937
    style Asset fill:#bae6fd,stroke:#0369a1,color:#1f2937
    style BillingSchedule fill:#bae6fd,stroke:#0369a1,color:#1f2937
```

---

## Pricing Model Detail

```mermaid
%%{init: {"flowchart": {"nodeSpacing": 50, "rankSpacing": 80}} }%%
flowchart LR
    Product2["Product2"]
    Pricebook2["Pricebook2"]
    PBE["PricebookEntry"]
    PAS["PriceAdjustmentSchedule"]
    PAT["PriceAdjustmentTier"]

    Pricebook2 ==>|"MD"| PBE
    Product2 -->|"LK"| PBE
    PAS ==>|"MD"| PAT
    Product2 -->|"LK"| PAS

    style Product2 fill:#bae6fd,stroke:#0369a1,color:#1f2937
    style Pricebook2 fill:#bae6fd,stroke:#0369a1,color:#1f2937
    style PBE fill:#bae6fd,stroke:#0369a1,color:#1f2937
    style PAS fill:#bae6fd,stroke:#0369a1,color:#1f2937
    style PAT fill:#bae6fd,stroke:#0369a1,color:#1f2937
```

---

## Industries CPQ Objects

```mermaid
%%{init: {"flowchart": {"nodeSpacing": 50, "rankSpacing": 80}} }%%
flowchart LR
    Quote["Quote"]
    QLI["QuoteLineItem"]
    ProposalDoc["ProposalDocument"]
    ProposalTerm["ProposalTerm"]
    DocTemplate["DocumentTemplate"]

    Quote ==>|"MD"| QLI
    Quote -->|"LK"| ProposalDoc
    ProposalDoc ==>|"MD"| ProposalTerm
    DocTemplate -->|"LK"| ProposalDoc

    style Quote fill:#bae6fd,stroke:#0369a1,color:#1f2937
    style QLI fill:#bae6fd,stroke:#0369a1,color:#1f2937
    style ProposalDoc fill:#bae6fd,stroke:#0369a1,color:#1f2937
    style ProposalTerm fill:#bae6fd,stroke:#0369a1,color:#1f2937
    style DocTemplate fill:#bae6fd,stroke:#0369a1,color:#1f2937
```

---

## ASCII Fallback

```text
┌─────────────────────────────────────────────────────────────────────────────┐
│  REVENUE CLOUD DATA MODEL (L→R)                                              │
│  Legend: LK = Lookup (-->), MD = Master-Detail (==>)                        │
└─────────────────────────────────────────────────────────────────────────────┘

                           PRODUCT CATALOG
┌──────────────────┐         ┌──────────────────┐
│ PRODUCT_CATALOG  │═══ MD ═>│ PRODUCT_CATEGORY │◄──── Parent (self)
│     (count)      │         │     (count)      │
└──────────────────┘         └────────┬─────────┘
                                      │ LK
                                      ▼
                             ┌──────────────────┐
                             │     PRODUCT2     │
                             │     (count)      │
                             └────────┬─────────┘
                                      │
                    ┌─────────────────┼─────────────────┐
                    │ LK              │ LK              │ LK
                    ▼                 ▼                 ▼
         ┌──────────────────┐ ┌─────────────┐ ┌──────────────────┐
         │PRODUCT_SELLING_  │ │PRICEBOOK_   │ │PRODUCT_ATTRIBUTE │
         │MODEL (count)     │ │ENTRY(count) │ │_SET (count)      │
         └────────┬─────────┘ └─────────────┘ └────────┬─────────┘
                  │ MD                                 │ MD
                  ▼                                    ▼
         ┌──────────────────┐                ┌──────────────────┐
         │PRODUCT_SELLING_  │                │PRODUCT_ATTRIBUTE_│
         │MODEL_OPTION      │                │SET_ITEM (count)  │
         │    (count)       │                └────────┬─────────┘
         └──────────────────┘                         │ LK
                                                      ▼
                                             ┌──────────────────┐
                                             │PRODUCT_ATTRIBUTE │
                                             │     (count)      │
                                             └──────────────────┘

                           PRICE ADJUSTMENTS
┌────────────────────────┐         ┌──────────────────────────┐
│PRICE_ADJUSTMENT_       │═══ MD ═>│PRICE_ADJUSTMENT_TIER     │
│SCHEDULE (count)        │         │        (count)           │
└────────────────────────┘         └──────────────────────────┘
```

---

## Key Relationships Summary

| Parent | Child | Type | Behavior |
|--------|-------|------|----------|
| ProductCatalog | ProductCategory | MD | Cascade delete |
| ProductCategory | ProductCategory | LK | Parent (hierarchy) |
| ProductCategory | Product2 | LK | Product classification |
| Product2 | ProductSellingModel | LK | Selling configuration |
| ProductSellingModel | ProductSellingModelOption | MD | Model options |
| PriceAdjustmentSchedule | PriceAdjustmentTier | MD | Discount tiers |
| Pricebook2 | PricebookEntry | MD | Product prices |
| Product2 | PricebookEntry | LK | Product reference |
| ProductAttributeSet | ProductAttributeSetItem | MD | Attribute membership |
| ProductAttribute | ProductAttributeSetItem | LK | Attribute reference |

---

## Limits & Considerations

| Limit | Value |
|-------|-------|
| Product categories depth | 10 levels |
| Products per catalog | Unlimited (LDV) |
| Selling models per product | Multiple |
| Discount tiers per schedule | Unlimited |
| Attributes per product | Unlimited |
| Pricebooks per org | Unlimited |

---

## Revenue Cloud vs Salesforce CPQ

| Feature | Revenue Cloud | Salesforce CPQ |
|---------|---------------|----------------|
| Platform | Industries | Core |
| Bundles | Dynamic | Static |
| Attributes | Dynamic | Limited |
| Selling Models | Native | Custom |
| Subscription | Native | Requires add-on |
| Target | Industry-specific | General |

---

## Best Practices

1. **Use `flowchart LR`** - Left-to-right flow for readability
2. **Keep objects simple** - Name + record count only
3. **Replace `(count)` placeholders** - With actual counts from query
4. **Add LDV indicator** - For objects >2M records: `LDV[~4M]`
5. **Color code object types** - Blue=Standard, Orange=Custom, Green=External
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 323kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 323kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 323kUpdated Claude CodeCodexVerifiedInstall