Instrument the Org
The instrument-org skill runs the Apex, LWC, and Flow skills across a Salesforce project — inventory, prioritize, instrument, deploy — in reviewed batches.
The instrument-org skill is the "instrument everything" entry point. Point it at a project (or a subtree of it) and it inventories every Apex class, trigger, LWC, and Flow, prioritizes the backlog the way the Legacy Code Logging Rollout strategy recommends, and then drives instrument-apex, instrument-lwc, and instrument-flows across it — feature by feature, with one Area per feature and a review checkpoint at every batch boundary. When it's done, it hands you a coverage report.
It is not a new instrumentation engine — it's an orchestrator over the three primitives. Every file it touches is instrumented by exactly the same skill, following exactly the same conventions, that you'd run by hand.
Usage
/pharos:instrument-org [<path>] [--area-map <file>] [--phase <n>] [--tech apex,lwc,flow] [--batch-size <n>] [--deploy] [--dry-run]<path>
Project root or a subtree (e.g. force-app/main/default/). Defaults to the detected project root.
--area-map
A file (or inline list) mapping folders/features to Area strings, so the skill doesn't have to infer every Area. Inference is the fallback.
--phase
Run only one rollout phase (see The rollout phases). Omit to run phases in order with checkpoints between them.
--tech
Restrict to some technologies, e.g. --tech apex,flow. Defaults to all three.
--batch-size
How many files to instrument before pausing for a batch review. Defaults to a feature or folder boundary.
--deploy
Deploy each batch after you accept it. Without it, the skill asks per batch.
--dry-run
Inventory and plan only — produce the report and the proposed order, write nothing.
How it works
Step 1 — Inventory
The skill walks the project and catalogs everything instrumentable:
Apex classes and triggers (skipping
@isTestclasses).LWCs (component directories under
lwc/).Flows (
.flow-meta.xml), noting<processType>.
For each item it records the current instrumentation state — already-instrumented, partially instrumented, or untouched — so a re-run only fills gaps and never double-instruments. This is the same signal audit-logging produces.
Step 2 — Group into features
Raw files aren't the unit of work; features are. The skill clusters related code so a whole feature's logs share one Area and one correlated transaction:
A trigger, its handler class, and the service classes it calls.
An LWC and the Apex controller it calls (and any Flow that controller invokes).
A screen Flow and the subflows/record operations beneath it.
It resolves the Area for each cluster once — from your --area-map, from an Area already used by related code, or by inference — and reuses it across every file in the cluster. This is what keeps a feature's logs grouping cleanly in Pharos.
Step 3 — Prioritize (the rollout phases)
The backlog is ordered by value and risk, not alphabetically — mirroring the Legacy Code Logging Rollout phasing:
Edge entry points. Public
@AuraEnabledcontrollers, REST endpoints, Queueables, Batchstart/finish, global callouts, and the LWCs/Flows that call them. Highest visibility, well-understood boundaries — and where cross-boundary transaction correlation gets established.High-value internals. Trigger handlers and core service classes.
Broad sweep. Low-risk utilities and everything remaining; retire the last
System.debug.
The skill also respects the comfort tiers from the rollout guide: it flags business-critical, low-comfort code (old, untested, no author) and proposes minimal instrumentation there — or defers it for a human — rather than aggressively rewriting code nobody understands.
Step 4 — Instrument, batch by batch
For each batch (a feature, a folder, or --batch-size files), the skill runs the matching per-technology skill on every file, threading the cluster's shared Area and stitching transactions across the LWC → Apex → Flow legs. Then it pauses:
You review the batch as a unit — the same yes / modify / skip choices as a single-file run, plus pause to stop and resume later. Nothing in the batch is written until you accept it.
Step 5 — Deploy (optional, per batch)
With --deploy (or on confirmation), each accepted batch deploys before the next one starts, so instrumented code lands incrementally and you can watch logs appear in Pharos as you go. A failed deploy stops the run without reverting files, exactly like the single-file skills.
Step 6 — Coverage report
At the end (or on pause), the skill writes a summary: how many files of each type were instrumented, skipped, or deferred; the Areas assigned; transactions correlated; and what's left. Re-running picks up where it left off.
Staying in control at scale
The point of the human-in-the-loop diff doesn't disappear just because you're running org-wide — it moves to the batch boundary:
Checkpoints, not a firehose. You approve a feature at a time, not hundreds of files at once.
Resumable.
pauseand re-run; the inventory tracks what's done.--dry-runfirst. See the full plan and Area assignments before a single write.Defers instead of guesses. Low-comfort, business-critical code is surfaced for a human rather than rewritten blindly.
Where to go next
Audit Logging Coverage — the read-only map to run before you start.
Instrument Apex · Instrument LWC · Instrument Flows — the primitives this skill orchestrates.
Legacy Code Logging Rollout — the strategy the phasing is built on.
The Triton Instrumentation Agent — package this behind a persona for a "point at an org" experience.
Set Up Standards — lock in CI guardrails so instrumented code stays instrumented.
Last updated