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

scripts/README.md

View on GitHub
# Mermaid Preview Server

A lightweight HTTP server with live reload for previewing Mermaid diagrams in your browser.

## Features

- **Live Reload**: Browser automatically refreshes when your diagram file changes
- **Zero Dependencies**: Pure Python stdlib - no pip install required
- **Background Mode**: Server runs in background, doesn't block your terminal
- **Dark Mode**: Automatically matches your system theme preference
- **Copy & Download**: Copy Mermaid code or download as SVG directly from browser

## Quick Start

```bash
# Start the server (opens browser automatically)
python mermaid_preview.py start --file /tmp/my-diagram.mmd

# Check if server is running
python mermaid_preview.py status

# Stop the server
python mermaid_preview.py stop
```

## Usage

### Starting the Server

```bash
python mermaid_preview.py start --file <path-to-mermaid-file>
```

**Options:**
| Option | Description | Default |
|--------|-------------|---------|
| `--file`, `-f` | Mermaid file to watch | `/tmp/mermaid-preview.mmd` |
| `--port`, `-p` | Server port | `8765` |
| `--no-browser` | Don't auto-open browser | `false` |
| `--pid-file` | PID file location | `/tmp/mermaid-preview.pid` |

### Stopping the Server

```bash
python mermaid_preview.py stop
```

### Checking Status

```bash
python mermaid_preview.py status
```

## How It Works

```text
┌─────────────────────────────────────────────────────────────┐
│                    Browser Tab                               │
│  ┌─────────────────────────────────────────────────────┐    │
│  │           Mermaid Diagram (rendered)                 │    │
│  └─────────────────────────────────────────────────────┘    │
│                         ↑                                    │
│            SSE: http://localhost:8765/events                 │
│              (receives "reload" events)                      │
└─────────────────────────────────────────────────────────────┘
                          ↑
┌─────────────────────────────────────────────────────────────┐
│              mermaid_preview.py (background)                 │
│                                                              │
│  ┌───────────────────────────────────────────────────────┐  │
│  │             HTTP Server :8765                          │  │
│  │  GET /           → Serves rendered HTML                │  │
│  │  GET /events     → SSE stream for live reload          │  │
│  └───────────────────────────────────────────────────────┘  │
│                             ↑                                │
│  ┌───────────────────────────────────────────────────────┐  │
│  │  File Watcher (polls every 500ms)                      │  │
│  │  Triggers reload when file mtime changes               │  │
│  └───────────────────────────────────────────────────────┘  │
└─────────────────────────────────────────────────────────────┘
                          ↑
                 /tmp/mermaid-preview.mmd
                     (your diagram file)
```

1. **HTTP Server** serves the HTML page with your Mermaid diagram
2. **File Watcher** monitors your diagram file for changes (polling mtime every 500ms)
3. **SSE (Server-Sent Events)** pushes "reload" events to the browser when file changes
4. **Browser** automatically refreshes to show the updated diagram

## Integration with sf-diagram Skill

When using the sf-diagram skill, you can request a preview:

1. Ask sf-diagram to create a diagram
2. Say "preview this diagram" or "show me the preview"
3. The skill will:
   - Save the diagram to `/tmp/mermaid-preview.mmd`
   - Start the preview server
   - Give you the URL: `http://localhost:8765`
4. As you iterate on the diagram, the browser auto-refreshes
5. When done, say "stop preview" or run `python mermaid_preview.py stop`

## Browser Features

### Copy Mermaid Code
Click the "Copy Mermaid Code" button to copy the raw Mermaid syntax to your clipboard.

### Download SVG
Click "Download SVG" to save the rendered diagram as an SVG file.

### Connection Status
The status indicator shows whether you're connected to the live reload server:
- **● Connected** (green): Live reload is active
- **○ Disconnected** (red): Server connection lost, will auto-reconnect

## Troubleshooting

### Port Already in Use

```bash
# Check if something is using port 8765
lsof -i :8765

# Use a different port
python mermaid_preview.py start --file diagram.mmd --port 8766
```

### Server Won't Start

```bash
# Remove stale PID file
rm /tmp/mermaid-preview.pid

# Try starting again
python mermaid_preview.py start --file diagram.mmd
```

### Browser Doesn't Auto-Open

The `--no-browser` flag prevents auto-opening. To manually open:
1. Start server with `python mermaid_preview.py start --file diagram.mmd`
2. Open `http://localhost:8765` in your browser

### Live Reload Not Working

1. Check the connection status in the browser (should be "Connected")
2. Verify the file path is correct (shown in the browser)
3. Make sure you're saving the file (not just editing)
4. Try refreshing the browser manually

## Requirements

- Python 3.7+
- macOS or Linux (uses `os.fork()` for background mode)
- Modern browser with SSE support (all major browsers)

## License

MIT License
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: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated 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: 322kUpdated Claude CodeCodexVerifiedInstall