/dstack-core:tests-practicesfrom DStack Core
Guides test-first development with invariant-based and adversarial tests that name a fault and use an independent oracle, surviving refactors.
Ships in DStack Core. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Classic agent TDD rots in a known way: the red test is written as a polite specification, the implementation drifts, and the agent, without noticing the drift, bends fixtures, weakens assertions, and patches contracts with ad hoc changes until green appears. The work is paid for twice and the suite proves nothing. This skill inverts the stance. Red is an attack, not a description: before any implementation, write the tests that try to break the contract, through boundary raids, invariant violations, error-path probes, and adversarial orderings. Green means the attacks failed to break the code, never that a saved output was matched.
This job is reversible and local. You write only named test and source files, and rollback is VCS revert of the implementation commit. There is no remote mutation. Tests and implementation never change in the same repair step.
| Target and requirement | The observable behavior or invariant to build or fix, and the confirmed public seam where it is observed. The seam is confirmed with the user before any test exists at it. When the existing specification, types, or requirements are already adequate, state the invariant directly; no separate contract file or detached workflow is required. Required. | | Contract source | The spec, caller evidence, worked literal, interface definition, or stated invariant the attacks derive from. Never the implementation's own logic. Required. | | Test framework | The project runner. If it is absent and not discoverable, stop and report. Never install one unasked. Optional when discoverable. |
Every test in the suite is admitted only when it states all five of the following, in the test name or its leading lines:
Display formatting) are never oracles. An oracle being inline rather than in a fixture file does not make it strong.Two further rules admit no exception. Each test binds the public seam only and must survive behavior-preserving refactors such as renames, restructures, and internal reimplementations. Distinguish semantic laws (formal preconditions, postconditions, state transitions, conservation laws, algebraic invariants, and error classifications) from shape or wording pins (superficial formatting, snapshot files, or declarative formatter phrasing). Semantic laws are the mandatory target of tests; shape or wording pins are banned as proof. A test that breaks under a refactor which preserved observable behavior is implementation-coupled: delete it, never repair it by coupling the code back to it. And there is no weak-test escape: history, coverage count, green status, prior approval, or single-occurrence regression fear never admits a test that fails this bar.
Never weaken an assertion, bend a fixture, skip a test, or loosen a behavioral contract to reach green. Any such edit during a green phase is a stop-the-line violation: revert it, then either fix the implementation or declare a contract change and re-attack from red. Never edit a test and its implementation in the same repair step; test-fixing and code-fixing are separate cycles, each with a named justification. Never accept a tautological attack (expected value recomputed the way the code computes it) or an implementation-coupled one (mocks internals, tests private methods, asserts call counts or order, reads storage around the interface). Attacks fire at confirmed public seams only. Banned as proof are fixture oracles (saved expected outputs), contract snapshots, output format pins (matching serialized shapes or declarative formatter prose), naive fixed single-path regressions unsubsumed by a quantified property, and coverage, history, or count-driven retention. Reusable inputs stay allowed. Oracles stay independent.
This skill is not for hardening existing code with no behavior change (that is tests-adversarial) or for deleting weak tests (that is tests-purge-unneeded).
Work one vertical slice at a time, in this order:
When a step fails, the rule is simple: a green reached by test-bending means revert the test edit, keep the red, and fix the code or declare the contract change aloud. An oracle violation means discard the oracle, re-derive it from the independent source, and if none exists, stop and report the missing prerequisite. An attack that cannot be written (unclear requirement, unconfirmed seam, no framework) means stop and report; never proceed to implementation on an unattacked contract. An implementation that cannot survive within the slice means revert the implementation, keep the attacks, and try a different minimal approach or stop and report. A mutation probe that survives means sharpen the attack before touching more implementation. An existing suite that breaks means revert and narrow the change until only the new slice behavior moves. Completed slices stand; a blocked cycle never invalidates prior green slices and never claims the done state. A partial result is the red suite plus its output, never a weakened green.
Per slice, in order: attack files, red run output with failure modes matched, green run output, mutation-probe evidence, and the implementation commit SHA. Multi-step work prepends the plan document path.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
tdd, test-design, invariant-testing, adversarial-testing, red-green
npx claudepluginhub gosuda/dstack-skills --plugin dstack-core89 skills in this plugin
/abstract-wellUse when the user wants to classify abstractions as useful, bad, or busy and keep one shallow level. Not for tasks requiring source or remote-system changes./architectUse when non-trivial code needs a design, codebase architecture needs improving through survey and deepening, or one module needs targeted interface narrowing, seams, or testability. Not for rendered visual artifacts, deploy, or irreversible changes./architecture-simplificationUse when the user explicitly asks to simplify an architecture, collapse modules or crates, or cut a dependency graph within approved boundaries. Executes an approved layout direction slice by slice. Not for single-module cleanup: use code-simplification. Not for layout planning from nothing: use architect. Not for blind re-derivation: use breaking-driven.Other plugins' skills for the same job