/dstack-core:contract-drivenfrom DStack Core
Adds explicit, testable contracts (preconditions, postconditions, invariants) at code boundaries to catch bad input and state early. Guides naming, enforcement layer selection, and error handling.
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.
Put explicit, testable guarantees at the boundary where two pieces of code meet, so bad input and bad state fail loudly at the edge instead of corrupting the interior. Use this whenever you cross a public API boundary, guard a complex invariant, or harden untrusted input and integration seams. It does not cover remote or irreversible changes: everything you write is local types, assertions, validators, and tests at the boundary, and rollback is deleting the added code or reverting the boundary change.
You need the requirements or specification for the operation being contracted, and the target source file or module holding the boundary, invariant, or untrusted seam. Existing tests that must keep passing come along when there are any. If a requirement you need is missing, stop and report it; never invent contracts or widen scope to fill the gap.
Extract PRE, POST, and INV conditions from the requirements and give each one an ID plus a one-line description, for example PRE-1: amount > 0, POST-1: balance == old(balance) - amount, INV-1: balance >= 0. Do not write any implementation until every planned contract has its ID. Drop any contract that merely restates the implementation (ensures(result == x - y) on a subtract function is contract fatigue, not a guarantee). Language-specific annotation shapes live in references/examples.md, and the library or idiom to express them in each stack lives in references/libraries.md.
Prefer static over runtime. Size, alignment, null and type safety, and exhaustiveness belong in the static type system or static_assert; expensive O(n)+ properties belong in test assertions; internal invariants belong in debug-only checks; public API input, and always external or untrusted input, gets active runtime guards. If a property can be verified statically, do not add a runtime contract for it. Every runtime contract you add must actually run: never ship one compiled out or disabled, and never disable one to make a build pass.
When the surface is an HTTP API that returns errors, use one error shape everywhere: a machine-readable code, a human-readable message, and optional details. Map invalid client data to 400, unauthenticated to 401, unauthorized to 403, a missing resource to 404, conflict or version mismatch to 409, semantically invalid input to 422, and server failure to 500 with no internal detail. Never mix throwing, null returns, and error envelopes on one surface.
Relocating a guard or narrowing an adapter re-opens the boundary, so treat the move as the risky part. Enumerate every entry that reached the protected region through the old point, including callbacks, retries, forks, resume and replay paths, and test entries; record coverage or a justified exemption for each and exercise newly covered entries directly. When an adapter narrows arguments, inventory every source field and state whether it is carried, explicitly refused, or genuinely irrelevant; a handwritten list is not automatic coverage for future fields. When validation moves earlier, preserve its applicability conditions, observable check order, and established error contract, and leave a check at the later boundary when the required early state is unavailable there. When registry keys or path representations change, use one explicit identity contract across registration, lookup, move, deletion, and busy checks, preserving public representations unless their change is authorized. For Windows paths, distinguish operational namespace paths from comparison representations and settle drive, UNC, symlink, case, and filesystem-identity semantics before normalizing; never use naive prefix containment or universal lowercasing. For provider or model migrations, keep stable identifiers, display labels, credential scope, and actual request fields separate: trace rejected fields through the current schema and request builder and prove the intended request difference offline before proposing any live call. None of this authorizes credential changes, retries, uploads, or paid services.
First, the code must compile: run the type checker, static analysis, and build with all contracts in place, and fix the contract or the implementation when they fail. Second, write one violation test per PRE, POST, and INV proving the boundary fails explicitly on bad input or bad state. Static contracts are proven by the type checker; runtime contracts by violation tests. A violation test that does not fire means the contract is not enforced at the chosen layer: re-select the layer or strengthen the check, never delete the test to get green.
Local code with every planned PRE/POST/INV implemented at its verification layer and active where runtime, one passing violation test per contract, and each contract traceable to its requirement by ID. Violations fail explicitly at the boundary.
What SKILL.md sets; muted values are Claude Code's defaults
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