invariant-first-testing

invariant-first-testing is a skill for Claude Code, Codex from Kevin-Liu-01/Agent-Machines. It costs 54 tokens per session (1,185 once invoked), scanned A, original, MIT.

A testing method that checks lasting system rules instead of recording only the exact bug that once occurred. The test names and cases describe properties the system must always maintain.

In plain words
What is it for?
Use it when writing or reviewing tests, especially when converting reactive bug-fix tests into tests of broader system invariants.
Why use it?
It keeps tests useful as design documentation and reduces narrow tests that are tied to one past failure or implementation detail.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it when writing or reviewing tests, especially when converting reactive bug-fix tests into tests of broader system invariants.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/kevin-liu-01/agent-machines/invariant-first-testing
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add Kevin-Liu-01/Agent-Machines --skill invariant-first-testing
Clone the repo
git clone --depth 1 https://github.com/Kevin-Liu-01/Agent-Machines

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for invariant-first-testing

README.md
[![agentmods](https://agentmods.dev/badge/skills/kevin-liu-01/agent-machines/invariant-first-testing/github.svg)](https://agentmods.dev/skills/kevin-liu-01/agent-machines/invariant-first-testing)
Your own site
<a href="https://agentmods.dev/skills/kevin-liu-01/agent-machines/invariant-first-testing"><img src="https://agentmods.dev/badge/skills/kevin-liu-01/agent-machines/invariant-first-testing/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for invariant-first-testing

Your own site · 80×15
<a href="https://agentmods.dev/skills/kevin-liu-01/agent-machines/invariant-first-testing"><img src="https://agentmods.dev/badge/skills/kevin-liu-01/agent-machines/invariant-first-testing.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 54 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,185 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00054 $0.01185
Opus 5 $0.00027 $0.00593
Sonnet 5 $0.00011 $0.00237
Haiku 4.5 $0.00005 $0.00119

Measured 8d ago against content hash 6a4eedec634b, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

invariant-first-testing scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

knowledge/skills/invariant-first-testing/SKILL.md · 121 lines

How it starts

The opening of the file, as written. The whole thing — 121 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Invariant-First Testing

The Problem

When something breaks in production, the natural instinct is:

  1. Reproduce the bug
  2. Write a test that fails without the fix
  3. Apply the fix, test goes green
  4. Ship it

The test that comes out of this process describes the specific failure mode, not the system property that was violated. Six months later, the test reads like a line item in a bug tracker, not like a design document. The test suite accumulates narrow, implementation-coupled tests that tell you what broke once but not what should always be true.

The Fix

Before writing any test, ask: "What system property was violated?" Write the test for the property, not the bug.

Naming

The test name is a contract. It should be readable as a sentence that describes a property of the system that must always hold.

BAD:  test_setenv_rejection_continues_session
      (describes the mechanism of a specific bug fix)

GOOD: invariant_session_survives_guest_env_rejection
      (describes a property of the SSH gateway)

BAD:  run_once_continues_after_per_workspace_status_patch_failure
      (describes a specific failure mode: 409 on status patch)

GOOD: invariant_single_workspace_failure_does_not_block_node_reconciliation
      (describes a property of the reconciler)

BAD:  test_list_excludes_image_version_from_response
      (describes a specific field being hidden)

GOOD: invariant_internal_fields_are_not_exposed_in_public_api
      (describes a property of the API surface)

Naming Conventions

  • invariant_*: A property that must always hold. The system is broken if this test fails. This is the default prefix for most tests.
  • design_*: An intentional policy decision that could reasonably go either way. Documents that we chose X over Y deliberately.
  • No prefix needed for trivial unit tests on pure functions (serialization round-trips, math helpers).

Test Body

The test body should exercise the general case, not the specific trigger that led to the bug. If the bug was "409 Conflict on status patch aborts the reconciler," the test should verify that the reconciler survives any per-workspace error, not just 409s.

Read the full file on GitHub · 121 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 8d ago First seen · 121 lines · 54 tokens per session scan A 6a4eedec634b

Subscribe to this mod's changes

invariant-first-testing is a skill published in the GitHub repository Kevin-Liu-01/Agent-Machines (29 stars, last pushed today), licensed MIT. It adds 54 tokens to every session and 1,185 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

hermes-change-review

Use when a branch, pull request, Kanban task, or implementation must be reviewed separately for intent fidelity, repository quality, and verification evidence before completion or merge is accepted.

asimons81/hermes-field-kit · 40 tokens

fable-judge

Adversarial verification of finished work. Treats any 'done' claim as a set of claims to verify by re-running everything yourself. Use when someone reports work complete and you must gate it: load this before trusting a completion report. Subcommands: suite runs a trap suite against any skill/model.

ardhaecosystem/fable-method · 69 tokens

readme-template

Standard README template for repos — professional structure with badges, overview, table of contents, features/modules, stack, installation, configuration, tests, security, structure, docs, roadmap, contribute, license, author + RepoActivity sections (Star History, repo stats) + profile GIF footer. Use when creating…

pedroiff0/awesome-skills · 72 tokens

docker-single-port-multi-instance

Consolidate multiple Docker Compose app instances (production / test / demo) behind ONE host port using an nginx reverse proxy that routes by URL path prefix (e.g. /demo). Use when a user wants 'one port, several apps/banks' or a demo reachable simultaneously from the main landing page with its own database.

pedroiff0/awesome-skills · 73 tokens

review

Challenge a Hardproof implementation during REVIEW against its approved contract, code quality, tests, and risk boundaries.

asimons81/hardproof · 23 tokens

implement

Implement an agreed specification through existing seams with tests, checks, and review.

MoonTzai/folderbridge-mcp · 17 tokens