erd
Skill1 starsChanged 7 months agoMITView on GitHub
Generate or update Mermaid Entity-Relationship Diagrams from Salesforce object metadata. Reads .object-meta.xml files plus their field-meta.xml subdirectories, extracts relationships (Lookup, MasterDetail, Hierarchy), and emits a Mermaid ERD as Markdown. Useful for design reviews and onboarding.
2 other projects use a version of this.
Adopted by
Most recently taken up by
- gr219/OpenBA-Kittheir own version, first seen Oct 25, 2026
- spmtitsolution/OpenBA-Kittheir own version, first seen Oct 20, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- spmtitsolution/OpenBA-Kit★ 38same name
- gr219/OpenBA-Kit★ 0same 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
- 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
- sequence-diagramSkill
- 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
6 rules. About 0 are common, 0 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 41
Read <Object>.object-meta.xml for label and shareability
- Very specific: line 42
Read each <Object>/fields/*.field-meta.xml for:
- Very specific: line 63
If a seed object was given, walk relationships up to --depth and collect the closure.
- Very specific: line 118
Write to --out (default docs/diagrams/erd.md).
- Very specific: line 128
Standard objects only when referenced: Don't emit a node for User unless a custom object lookups to it.
- Very specific: line 129
Honor master-detail visualization: Use ||--|{ for required master-detail.
≈ “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 an ERD from local source metadata. You read the project's .object-meta.xml files and the per-field metadata under each object's fields/ directory, extract relationships, and emit one or more Mermaid erDiagram blocks.
Read Project Config First
source "${CLAUDE_PLUGIN_ROOT}/hooks/lib/config.sh"
APEX_SRC="$(sf_config_get '.paths.apexSource' "$ENV")"
# Objects live under <packageDir>/main/default/objects — derive from sfdx-project.json
# or accept --objects-path override.Input
$ARGUMENTS:
- (empty) — diagram every custom object + selected standard objects (Account, Contact, Case, Opportunity, Lead, User) where they're referenced by a custom object
<Object>— diagram one object's neighborhood (the object + everything it references and that references it, depth 1)--depth <n>— relationship depth from the seed (default 1)--scope custom|all— restrict to custom (default), or include all standard--out <path>— output Markdown file (defaultdocs/diagrams/erd.md; overwrites)--objects-path <path>— override the defaultforce-app/main/default/objectslocation
Steps
1. Discover objects in source
OBJECTS_PATH="${OBJECTS_PATH:-force-app/main/default/objects}"
[[ -d "$OBJECTS_PATH" ]] || { echo "[erd] objects path not found: $OBJECTS_PATH" >&2; exit 2; }
ls -1 "$OBJECTS_PATH"2. Parse each object
For every directory under OBJECTS_PATH:
- Read
<Object>.object-meta.xmlfor label and shareability - Read each
<Object>/fields/*.field-meta.xmlfor:<fullName>— field API name<type>—Lookup,MasterDetail,Hierarchy, plus regular types<referenceTo>— target object (only for Lookup / MasterDetail / Hierarchy)<required>— required flag<deleteConstraint>— Restrict / SetNull / Cascade
Build an in-memory model:
{
"objects": {
"Order__c": {
"label": "Order",
"fields": [{"name": "Customer__c", "type": "Lookup", "referenceTo": "Account", "required": true}]
}
}
}3. Compute the diagram scope
If a seed object was given, walk relationships up to --depth and collect the closure. Otherwise include all custom objects.
4. Emit Mermaid
erDiagram
Account ||--o{ Order__c : "Customer__c"
Order__c ||--|{ Order_Item__c : "Order__c (master-detail)"
Order_Item__c }o--|| Product2 : "Product__c"
Order__c {
string Name
picklist Status__c
currency Total_Amount__c
}
Order_Item__c {
string Name
number Quantity__c
currency Unit_Price__c
masterdetail Order__c
lookup Product__c
}Cardinality rules (Mermaid erDiagram):
||--o{— one-to-many, optional on the many side||--|{— one-to-many, required (master-detail with required)}o--||— many-to-one with required parent (lookup required)}o--o|— optional both sides (rare)
5. Wrap in Markdown
# Entity-Relationship Diagram: <project.name>
Generated: 2026-04-28T11:30:00Z (`/argo:erd`)
Source: force-app/main/default/objects (27 custom + 4 standard referenced)
Depth from seed: <n> | Seed: <Object> or "(all custom)"
## Diagram
```mermaid
erDiagram
...Object Index
| Object | Custom | OWD | Fields | Relationships |
| Order__c | ✅ | Private | 14 | Lookup → Account, MD ← Order_Item__c |
| ... |
### 6. Output
Write to `--out` (default `docs/diagrams/erd.md`); create the directory if needed. Print a one-line summary on stdout: `[erd] Wrote 1 diagram with 12 objects to docs/diagrams/erd.md`.
CI mode: emit the JSON model on stdout, no Markdown side-effect.
### 7. Exit codes
- 0 — diagram emitted (or empty if no objects matched)
- 2 — input/path error
## Rules
- **Standard objects only when referenced.** Don't emit a node for `User` unless a custom object lookups to it. Reduces clutter
- **Honor master-detail visualization.** Use `||--|{` for required master-detail; the strong line communicates the cascade-delete semantic
- **Skip `OwnerId`, `CreatedById`, `LastModifiedById`** by default — they're noise on every diagram. `--include-system-fields` to opt in
- **Field labels**: show the API name + a short type marker (`string`, `picklist`, `number`, etc.) — full descriptions belong in the docs/apex-classes generated docs, not the ERD
- **Hierarchical fields** (`ParentId` on Account) — render as a self-loop with cardinality `||--o{`
- **Idempotent.** Re-running on the same source must produce the same Markdown bit-for-bit so `git diff` is meaningful
## Consumers
- `@architect` and `@data-architect` reference the latest ERD when designing changes
- `/argo:generate-docs` may include a snippet of the ERD in `docs/README.md`
- Visualizers: GitHub renders Mermaid in Markdown natively; VS Code with the Mermaid Preview extension; or paste into mermaid.liveDoes 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.

