AGENT SKILL

test-strength

Prove a load-bearing test can actually fail, and that it fails for the right reason. Break the thing it guards, watch it go red, restore — then check it stays green on a valid-but-unusual input, because red on a mutant proves discrimination, not correctness. USE WHEN a suite is written or changed, a guard is trusted, a gate reports zero, or a green result is about to be cited as evidence. NOT FOR reviewing a diff for defects (audit-review-fanout), or running a suite to see it pass (`bin/test-suite-run.sh`).

License 许可
Apache-2.0
最近更新
2026-11-15
Stars
★ 0
Forks
0

01 前言 Front Matter

name
test-strength
description
Prove a load-bearing test can actually fail, and that it fails for the right reason. Break the thing it guards, watch it go red, restore — then check it stays green on a valid-but-unusual input, because red on a mutant proves discrimination, not correctness. USE WHEN a suite is written or changed, a guard is trusted, a gate reports zero, or a green result is about to be cited as evidence. NOT FOR reviewing a diff for defects (audit-review-fanout), or running a suite to see it pass (`bin/test-suite-run.sh`).
disable-model-invocation
true

02 资源文件 6

03 SKILL.md 正文

test-strength — make green mean something

Path root: ~/port/harbor — every ./-prefixed path below resolves there, not against the directory this skill is installed into. Paths with no ./ ship beside this file. Checked by bin/drift-reference-check.sh REF-9 where the skill is READ; the ../../ form this replaced was green in the repo and dead from ~/.claude/skills/test-strength/ (harbor#462) — this skill's own pointer to the prove-targets contract handed the reader nothing.

policy/constitution.md §№2 rule 10 says a test that cannot fail is worse than no test. This is the procedure that discharges it, and the reason it exists as a file is that the rule had no mechanism: measured 2026-08-27, 2 of 44 bin/*-test.sh suites plant a violation at all, and nothing distinguishes a suite that has been checked from one that has not.

Invoked-only, deliberately. The always-on surface is over its ceiling; a resident description would be paid in every session to be useful in a few. Reach for it by name, or from skills/README.md.

The three checks, and only the first is the famous one

A suite that passes all three discriminates. A suite that passes only the first may be matching far too much and still going red on every mutant.

1 · It goes red on a planted violation. Break the exact thing the test claims to guard — flip a comparison, drop a guard clause, return a wrong constant, widen a bound. Run it. It must fail. If it passes, the assertion is vacuous: fix the assertion, never the code. Restore, confirm green.

2 · It stays green on a valid-but-unusual input. The odd-shaped legitimate case: the 48-character label against a 48-character cap, the quoted string, the diacritic, the empty-but-lawful list. This is the check a mutant sweep can never generate, because mutants are derived from the thing under test — so an over-broad rule that refuses everything passes check 1 perfectly and fails here. policy/constitution.md §№2 rule 11 is the consequence: a rule that blocks ordinary work gets switched off, and a switched-off guard protects nothing.

3 · A gate that reports ZERO gets an eligible planted violation. A zero is two different claims — the system is clean and the harness looked at nothing — and they are indistinguishable from the outside. Plant one violation the gate is genuinely in scope to find, and watch the count go to one. Until it does, the zero is the harness's, not the system's.

The mechanism

A rule with no mechanism is a wish, and until 2026-08-30 this file was one. bin/prove.sh is the mechanism: it mutates a copy of the artefact a gate guards, runs the gate, and reports every mutant the gate did not notice.

sh skills/test-strength/bin/prove.sh --list        what is declared
sh skills/test-strength/bin/prove.sh <target>      measure one gate
sh skills/test-strength/bin/prove.sh --self-test   prove the engine goes red

It discharges check 1 by construction (a survivor is a mutant that lived), check 2 by refusing to score a target that declares no valid-but-unusual control, and check 3 by reporting every empty class with a reason rather than a zero. The declaration format is ./contracts/prove-targets.md; lint C6 keeps the declarations gate-shaped between runs.

Bound both sides of every threshold

A cap, a floor, a window, a count: test the value that must pass and the value that must fail. A one-sided test on a < 5 floor stays green against a floor of 0 (refuses nothing) or 999 (refuses everything). Both are total failures of the thing being guarded and both read as coverage.

Where the check goes once it passes

Into the suite, not into a commit message. A hand-run mutation is evidence that expires the moment the session ends; the next reader cannot tell a checked suite from an unchecked one, which is exactly the state 42 of Harbor's suites are in. Where the mutation can be scripted, script it. Where it cannot, say in the suite's own header what was flipped and what went red — a comment naming the mutation is recoverable evidence, and prose in a PR body is not.

Coverage is per-case, not per-run

A sweep faithful in every row can still be blind: sixteen rows that all share one provider prefix exercise one path sixteen times. Enumerate the dimensions the input actually varies on and check that more than one value of each appears. The variants that differ are the ones nobody asks for unless they are written down.

Gotchas measured on this box

  • grep here is ugrep, carrying -I --ignore-files: it skips binary and gitignored files silently. Never rest a negative assertion on it — "the mutant left no trace" may mean grep declined to look. Build file lists with find.
  • A stale __pycache__ keeps a killed mutant alive. A same-length mutant written and restored inside the same second can keep loading from a .pyc, so the run measures the original while reporting on the mutant. Clear the cache between rounds.
  • timeout and gtimeout do not exist here. A mutation loop that hangs hangs forever; bound it in the harness itself.
  • Restore is not optional and not automatic. Copy the target aside, or mutate a copy and point the suite at it — a mutation left in place is a live defect wearing a test's clothes.

Not this

  • Not a coverage number. Executing a line is not asserting on it; a suite can reach every line and catch nothing.
  • Not the whole suite at once. This is expensive. Reach for it on the tests whose green is about to be cited — a guard, a contract, a parser, an invariant — not on every assertion.
  • Not a forced green. An equivalent mutant, an unreachable branch, or a defensive check the types already guarantee are all legitimate survivors. Say which ones you did not kill and why. Contorting a test until it asserts the mutant's own behaviour is worse than the hole it was hiding.

Provenance

Re-authored for Harbor from yard's verify-test-strength (L3, plugins/project-init-workflow/), read 2026-08-28. Not a copy and not a move: contracts/host-profile.md makes the box profile the only up-pointing edge, so an L0 session may not depend on a Yard plugin — the idea comes up, the file does not. What changed in the re-authoring: the upstream leads with a Python mutmut runner and treats the manual loop as a fallback, which inverts for a POSIX-sh estate where the manual loop is the only path; and checks 2 and 3 above are Harbor's, from ./docs/explanation/verification-expanded.md.

04 同仓库更多 Skills

VytCepas
VytCepas/harbor-core

systems-thinking

For a problem where the obvious fix has already failed or made things worse. The cause usually lives three or four layers below the events that keep appearing; this finds that structure, matches it against the ~10 known archetypes to get the canonical intervention, and checks second-order effects before you commit. Event-level fixes are what it exists to replace. USE WHEN systems thinking, causal loop, feedback loops, archetypes, leverage points, iceberg model, fix the system, why does this keep happening, recurring problem, second-order effects, the fix made it worse, this keeps coming back. NOT FOR incident causal chains (use root-cause-analysis).

★ 0
VytCepas
VytCepas/harbor-core

red-team

Adversarial analysis deploying parallel expert agents to stress-test ideas, strategies, and plans — decomposes into atomic claims, attacks them, then steelmans and counter-argues, producing severity-ranked findings with remediation. USE WHEN red team, attack idea, counterarguments, critique, stress test, devil's advocate, find weaknesses, break this, poke holes, strongest objection. NOT FOR collaborative debate to find best path (use council).

★ 0
VytCepas
VytCepas/harbor-core

first-principles

Physics-based reasoning framework (Musk methodology) that deconstructs a problem to irreducible fundamental truths, classifies every element as hard constraint, soft constraint, or assumption, then reconstructs the optimal solution from fundamentals alone. USE WHEN first principles, fundamental truths, challenge assumptions, real constraint, rebuild from scratch, start over, physics first, question everything, reasoning by analogy. NOT FOR structural feedback loops (use systems-thinking).

★ 0
VytCepas
VytCepas/harbor-core

company-help

Explains this laptop's safety settings in plain words: why a step was stopped, asked about or is waiting for an admin, where work files belong, and how to get a website allowed. USE WHEN a step is refused or blocked, a permission question appears, a site or download fails, or someone asks what Harbor is or where to save files. NOT FOR changing a setting: nobody here can.

★ 0
VytCepas
VytCepas/harbor-core

status-suggest-scan

Runs the repeated-work scan and says in plain words what a person keeps doing by hand. USE WHEN a person asks what they repeat or what Harbor could take over. NOT FOR building what it finds.

★ 0
VytCepas
VytCepas/harbor-core

skill-catalog

The index of every skill, `harbor` verb, agent-facing bin tool and credentialed CLI on this box, each with the path or exact command; most are hidden from your listing and this is the only route to them. USE WHEN you are about to wait on CI or a PR, run a suite, push, merge or do any scripted chore by hand, or do reasoning work by hand: design an eval or a pass^k study, run a red-team pass, chase a root cause, reason from first principles, get independent perspectives, write or optimise a prompt, extract a paper, generate options. ALSO WHEN what skills do I have, list skills, find a tool, is there a harbor command for this, how do I wait on CI, skill-book (its old name). NOT FOR invoking a skill already in your listing.

★ 0