coverage-trend
Skill1 starsChanged 7 months agoMITView on GitHub
Persist Apex code-coverage results over time and surface regressions. After each /argo:test-coverage run (or via this skill directly), append the result to a per-project history file and show the trend. PR-mode diffs against the baseline.
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
- dead-codeSkill
- dependency-graphSkill
- deploySkill
- destructive-changesSkill
- diff-deploySkill
- erdSkill
- 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
4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
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
- Distinctive: line 62
Read the last N records. Output a Markdown table:
- Very specific: line 98
Run diff internally. Exit 1 if any class regressed by more than a configurable epsilon (default 0.5 percentage points), exit 0 otherwise.
- Very specific: line 112
Only persist on success: If sf apex run test fails, don't append a noise record
- Distinctive: line 114
History is append-only: Never rewrite past lines — even if a class is renamed.
≈ “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 tracking Apex coverage over time so regressions are visible. The history is per-project, stored in ${CLAUDE_PLUGIN_DATA}/argo/coverage/<project>/history.jsonl (one JSON line per run).
Read Project Config First
source "${CLAUDE_PLUGIN_ROOT}/hooks/lib/config.sh"
PROJECT_NAME="$(sf_config_get '.project.name' "$ENV")"
COVERAGE_TARGET="$(sf_config_get '.quality.codeCoverageTarget' "$ENV")"
SLUG="$(printf '%s' "$PROJECT_NAME" | tr '[:upper:] /' '[:lower:]_-' | tr -cd 'a-z0-9_-')"
HISTORY_DIR="${CLAUDE_PLUGIN_DATA:-$HOME/.claude/plugin-data}/argo/coverage/${SLUG}"
mkdir -p "$HISTORY_DIR"Input
$ARGUMENTS:
- (empty) — run
sf apex run test --code-coverageand append the result to history record <coverage-json>— accept a coverage JSON from another tool (e.g., the existing/test-coverageskill); append it to historyshow [--last N]— print the last N runs (default 10) as a Markdown tablediff [--vs <ref>]— compare current coverage against the run at git ref<ref>(defaultmainHEAD)pr— PR mode: compute diff vs.main, exit 1 if any class regressed, exit 0 if same or improved--target-org <alias>/--env <name>— for thesfquery in default mode
Steps
1. Run coverage (default mode) or accept input (record mode)
Default:
ORG="$(sf_config_get '.platform.defaultTargetOrg' "$ENV")"
sf apex run test --target-org "$ORG" --test-level RunLocalTests --code-coverage --result-format json --wait 30 > /tmp/cov.jsonCapture per-class coverage from the JSON. Compute project-wide rollup.
2. Build the history record
{
"ranAt": "2026-04-28T12:30:00Z",
"git": { "branch": "main", "sha": "abc123", "isDirty": false },
"overall": { "coveredLines": 12450, "totalLines": 14200, "percent": 87.7 },
"perClass": [
{ "name": "OrderService", "covered": 142, "total": 150, "percent": 94.7 },
{ "name": "OrderApiClient", "covered": 38, "total": 60, "percent": 63.3 }
],
"target": 85,
"passed": true
}Append to ${HISTORY_DIR}/history.jsonl as a single line.
3. show [--last N]
Read the last N records. Output a Markdown table:
# Coverage Trend: <project.name>
| Run | Overall | Δ | Below Target |
|----------------------|---------|--------|--------------|
| 2026-04-28T12:30:00Z | 87.7% | +0.2% | OrderApiClient (63.3%) |
| 2026-04-27T18:14:22Z | 87.5% | -0.5% | OrderApiClient (63.3%) |
| ...4. diff [--vs <ref>]
Find the most recent history record whose git.sha matches <ref>'s HEAD. Compare class-by-class against the latest record. Output:
# Coverage Diff: HEAD vs main (abc123)
## Improved
- OrderService: 91.2% → 94.7% (+3.5%)
## Regressed
- OrderApiClient: 72.0% → 63.3% (-8.7%) ⚠️
## New classes (no baseline)
- DiscountEngine: 85.0%
## Removed classes (baseline only)
- (none)
## Overall: 87.5% → 87.7% (+0.2%)5. pr mode
Run diff internally. Exit 1 if any class regressed by more than a configurable epsilon (default 0.5 percentage points), exit 0 otherwise. Print the diff regardless.
CI integration: emit findings (one per regression) following the standard contract:
ruleId: "COV-REGRESSION"(warning) — class regressed but still ≥ targetruleId: "COV-BELOW-TARGET"(error) — class belowquality.codeCoverageTarget%
6. Exit codes
- 0 — clean, or
show/diffinformational - 1 —
prand any regression > epsilon, or any class below target - 2 — query/setup error
Rules
- Per-line aggregation, not per-method. Salesforce reports lines covered/total; that's the source of truth
- Only persist on success. If
sf apex run testfails, don't append a noise record - Don't track tests; track production classes. Skip anything ending in
naming.apex.testSuffix - History is append-only. Never rewrite past lines — even if a class is renamed; the rename is its own diff event
- Truncate display.
showdefaults to last 10 runs to keep the table readable
Consumers
- CI pipelines run
coverage-trend prto gate merges on coverage regression /argo:release-notespulls the latest record to include "Coverage: X%" in release notes@qaconsults the history when a class drops below target to recommend which tests to add
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
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.

