@ryanstark24/sfgraph-skills 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/dist/__tests__/cursor-format.test.d.ts +2 -0
  2. package/dist/__tests__/cursor-format.test.d.ts.map +1 -0
  3. package/dist/__tests__/cursor-format.test.js +44 -0
  4. package/dist/__tests__/cursor-format.test.js.map +1 -0
  5. package/dist/__tests__/installer.test.d.ts +2 -0
  6. package/dist/__tests__/installer.test.d.ts.map +1 -0
  7. package/dist/__tests__/installer.test.js +64 -0
  8. package/dist/__tests__/installer.test.js.map +1 -0
  9. package/dist/index.d.ts +3 -0
  10. package/dist/index.d.ts.map +1 -0
  11. package/dist/index.js +14 -0
  12. package/dist/index.js.map +1 -0
  13. package/dist/installer.d.ts +39 -0
  14. package/dist/installer.d.ts.map +1 -0
  15. package/dist/installer.js +187 -0
  16. package/dist/installer.js.map +1 -0
  17. package/package.json +51 -0
  18. package/skills/sf-cross-layer-trace/SKILL.md +97 -0
  19. package/skills/sf-cross-org-diff/SKILL.md +70 -0
  20. package/skills/sf-dead-code-audit/SKILL.md +72 -0
  21. package/skills/sf-deployment-manifest/SKILL.md +70 -0
  22. package/skills/sf-explain-code/SKILL.md +66 -0
  23. package/skills/sf-flow-impact/SKILL.md +67 -0
  24. package/skills/sf-governor-risk-fix/SKILL.md +64 -0
  25. package/skills/sf-impact-from-diff/SKILL.md +64 -0
  26. package/skills/sf-metadata-refresh/SKILL.md +71 -0
  27. package/skills/sf-omnistudio-migration-audit/SKILL.md +71 -0
  28. package/skills/sf-schema-overview/SKILL.md +66 -0
  29. package/skills/sf-security-audit/SKILL.md +66 -0
  30. package/skills/sf-snapshot-compare/SKILL.md +68 -0
  31. package/skills/sf-web-explorer/SKILL.md +56 -0
  32. package/skills/sf-what-broke/SKILL.md +64 -0
  33. package/skills/sf-wip-impact/SKILL.md +74 -0
@@ -0,0 +1,66 @@
1
+ ---
2
+ name: sf-security-audit
3
+ description: Audit FLS, CRUD, sharing, and profile/permission-set access for a field or object.
4
+ triggers:
5
+ - "FLS"
6
+ - "who has access"
7
+ - "sharing rules"
8
+ - "field-level security"
9
+ - "permission audit"
10
+ - "CRUD"
11
+ tools_used:
12
+ - security_audit
13
+ - analyze_field
14
+ - staleness_check
15
+ ---
16
+
17
+ # sf-security-audit
18
+
19
+ Use when the user asks about who can read or write a field/object, what sharing rules apply, or whether FLS / CRUD is consistent with intent.
20
+
21
+ ## Playbook
22
+
23
+ 1. Resolve the target. Call `analyze_field` if the user gave `SObject.Field`; otherwise treat as SObject-level.
24
+ 2. Call `security_audit` with the resolved target. Capture profiles, permission sets, permission set groups, sharing rules (criteria + owner-based), OWD, and any `without sharing` Apex that touches the field.
25
+ 3. Build the access matrix: Profile/PSet -> Read / Edit / Delete / View All / Modify All.
26
+ 4. Identify sharing exposure: OWD setting, sharing rules expanding access, role-hierarchy inheritance toggles.
27
+ 5. Flag risks: `without sharing` Apex selectors, missing `stripInaccessible` / `WITH SECURITY_ENFORCED`, guest user access, Experience Cloud profile reach.
28
+ 6. Render the Mermaid access matrix returned by the tool.
29
+
30
+ ## Visualization
31
+
32
+ Render a **`flowchart LR`** access-flow diagram: Profile/PermissionSet nodes on the left, Permission Set Groups in the middle, the target object/field on the right. Edge style encodes Read/Edit/Delete; colour encodes risk (guest user, Experience Cloud, `without sharing` Apex).
33
+
34
+ ```
35
+ flowchart LR
36
+ P1[Profile:SystemAdmin] -->|RED| F[(Account.Tier__c)]
37
+ PSG[PSG:Sales] --> PS[PS:SalesEdit] --> F
38
+ GU[Profile:Guest]:::risk --> F
39
+ classDef risk fill:#fcc,stroke:#900
40
+ ```
41
+
42
+ When more than 25 Profiles/PSets have access, collapse to a count table and only diagram the high-risk paths (guest, Experience Cloud, without-sharing).
43
+
44
+ ## Staleness check
45
+
46
+ Before calling `security_audit`, invoke `staleness_check` for the target org. Permission set/profile assignments change frequently; a stale graph misrepresents access. If the report says stale, surface a warning to the user:
47
+
48
+ > Your ingest is N days old. Run `sfgraph ingest --org <alias>` to refresh, or proceed with the understanding that the graph may not reflect recent changes.
49
+
50
+ Then continue with the playbook.
51
+
52
+ ## Response Shape
53
+
54
+ - **Target** — `SObject` or `SObject.Field`.
55
+ - **Access matrix** — table: Profile / PSet -> R / E / D / VA / MA.
56
+ - **Sharing model** — OWD + sharing rules + role hierarchy.
57
+ - **Apex exposure** — list of `without sharing` classes that touch the target.
58
+ - **Risks** — bullets, severity-tagged.
59
+ - **Mermaid access matrix** — embedded.
60
+
61
+ ## Don't
62
+
63
+ - Do not propose specific profile / permission set edits; surface the gap and let security own the change.
64
+ - Do not modify any sharing configuration.
65
+ - Do not omit guest user / Experience Cloud findings — they are the highest-risk category.
66
+ - Do not infer encryption status from this audit; that requires `sf-architect-security`.
@@ -0,0 +1,68 @@
1
+ ---
2
+ name: sf-snapshot-compare
3
+ description: Compare two sfgraph snapshots (or one snapshot against current) to see what changed point-in-time.
4
+ triggers:
5
+ - "compare snapshots"
6
+ - "what changed between these snapshots"
7
+ - "point in time diff"
8
+ - "rewind"
9
+ - "show me the state before"
10
+ tools_used:
11
+ - snapshot_list
12
+ - snapshot_create
13
+ - point_in_time_diff
14
+ - staleness_check
15
+ ---
16
+
17
+ # sf-snapshot-compare
18
+
19
+ Use when the user wants to compare two named points in time — typically a pre-deploy checkpoint vs current, or two milestone snapshots taken during a release.
20
+
21
+ ## Playbook
22
+
23
+ 1. Call `snapshot_list` for the org. Present available snapshots with their `id`, `label`, `createdAt`, and `kind` (auto/manual).
24
+ 2. If the user has not yet taken a snapshot, suggest one of:
25
+ - **MCP**: invoke `snapshot_create` with a descriptive `name` (e.g. `before-deploy-v42`).
26
+ - **CLI**: `sfgraph snapshot create --label "before-deploy-v42"` (add `--kind scheduled` if the user is wiring this into cron / GitHub Actions).
27
+
28
+ Both write into the same per-org SQLite store. Recommend the CLI form when the user asks "how do I take a snapshot before this deploy?" from a script; recommend the MCP tool when they're already in agent conversation. Stop until they confirm.
29
+ 3. Call `staleness_check` for the org. Warn if stale — note: even with a stale ingest, snapshot vs snapshot comparisons are still meaningful, but snapshot vs `current` would be stale-on-stale.
30
+ 4. Call `point_in_time_diff(from=snapA, to=snapB | 'current')`. Capture nodes added / removed / changed grouped by metadata category.
31
+ 5. Summarise totals by category. For each category, list the top items by impact (e.g. ApexClass changes ranked by fan-in).
32
+
33
+ ## Visualization
34
+
35
+ Render a **`gitGraph`** showing the snapshot chain with annotated commits encoding added/removed/changed counts.
36
+
37
+ ```
38
+ gitGraph
39
+ commit id: "snap_pre-deploy"
40
+ commit id: "snap_mid-sprint" tag: "+12 nodes"
41
+ commit id: "current" tag: "+3 -1 ~5"
42
+ ```
43
+
44
+ If `gitGraph` isn't supported by the client, fall back to a small **`flowchart LR`** with the two snapshots as nodes and a labelled edge carrying the change counts.
45
+
46
+ ## Staleness check
47
+
48
+ Before calling `point_in_time_diff` with `to='current'`, invoke `staleness_check` for the org. If the report says stale, surface a warning to the user:
49
+
50
+ > Your ingest is N days old. Run `sfgraph ingest --org <alias>` to refresh, or proceed with the understanding that the graph may not reflect recent changes.
51
+
52
+ Then continue with the playbook. Snapshot-to-snapshot diffs are immune to staleness, but a snapshot-to-current diff inherits it.
53
+
54
+ ## Response Shape
55
+
56
+ - **Snapshots compared** — `from` and `to` with labels + timestamps.
57
+ - **Totals** — `added N`, `removed M`, `changed K`.
58
+ - **Per-category** — table: metadata type / added / removed / changed.
59
+ - **Top changes** — bullet list per category, top 5 by fan-in.
60
+ - **Mermaid gitGraph** — embedded.
61
+ - **Suggested next skill** — typically `sf-what-broke` if the user is post-deploy triaging.
62
+
63
+ ## Don't
64
+
65
+ - Do not auto-create snapshots without explicit user consent; `snapshot_create` mutates local state.
66
+ - Do not delete or rewrite snapshots; this skill is comparison-only.
67
+ - Do not silently truncate the change list — say when results were capped.
68
+ - Do not pretend a snapshot exists if it doesn't; check `snapshot_list` first.
@@ -0,0 +1,56 @@
1
+ ---
2
+ name: sf-web-explorer
3
+ description: Triggers when the user wants to visually explore the ingested graph — "show me the graph", "open the visualiser", "see the relationships", "open the web view", "let me click around".
4
+ triggers:
5
+ - "show me the graph"
6
+ - "open the visualiser"
7
+ - "open the web view"
8
+ - "see the relationships visually"
9
+ - "render the whole org"
10
+ tools_used: []
11
+ when_to_use: Visual exploration of an ingested org. Pairs with `analyze_field`, `trace_upstream`, `trace_downstream`, and `cross_layer_flow_map` when the markdown answers are not enough and the user wants to click around.
12
+ ---
13
+
14
+ # sf-web-explorer
15
+
16
+ The MCP tool surface is great for answering specific questions, but sometimes the user wants to **see** their org — pan, zoom, follow edges by eye. `sfgraph serve` boots a local web visualiser at `http://localhost:7777` for exactly this.
17
+
18
+ This skill does not call any MCP tool. It instructs the user how to launch the viewer and what to do once it's open.
19
+
20
+ ## Playbook
21
+
22
+ 1. Confirm the org has been ingested (use `staleness_check` if uncertain).
23
+ 2. Tell the user to run `sfgraph serve` in a shell. It auto-opens their default browser. Mention `--no-open` if they want to suppress that, and `--port <N>` for an alternate port.
24
+ 3. Walk them to the right tab:
25
+ - **Trace** — for following the dependency neighborhood of a single node. Best after running `trace_upstream` / `trace_downstream` in chat and wanting to keep exploring.
26
+ - **Overview** — for "what does this org look like at a glance" — hubs, layer counts, freshness.
27
+ - **Schema** — for SObject / field topology and cross-layer references.
28
+ - **"Render entire org" button** — for the full 3D force-graph (Obsidian-style). Useful for getting your bearings on an unfamiliar org.
29
+ 4. Surface the keyboard shortcuts up front: `L` toggles always-show labels, `F` fits the graph, `Esc` closes panels.
30
+
31
+ ## Suggested workflows
32
+
33
+ - **Following a field across layers.** Run `analyze_field` in chat → switch to the Schema tab in the web view → pivot to "Render entire org" if you need broader context. The web view's labels for hubs stay visible at any zoom so you don't lose your place.
34
+ - **Onboarding to a new org.** Open the Overview tab first. Identify the top hubs by degree. Then jump to Trace tab on each hub to see what depends on them.
35
+ - **Visualising a `cross_layer_flow_map` result.** The markdown gives you the paths; the Trace tab gives you the picture. Both are useful side-by-side.
36
+
37
+ ## Visualization
38
+
39
+ No diagram from the skill itself — the visualiser **is** the visualisation. Render a short markdown checklist with the launch command and the tab/shortcut cheatsheet.
40
+
41
+ ```
42
+ - Launch: `sfgraph serve` (or `sfgraph serve --no-open`)
43
+ - URL: http://localhost:7777
44
+ - Tabs: Trace · Overview · Schema · [Render entire org]
45
+ - Keys: L = labels · F = fit · Esc = close panels
46
+ ```
47
+
48
+ ## Security note
49
+
50
+ The server binds to loopback only by default. Anything else requires `--i-understand-public-bind`. Do not suggest exposing it publicly unless the user explicitly asks.
51
+
52
+ ## Don't
53
+
54
+ - Do not try to call an MCP tool to "open" the viewer — it's a separate process the user launches in their shell.
55
+ - Do not promise screenshots; this skill doesn't render. The browser does.
56
+ - Do not skip the security note when suggesting non-default flags.
@@ -0,0 +1,64 @@
1
+ ---
2
+ name: sf-what-broke
3
+ description: Identify what regressed in an org since a recent deploy or snapshot using point-in-time diffs.
4
+ triggers:
5
+ - "what broke"
6
+ - "post-deploy regression"
7
+ - "since deploy"
8
+ - "what changed since last sync"
9
+ - "regression triage"
10
+ tools_used:
11
+ - what_broke
12
+ - point_in_time_diff
13
+ - staleness_check
14
+ ---
15
+
16
+ # sf-what-broke
17
+
18
+ Use when the user is triaging a regression and wants to know which metadata changed between two points in time and which of those changes plausibly explains a reported failure.
19
+
20
+ ## Playbook
21
+
22
+ 1. Establish the two anchors: the "good" snapshot (pre-deploy, last green build, or named checkpoint) and the "bad" anchor (now, post-deploy, or a specific snapshot id). Ask if neither is obvious.
23
+ 2. Call `point_in_time_diff` between the two anchors. Note added / removed / modified nodes and edge churn per layer.
24
+ 3. Call `what_broke` with the same window plus the user's failure signal (failing test name, error stack, broken UI route). The tool ranks suspect changes by reachability to the failure signal.
25
+ 4. Triage in descending suspicion order. For each suspect, summarise the change (what attribute moved) and the dependency path to the failure surface.
26
+ 5. Render the Mermaid path-to-failure diagram returned by `what_broke`.
27
+ 6. Recommend the smallest revert or follow-up investigation (e.g. "inspect `AccountTrigger.handleInsert` — its SOQL selector lost a filter between snapshot X and Y").
28
+
29
+ ## Visualization
30
+
31
+ Render a **`flowchart LR`** path-to-failure diagram. Each suspect change is a node on the left; intermediate dependency hops are middle nodes; the failure surface (test, route, error) is the rightmost node. Highlight the top-suspect path with a thicker edge.
32
+
33
+ ```
34
+ flowchart LR
35
+ S1[ApexClass:AccountTrigger]:::suspect --> H1[Service:AccountSvc] --> F1[Test:AccountTriggerTest]:::fail
36
+ S2[Flow:AccountAfterUpdate] --> H1
37
+ classDef suspect fill:#fee,stroke:#c00
38
+ classDef fail fill:#fcc,stroke:#900,stroke-width:2px
39
+ ```
40
+
41
+ If the suspect set is large (>15 nodes) collapse non-top suspects into a single "other changes" node — readability beats completeness.
42
+
43
+ ## Staleness check
44
+
45
+ Before calling `what_broke`, invoke `staleness_check` for the target org. If the report says stale, surface a warning to the user:
46
+
47
+ > Your ingest is N days old. Run `sfgraph ingest --org <alias>` to refresh, or proceed with the understanding that the graph may not reflect recent changes.
48
+
49
+ Then continue with the playbook.
50
+
51
+ ## Response Shape
52
+
53
+ - **Window** — from `<snapshot/anchor>` to `<snapshot/anchor>`.
54
+ - **Top suspects** — ordered list with confidence, change summary, and the edge path linking them to the failure.
55
+ - **Other changes in window** — collapsed bullet list, not the focus.
56
+ - **Mermaid path-to-failure** — embedded from tool output.
57
+ - **Next step** — single concrete recommendation.
58
+
59
+ ## Don't
60
+
61
+ - Do not propose a code fix without first inspecting the suspect change in detail via `sf-cross-layer-trace`.
62
+ - Do not run write operations against the org. This skill only reads the local graph + snapshots.
63
+ - Do not bury the lead — top suspect goes first, not last.
64
+ - Do not invent snapshots that don't exist; if the "good" anchor is unavailable, say so.
@@ -0,0 +1,74 @@
1
+ ---
2
+ name: sf-wip-impact
3
+ description: Dry-run the impact of uncommitted local changes against the org graph before you commit.
4
+ triggers:
5
+ - "dry-run this change"
6
+ - "what would this PR do"
7
+ - "local impact"
8
+ - "uncommitted changes"
9
+ - "wip impact"
10
+ tools_used:
11
+ - wip_impact
12
+ - wip_test_gap
13
+ - wip_diff
14
+ - staleness_check
15
+ ---
16
+
17
+ # sf-wip-impact
18
+
19
+ Use when the user has local edits they haven't committed yet (working tree, staged or unstaged) and wants to see the downstream blast radius and test gaps before deciding whether to commit or push.
20
+
21
+ ## Playbook
22
+
23
+ 1. Confirm the project root. Default to the current working directory; if the user explicitly names another, use that.
24
+ 2. Call `staleness_check` for the org linked to this project. Warn if stale.
25
+ 3. Call `wip_impact` with default `depth=3`. Capture changed nodes, added nodes (in `full-folder` mode), removed nodes, and the downstream dependent set.
26
+ 4. Call `wip_test_gap` to find which impacted nodes have no Apex test coverage. These are the "at risk" set.
27
+ 5. Optionally call `wip_diff` for a node-level diff (attribute level) when the user asks "what specifically changed in this file".
28
+ 6. Summarise: `changed N`, `added M` (full-folder mode only), `removed K`, `at_risk J without tests`.
29
+
30
+ ## Visualization
31
+
32
+ Render a **`flowchart LR`** impact graph using the 4-class palette emitted by `wip_impact`:
33
+
34
+ - `changed` (yellow): the file you edited
35
+ - `added` (green): new nodes
36
+ - `removed` (red, dashed): nodes your diff deletes
37
+ - `dependent` (grey): downstream nodes your change reaches
38
+
39
+ ```
40
+ flowchart LR
41
+ W1[ApexClass:AccountSvc]:::changed --> D1[ApexClass:AccountCtl]:::dependent
42
+ W1 --> D2[Flow:Account_OnUpdate]:::dependent
43
+ W2[ApexClass:NewHelper]:::added
44
+ W3[ApexClass:OldClass]:::removed
45
+ classDef changed fill:#ffd
46
+ classDef added fill:#cfc
47
+ classDef removed fill:#fdd,stroke-dasharray:4 4
48
+ classDef dependent fill:#eee
49
+ ```
50
+
51
+ If the dependent set exceeds 40 nodes, summarise per category and skip the diagram.
52
+
53
+ ## Staleness check
54
+
55
+ Before calling `wip_impact`, invoke `staleness_check` for the linked org. WIP analysis depends on the existing graph being accurate; a stale graph will under-report dependents. If the report says stale, surface a warning to the user:
56
+
57
+ > Your ingest is N days old. Run `sfgraph ingest --org <alias>` to refresh, or proceed with the understanding that the graph may not reflect recent changes.
58
+
59
+ Then continue with the playbook.
60
+
61
+ ## Response Shape
62
+
63
+ - **TL;DR** — `N changed`, `M added`, `K removed`, `J at-risk without tests`.
64
+ - **Changed nodes** — list with their downstream dependents grouped by edge type.
65
+ - **Test gaps** — bulleted list of impacted classes/methods lacking coverage.
66
+ - **Mermaid impact graph** — embedded.
67
+ - **Suggested next step** — typically `sf-impact-from-diff` after the user commits, or `sf-governor-risk-fix` if Apex was touched.
68
+
69
+ ## Don't
70
+
71
+ - Do not commit, stage, or modify any file — this skill is read-only against the working tree.
72
+ - Do not extrapolate beyond `depth=3` without the user asking; transitive depth >3 tends to be noise.
73
+ - Do not skip `wip_test_gap`; the gap surface is the main reason to run this skill.
74
+ - Do not pretend coverage exists for added nodes — they cannot have tests yet by definition; flag them explicitly.