Instrumentation Skills
Agent-agnostic skills that add production-grade Triton instrumentation to Apex, LWC, and Flows — one file or a whole org — with a human-reviewed diff first.
Adding good logging to an existing codebase is the least glamorous job in the world. You know what a well-instrumented class looks like — entry-point templates, resume-first transactions, logNow in every catch, dmlResults on partial DML — but hand-applying that pattern to a backlog of hundreds of Apex classes, LWCs, and Flows is a slog nobody volunteers for.
The instrumentation skills do that slog for you. They're a set of portable, agent-agnostic recipes — the Triton conventions plus a step-by-step, human-in-the-loop workflow — that any AI coding agent can follow to read a file, classify its structure, and add convention-following Triton instrumentation, then show you a diff and let you accept, tweak, or skip it before anything is written. Nothing is applied blindly.
The skill catalog
The three per-technology skills are the primitives. Everything else composes them.
For the "point at an org and instrument everywhere" experience, package the whole catalog behind one persona — see The Triton Instrumentation Agent.
Running these in your agent
Each skill is a Markdown file describing a capability. How you invoke it depends on your agent, but the behavior is identical.
Claude Code
Copy two folders from the Triton repository into your project: agent-skills/ (the skills) and .claude/commands/pharos/ (the slash commands). Each command reads agent-skills/<skill>.md from the project root, so both must be there. Then call it, e.g. /pharos:instrument-apex <path>.
Cursor
Add the skill as a Command or a Rule, then invoke it from chat, or @-mention the skill file and give it the path.
GitHub Copilot
Reference the skill file in your prompt (or add it to .github/copilot-instructions.md) and ask it to instrument the file.
Windsurf / Codex CLI / others
Point the agent at the skill file and the target path, e.g. "Follow instrument-apex.md to instrument AccountService.cls."
Any agent
Paste the skill's instructions plus the target file and ask it to apply them. The diff-review loop still applies — you approve before anything is written.
The workflow — human in the loop
Every per-file skill runs the same seven-beat loop. The important part is Step 4: the skill never writes to your file until you've seen the diff and said yes.
Step 0 — Prerequisites. Confirm the Salesforce CLI (
sforsfdx) is installed and a default org is connected. The Flow skill additionally verifies that Triton is installed in the target org (itsTritonFlowinvocable has to exist). If a prerequisite is missing, the skill stops and tells you exactly what to run.Parse arguments. Read the target path and flags; ask for anything required that wasn't supplied.
Analyze. Read the file and classify its structure — trigger vs.
@AuraEnabledcontroller vs. batch vs. queueable, wired vs. imperative LWC, screen vs. autolaunched Flow — because the transaction and flush pattern differs per structure. This is also where the skill infers the Area.Apply. Generate the instrumented version in memory, following the 2.0 static API and Triton best practices.
Review the diff —
yes/modify/skip. The skill presents a summary plus the key changes. Sayyesto apply,modifyto give free-form corrections (it re-applies and asks again), orskipto walk away with nothing written.Write. On
yes, the instrumented content is written back to the original file — no new files, no renames.Optional deploy. If you passed
--deploy(or answer yes when asked), the skill runssf project deploy startfor just the file or component directory it touched.
Two rules every skill enforces
Cacheable and
@wireApex never stitches through Platform Cache.@AuraEnabled(Cacheable=true)methods — what@wirecalls — can't write to Platform Cache, soTriton.withCache()can't carry a transaction id there and the stitch silently breaks. The skills passtransactionIdexplicitly and callTriton.resumeTransaction(...)on the server instead. See LWC and Apex → With@wire.Per-log data scales with the level.
ERROR,WARNING, andINFOlogs carry the most context — serialized inputs and state, plus every related record id.DEBUGcarries named values only, andFINE/FINER/FINESTstay terse markers. The skills add more low-level tracing points, becauseLog_Level__mdtdecides at runtime which ones are kept, but keep each one lean. Secrets and personal data are never logged at any level: the skills serialize a redacted copy, or leave the field out.
Instrumentation at scale
The single-file loop is the primitive. The real payoff is running it across a backlog — and you no longer have to hand-loop it.
Because the skills follow shared conventions — resume-first transactions, one Area per feature, logNow + rethrow in catches, flush at boundaries — you get consistent instrumentation no matter who (or what) runs them. There are two ways to work at scale:
Drive the primitives yourself. Run
instrument-apexdown a list of classes in a service layer, reusing one--areaso the feature groups cleanly; loop an agent over a directory of LWCs or.flow-meta.xmlfiles, reviewing each diff as it comes; add--deployonce you trust the pattern for a batch.Let the orchestrator do it.
instrument-orginventories your whole project, prioritizes it using the Legacy Code Logging Rollout strategy, threads one Area per feature across Apex/LWC/Flow, and works the backlog with review checkpoints and batched deploys — then hands you a coverage report.
OpenTelemetry readiness
Triton 2.0's distributed tracing — a transaction id that correlates a whole operation, plus Span_Id__c / Parent_Span_Id__c for parent-child structure — gives your logs a shape that maps cleanly onto OpenTelemetry's vocabulary: trace, span, and parent span. The instrumentation skills are how you get that shape everywhere without hand-writing it: the Apex skill threads one transaction id through async hops, the LWC skill's timeBackendCall carries span context across the call, and the Flow skill stitches the Flow leg into the same transaction.
Where to go next
Instrument Apex — classes and triggers, transaction resume/stitching, DML and callout logging.
Instrument LWC —
c/triton,bindToComponent,timeBackendCall, transaction stitching to Apex.Instrument Flows — the
TritonFlow"Log" action, fault-path logging, the never-pass-a-collection rule.Instrument the Org — the orchestrator that rolls the three out across a whole project.
Audit Logging Coverage — see where the gaps are before you start.
Migrate to 2.0 · Set Up Standards — convert 1.x code and lock in CI guardrails.
The Triton Instrumentation Agent — package the whole catalog as one reusable, agent-agnostic persona.
Spans & Distributed Tracing — the tracing model these skills roll out, and the OpenTelemetry mapping.
Last updated