sequence-diagram
Skill1 starsChanged 7 months agoMITView on GitHub
Generate Mermaid sequence diagrams tracing the call path from an LWC entry point through @wire / imperative Apex calls into Apex methods, SOQL/DML, callouts, and Platform Event publishes. Useful for design reviews, onboarding, and explaining "what happens when the user clicks X.
2 other projects use a version of this.
Adopted by
Most recently taken up by
- DoKu67/claude-code-skilstheir own version, first seen Nov 1, 2026
- CrazyElephantX/OpenCodetheir own version, first seen Aug 10, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- DoKu67/claude-code-skils★ 4same name
- CrazyElephantX/OpenCode★ 2same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository53 other files it gives its agents.
- templates/CLAUDE.mdCLAUDE.md
- adrSkill
- agent-deploySkill
- agent-discoverSkill
- agent-eval-trendSkill
- agent-exchange-listSkill
- agent-specSkill
- agent-testSkill
- agent-vs-flow-vs-apexSkill
- before-vs-after-triggerSkill
- code-reviewSkill
- complexitySkill
- coverage-trendSkill
- dead-codeSkill
- dependency-graphSkill
- deploySkill
- destructive-changesSkill
- diff-deploySkill
- erdSkill
- field-impactSkill
- flaky-test-finderSkill
- flow-auditSkill
- flow-vs-apexSkill
- fls-auditSkill
- gateway-configSkill
- generate-docsSkill
- limit-usageSkill
- lwc-vs-reactSkill
- mcp-tool-vs-restSkill
- notifySkill
- onboardSkill
- org-diffSkill
- org-exploreSkill
- package-versionSkill
- pattern-packSkill
- perf-reviewSkill
- permset-auditSkill
- pr-prepareSkill
- queueable-vs-batchSkill
- quick-deploySkill
- react-initSkill
- release-notesSkill
- scratch-orgSkill
- security-scanSkill
- sf-initSkill
- sharing-reviewSkill
- slack-agentSkill
- soql-analyzerSkill
- test-coverageSkill
- test-dataSkill
- test-planSkill
- trust-evalSkill
- trust-layer-auditSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 1 is distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 44
If the user passed <lwc>.<method>, narrow to the call paths originating from that method.
- Very specific: line 104
Use ->> for synchronous / blocking.
- Very specific: line 105
Use autonumber to make steps citable in reviews
- Very specific: line 136
Write to --out (default docs/diagrams/<lwc>.sequence.md).
- Distinctive: line 147
Don't follow into framework code: Stop at TriggerDispatcher, Logger, base controllers — they're plumbing
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
You are generating a Mermaid sequenceDiagram from the call path that begins at an LWC entry point (a button click, a @wire, a connectedCallback) and follows through Apex into the org and any external systems.
Read Project Config First
source "${CLAUDE_PLUGIN_ROOT}/hooks/lib/config.sh"
LWC_SRC="$(sf_config_get '.paths.lwcSource' "$ENV")"
APEX_SRC="$(sf_config_get '.paths.apexSource' "$ENV")"Input
$ARGUMENTS: required.
<lwc-name>— the LWC bundle name (without prefix); the skill traces from this component<lwc-name>.<method>— start from a specific JS method (e.g.,acmeOrderForm.handleSave)--out <path>— output Markdown file (defaultdocs/diagrams/<lwc>.sequence.md)--max-depth <n>— how many Apex method levels to follow (default 4)
Steps
1. Locate the LWC
LWC_DIR="${LWC_SRC}/${LWC_NAME}"
[[ -d "$LWC_DIR" ]] || { echo "[seq] LWC not found: $LWC_DIR" >&2; exit 2; }
JS_FILE="${LWC_DIR}/${LWC_NAME}.js"
HTML_FILE="${LWC_DIR}/${LWC_NAME}.html"2. Parse the LWC for entry points and Apex imports
From <lwc>.js:
- Extract Apex imports:
import <name> from '@salesforce/apex/<Class>.<Method>'; - Extract LMS channel imports:
import ch from '@salesforce/messageChannel/<Channel>__c'; - Extract
@wireconfigs (Apex method + parameters) - Extract event handler methods (matched against
<button onclick={X}>in HTML)
If the user passed <lwc>.<method>, narrow to the call paths originating from that method.
3. Walk Apex methods
For each top-level Apex call:
- Read
${APEX_SRC}/<Class>.cls - Locate the method
- Inside the method, identify:
- SOQL queries (
[SELECT ...]) - DML (
insert,update,delete,upsert,merge) - Callouts (
Http.send,WebServiceCallout.invoke) - Platform Event publishes (
EventBus.publish) - Method calls into other classes — recurse up to
--max-depth - LMS publishes / subscribes (rare in Apex; mostly LWC)
- SOQL queries (
Build a call tree:
acmeOrderForm.handleSave (LWC)
└─ OrderController.createOrder (Apex)
├─ OrderService.validate
├─ OrderService.persist
│ ├─ INSERT Order__c
│ └─ INSERT Order_Item__c (×N)
└─ OrderApiClient.notify
└─ HTTP POST callout:Acme_Order_API/orders4. Emit Mermaid sequence
sequenceDiagram
autonumber
actor User
participant LWC as acmeOrderForm
participant Ctrl as OrderController
participant Svc as OrderService
participant DB as Salesforce DB
participant Ext as Acme Order API
User->>LWC: click Save
LWC->>Ctrl: createOrder(payload)
Ctrl->>Svc: validate(payload)
Svc-->>Ctrl: ok
Ctrl->>Svc: persist(payload)
Svc->>DB: INSERT Order__c
Svc->>DB: INSERT Order_Item__c (bulk)
DB-->>Svc: ids
Svc-->>Ctrl: order
Ctrl->>Ext: HTTP POST /orders (Named Cred: Acme_Order_API)
Ext-->>Ctrl: 201 created
Ctrl-->>LWC: order
LWC-->>User: Toast "Order saved"Conventions:
actor Userfor the human triggering the flowparticipant LWC as <component>for the LWC bundleparticipant <Short> as <FullClassName>for each Apex classparticipant DB as Salesforce DBfor SOQL/DMLparticipant Ext as <External System>for each external endpoint (one per Named Credential)- Use
->>for synchronous / blocking;-)>for async (Queueable enqueue, Platform Event publish, async DML) - Use
autonumberto make steps citable in reviews
5. Wrap in Markdown
# Sequence: <LWC>.<method>
Generated: 2026-04-28T11:45:00Z (`/argo:sequence-diagram`)
Entry: <LWC> (handler: <method>)
Depth: <n>
## Diagram
```mermaid
sequenceDiagram
...Call Tree
(text version of the call tree built in step 3, for accessibility)
Notes
- Includes async transitions (Queueable, Platform Event) marked with
-)> - Excludes calls into the project's
Loggerand trigger handler dispatcher (omitted as plumbing) - DML outside the Apex method scope (e.g., trigger side-effects) is not represented; rerun against the trigger to see those flows
### 6. Output
Write to `--out` (default `docs/diagrams/<lwc>.sequence.md`).
CI mode: emit JSON call tree on stdout, no Markdown side-effect.
### 7. Exit codes
- 0 — diagram emitted
- 1 — entry-point LWC has no Apex calls (informational; emit empty diagram)
- 2 — LWC not found / parse error
## Rules
- **Don't follow into framework code.** Stop at TriggerDispatcher, Logger, base controllers — they're plumbing
- **Bundle DML as one step.** "INSERT Order_Item__c (bulk)" is more useful than 200 lines of step
- **Use Named Credential names**, not URLs. `callout:Acme_Order_API` reads better than `https://api.acme.com`
- **Mark async clearly.** `-)>` for fire-and-forget (Queueable, Platform Event), separate participant `Q as Queueable` for delayed work that has its own subsequent flow
- **Idempotent output.** Same source → same Markdown
- **Imperfect is okay.** Apex parsing without a real AST is heuristic; flag any method calls you can't resolve as `??` and let the user inspectDoes it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

