/lethal:lethal-mutation-testingfrom lethal
Runs LethAL mutation testing against a Business Central AL project to find weak or missing tests. Publishes a changed build to a BC sandbox or dev container. User-invoked only.
Ships in lethal. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
LethAL breaks AL code on purpose, one small change at a time, and runs the test suite against each break. A change the tests catch is killed; one they miss is a survivor; one no test executes is no-coverage. It answers what coverage cannot: not "did this line run" but "would anyone notice if it were wrong".
Full reference: docs/using-lethal-from-an-agent.md in the LethAL repository.
--stop-hung-sessions lets LethAL end a BC session on the user's server, so it needs their yes.
Ask for it ONCE, up front, and recommend it on a sandbox: a mutant that turns a loop into an
infinite one is ordinary on real code (remove-assignment on a loop's exit flag did it twice in
one run), and without the flag each one costs the whole budget, a quarantine, and a full
redeploy-and-baseline on --resume, roughly ten minutes on a hosted sandbox. With it the same
mutant is stopped and scored timeout-killed, and the run continues.Always this order, and stop at the first step that fails: each step is cheaper than the next, and each one catches what would otherwise fail later, after a publish.
Then, if the user wants it, harden a survivor (step 6).
First time on a project, lethal init --project <app-dir> writes a lethal.config.json with
three free object ids from the app's own range; the server, company and login are placeholders the
user fills in. A config holds credentials: do not read it into the conversation. That config is for
bcdev; an al-runner-v3 run needs an alRunnerV3 section instead (the README's "Running without a
BC server" section has it).
lethal doctor --config lethal.config.json --json
Read-only, seconds, reports every pre-flight problem at once. Exit 0 = all checks passed, 1 =
at least one failed. Stdout is one JSON envelope: the report is its data, so branch on
data.checks[].name. If status is "error", doctor could not run at all: read error.code and
error.nextSteps. When it passes, read data.notChecked: the publish ceiling and baseline test
health are NOT covered by a green report.
Fix what it names before running. It is much cheaper than discovering the same problem mid-run.
If it fails, by check:
control-version: the server's LethAL Control app is older than this client needs. Republish it
from the LethAL release (the README says how); the client refuses an older one.quarantine: an earlier run stopped trusting this server. Fix what that run reported, then
lethal clear-quarantine --config lethal.config.json.lease: another run holds the server. Wait for it. Only when no LethAL run is alive anywhere
against that server, lethal force-reset-lease frees it; ask the user first.environment, company, tool-paths, alc-runtime: the server, the company name, or the AL
compiler. Each check's text names what to change.lethal run --project <app-dir> --dry-run
Executes nothing. Reports how many mutation sites exist and how many would deploy. An unscoped run
on a real project is refused by default above 1,000 sites, because it costs days and usually cannot
publish at all. Expect to scope: narrow with --only "<glob>" and dry-run again until the count
is one the user accepts. --allow-large-run lifts the refusal; use it only on the user's word.
lethal run --project <app-dir> \
--tests <test-app-dir> \
--backend bcdev \
--config lethal.config.json \
--only "src/Posting/**" \
--tests-only "src/Posting/**" \
--out report.json \
--progress-out events.ndjson
--backend bcdev is authoritative. --backend al-runner-v3 runs offline with no BC server and
is NOT authoritative: it is a mock runtime, so never quote a score from it. It publishes nothing,
so it needs no restore step.--only and --operator choose which mutants run and cannot change a verdict. --tests-only
chooses which tests run and CAN: excluding a killing test reports its mutant as survived.events.ndjson in a tight loop; read it when the run
ends, or tail it if the user wants progress. A mutant's covering tests run in ONE server call
(LethAL Control 1.0.0.29 or newer; older is refused up front), so survivors are no longer the
expensive half. Leave --max-methods-per-call, --request-ceiling-ms and --no-group-runs
alone unless the run warns group-runs-inert.Exit codes: 0 completed, 1 error, 3 quarantined, 4 nothing scored. 4 means every
mutant errored and the run measured nothing: no score, no survivors, read the failure notes and
fix the cause (there is nothing to resume). 3 means the run refused to vouch for
its own verdicts, not that the tests failed. Do not report verdicts from a quarantined run;
--resume continues it once the cause is fixed. On bcdev a resumed run re-scans the test app: a
test with a reachable call that may open a TestPage is reported as refused and never sent, whatever
the saved run recorded for it, and any saved mutant verdict it took part in is scored again
without it (warning resume-testpage-rescored).
If the run fails:
3: read the quarantine reason in the output, fix it, run lethal clear-quarantine --config lethal.config.json if the server was quarantined, then run the same command again with
--resume.4: fix the cause the failure notes name, then run again. There is nothing to resume.1: the error names the cause. A refusal before the publish leaves the server as it was;
after a publish, go to step 5 anyway.--only. If the server itself changed since,
lethal clear-ceiling --project <app-dir> --config lethal.config.json forgets the old
measurement.lethal explain report.json --top 15
Prints JSON. Reads only that file: no server, no database, no config.
survivorSelection first. { total, shown, omitted, rankedBy }, always present. If
omitted is above zero, the survivor list is a ranked prefix, not the whole set.score carries mutationScore with reliability and scoreDescribes. Quote the number only
with those. Also read caveats: a narrowed run's score describes the slice, not the project, and
a red baseline means some mutants could not be scored at all.survivors[]: executionProven decides what a row is worth. true means a test is measured
to have executed the mutated procedure. false means some test touched the object and nothing
proves the mutated code ran, so it may be no finding at all. reach: "covered-but-unreached"
means a test enters the procedure and never reaches the statement, which calls for a new case
rather than a stronger assertion.meaning is not. Never regex it; every machine-usable
fact is already a field.For the full record rather than the interpretation, read report.json itself
(schemaVersion: 3), and read its validity block before quoting anything.
On bcdev the changed build stays published after the run, failed runs included, under a version
above the app's own. BC then refuses the user's own build at its old version, and unpublishing the
changed build first does not help. Tell the user, every time:
[lethal] the instrumented build is still published as version .... It prints it even when the run failed after publishing.app.json version above it (the line names the smallest), build, and publish.Write a test that should kill a survivor, then ask lethal verify whether it does. LethAL never
writes the test. Take artifactId, batchIndex and mutantCode from one explain survivor row,
pass the run's database as --db (by default <app-dir>/lethal.sqlite) and the run's config as
--config, and name the test project you edited as --tests. The example is for the run above
with <app-dir> as app and <test-app-dir> as tests:
lethal verify --db app/lethal.sqlite --artifact 0123456789abcdef0123456789abcdef --survivors 0/M0004 --tests tests --config lethal.config.json
A gap from explain.gaps names its gap id and artifact; one verify call proves the whole gap: pass
that artifactId as --artifact and the gapId as --survivors.
It prints JSON on stdout (redirect it; --out is refused) and works on bcdev only. A call that runs
any survivor publishes the test project, and the test app stays installed afterwards.
Exit codes: 0, 1, 3, 4, 5, 6. 1 is an error with no JSON (an argv it refuses included). 0 means every named survivor was killed and every new
test is stable; it is also what you get when every survivor skipped, which measured nothing. 3 is
quarantined, as for a run. 4 means every non-skipped survivor errored and verify measured nothing.
5 means not every named survivor was killed, or a new test is not stable. 6 means verify refused
before measuring: branch on refused.reason; the reference says what to do for each.
Repeat until verify exits 0, then make the record with a fresh lethal run, never --resume.
validity before quoting mutationScore.executionProven first.events.ndjson, every verdict line is PROVISIONAL until a session-finished event appears:
a later batch-invalidated can retract one.3 means the verdicts are not vouched for. Do not report them.4 means the run measured nothing. There is no result to report, only a cause to fix.killed is proof for the installed build; the record is a fresh lethal run, never
with --resume. skipped is not a measured kill or survival: it is a reader's mark.Do not read these absences as findings:
GuiAllowed=No, ClientType=ODataV4).TestPage cannot be scored, and one can hang a whole run.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
mutation-testing, business-central, al-language, test-quality, lethal
npx claudepluginhub sshadows/lethal --plugin lethalOther plugins' skills for the same job