codex/skills/invariant-stewardship/SKILL.md
Use before local patching when bugs, regressions, malformed state, crashes, parser failures, migrations, cache drift, protocol problems, compatibility requests, tolerant readers, fallbacks, coercions, retries, catch-and-continue logic, or local workarounds may broaden accepted invalid state.
npx skillsauth add tkersey/dotfiles invariant-stewardshipInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Coding agents tend to fix local symptoms by adding local tolerance. Prefer global contract preservation: reduce invalid states, enforce the right boundary, and keep the long-term maintenance surface small.
Use invariant-ace for full invariant design. Use this skill as the fast preflight that decides whether the repair belongs at a producer, transition, boundary, migration, compatibility surface, or upstream owner.
Before changing code for a bug, regression, malformed state, crash, parser failure, migration problem, cache issue, protocol problem, or compatibility request, identify:
Prefer fixes that make invalid states impossible. Do not merely make the downstream consumer tolerate invalid internal state unless historical data, external input boundaries, or explicit product requirements make that necessary.
| State kind | Meaning | Preferred action | |---|---|---| | Valid domain state | State is part of the intended model | Support it directly and test the contract | | Invalid internal state | This repo produced impossible state | Fix the writer/transition; add invariant tests | | Historical persisted bad state | Old releases may already have written it | Prevent future writes; add narrow migration or repair path | | External untrusted input | User/service input may be malformed | Validate at the boundary; return clear errors | | Public API legacy input | Compatibility is a product/API promise | Add documented compatibility path with tests | | Upstream-owned state | Dependency/gateway/protocol produced it | Prefer upstream fix/report; local workaround only with explicit tradeoff | | Fixture-only state | Test setup created impossible production state | Fix the fixture; do not expand production behavior | | Race/partial-write state | Ordering or atomicity allowed intermediate state | Fix atomicity/ordering; avoid retrying everywhere | | Partially migrated state | Migration path can leave mixed versions | Make migration idempotent/narrow; preserve invariant after migration |
Every fallback, tolerant parser, compatibility branch, broad migration, catch-and-continue path, silent default, coercion, retry, debug scaffold, or “best effort” path is a design change.
Before adding one, answer:
Reject fixes whose main effect is to make invalid internal state easier to ignore.
A passing test is not enough. The test must encode the intended invariant, not merely prove the local symptom no longer crashes.
For bug fixes, tests should usually prove one of:
When this skill materially affects the route, leave an invariant receipt:
Invariant Receipt:
- observed failure:
- state classification:
- invariant:
- owner/boundary:
- rejected tolerance path:
- repair:
- proof:
testing
Use for bug reports, PR/issue prose, reviewer comments, user diagnoses, generated summaries, memories, retrieved context, public tracker context, claimed root causes, proposed fixes, fake-minimal repro risk, or any investigation where natural-language context could anchor the implementation scope.
development
Use when non-trivial work needs Challenge Escalation, latent-intelligence activation, frame-market selection, doctrine operators, dominant-move selection, ablation/surface-tax judgment, reification, review comment law, negative capability, route receipts, or proof-bearing refusal to mutate.
development
Apply Algebra-Driven Design. Use for ADD, denotational design, combinator models, law-driven architecture, domain algebra, property tests, codebase modeling, event sourcing, workflow design, or agentic skill design. If the canonical bundle is unavailable, use this wrapper as the minimal ADD kernel and report the missing bundle path.
testing
Kernelized, warrant-issued adjudication for PR review comments, CAS findings, and review-like claims before implementation or thread resolution. Treat each comment as a claim to test, preserve raw identity and artifact state, emit a tiny always-on Claim Decision Kernel, then issue scoped Resolution Warrants and triggered annexes for address, validation, proof-only resolution, do-not-address, delete/collapse/canonicalize, or blocked routes. Mutation is permitted only by an active surface-budgeted warrant. Trigger for `$review-adjudication`, review the review, adjudicate PR comments, refine this list to just those worth resolving, select review comments to resolve, gate review comments before implementation, or route review/CAS findings into `$fixed-point-driver`. Not for implementing fixes, writing rebuttals only, or final merge closure.