agentleFS
vhmarquezvhmarquez/argo/skills/dependency-graph/SKILL.md

dependency-graph

Skill1 starsChanged 7 months agoMITView on GitHub

Build the Apex call graph (class → class) and LWC import graph (component → component / Apex method) for the project. Output is a Mermaid graph plus a JSON edge list for downstream impact analysis. Use for refactoring planning and "what does this depend on?" questions.

2 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 1 is distinctive, and 2 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.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    If a <symbol> is provided:

    line 50
  2. Distinctive:

    Default Markdown (full graph):

    line 58
  3. Very specific:

    Don't include test classes by default: Add --include-tests if you want them

    line 118

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

You are building a dependency graph of the project's source code so impact-analysis questions become quick to answer.

Read Project Config First

source "${CLAUDE_PLUGIN_ROOT}/hooks/lib/config.sh"
APEX_SRC="$(sf_config_get '.paths.apexSource' "$ENV")"
LWC_SRC="$(sf_config_get '.paths.lwcSource' "$ENV")"

Input

$ARGUMENTS:

  • (empty) — build the full graph
  • apex — Apex call graph only
  • lwc — LWC import graph only
  • <symbol> — focused subgraph: predecessors and successors of <symbol> (e.g., OrderService or acmeOrderForm)
  • --depth <n> — when focused, how far to walk (default 2)
  • --out <path> — output file (default docs/diagrams/deps.md)
  • --ci — emit JSON edge list

Steps

Apex call graph

For each .cls and .trigger:

  • Capture the class name and parent (extends) and interfaces
  • For each method/property body, identify outgoing references:
    • <OtherClassName>\.<member> — call into another class
    • new <OtherClassName>( — instantiation
    • \bextends\s+<OtherClass> — inheritance
    • \bimplements\s+<Interface> — implementation
  • Build edges <thisClass> -> <otherClass> (deduped per class pair)

LWC import graph

For each LWC bundle:

  • From the JS file, parse import X from 'c/<lwcName>' — edge <thisLwc> -> <otherLwc>
  • From the HTML, parse <c-<kebab-case>> — edge <thisLwc> -> <otherLwc> (same as JS imports usually)
  • From the JS, parse import X from '@salesforce/apex/<Class>.<method>' — edge <thisLwc> -> <Class> (cross into Apex)

Focused subgraph

If a <symbol> is provided:

  • Find the node in the graph
  • Walk predecessors (up): callers of <symbol>
  • Walk successors (down): things <symbol> calls
  • Both bounded by --depth

Output

Default Markdown (full graph):

# Dependency Graph: <project.name>

Generated: 2026-04-28T15:30:00Z (`/argo:dependency-graph`)
Apex classes: 47 | LWC bundles: 18 | Cross-edges: 42

## Apex call graph

```mermaid
graph LR
  OrderController --> OrderService
  OrderService --> OrderApiClient
  OrderService --> Logger
  OrderApiClient --> Logger
  ...

LWC import graph (with Apex calls)

graph LR
  acmeOrderForm --> acmeFormButton
  acmeOrderForm --> OrderController
  acmeOrderList --> OrderController
  acmeOrderList --> acmeOrderRow
  ...

Highly-connected nodes (most callers)

NodeTypeCaller count
LoggerApex22
OrderServiceApex8
acmeFormButtonLWC5
...

CI mode JSON edge list:
```json
{
  "nodes": [
    {"id": "OrderController", "type": "ApexClass", "file": "..."},
    {"id": "acmeOrderForm",   "type": "LightningComponentBundle", "file": "..."}
  ],
  "edges": [
    {"from": "acmeOrderForm", "to": "OrderController", "kind": "lwc-imports-apex"},
    {"from": "OrderController", "to": "OrderService", "kind": "apex-calls-apex"}
  ]
}

Exit codes

  • 0 — graph emitted
  • 2 — config error

Rules

  • Approximate, not perfect. Without a real AST, some indirect references (reflection, dynamic SOQL) are missed. Flag dynamic Apex sites in the JSON output with a dynamic: true flag
  • Don't include test classes by default. Add --include-tests if you want them
  • Idempotent. Same source → same graph. Sort edges deterministically
  • Cap focused-subgraph size. Above 50 nodes the Mermaid graph is illegible; truncate with a note

Consumers

  • @architect and @data-architect use focused subgraphs to reason about refactor blast radius
  • /argo:dead-code shares the graph-building logic to find zero-incoming-edge nodes
  • /argo:field-impact uses LWC-to-Apex edges to find which LWCs depend on a controller that touches a given field

Download now (ZIP)

Does 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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.