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.
npx skills add Kevin-Liu-01/Agent-Machines --skill invariant-first-codinggit clone --depth 1 https://github.com/Kevin-Liu-01/Agent-MachinesWrote 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.
[](https://agentmods.dev/skills/kevin-liu-01/agent-machines/invariant-first-coding)<a href="https://agentmods.dev/skills/kevin-liu-01/agent-machines/invariant-first-coding"><img src="https://agentmods.dev/badge/skills/kevin-liu-01/agent-machines/invariant-first-coding/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.
<a href="https://agentmods.dev/skills/kevin-liu-01/agent-machines/invariant-first-coding"><img src="https://agentmods.dev/badge/skills/kevin-liu-01/agent-machines/invariant-first-coding.svg" alt="Reviewed on agentmods" width="80" height="20"></a>- NVIDIA SkillSpector pass
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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00065 | $0.01601 |
| Opus 5 | $0.00032 | $0.00800 |
| Sonnet 5 | $0.00013 | $0.00320 |
| Haiku 4.5 | $0.00006 | $0.00160 |
Grade A, and why
invariant-first-coding 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 9d 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.
How it starts
The opening of the file, as written. The whole thing — 285 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Invariant-First Coding
Write code that matches the real system.
If a system invariant already proves a condition, encode that invariant directly. Do not add fallback branches, saturation logic, or “safe-looking” defaults just to appear careful.
This skill is about coding and review discipline, not architecture or testing in isolation.
The rule
Before writing or approving a branch, ask:
- What is the real invariant?
- Is this case actually reachable?
- If it is reachable, is it normal runtime behavior or an invariant violation?
- What is the honest way to encode that distinction?
If the branch exists only because a conversion is typed as fallible, or because the author felt nervous, that branch is probably theater.
What counts as theater
Common examples:
try_from(...).unwrap_or(MAX)when the value is already tightly boundedunwrap_or(false)after I/O or parsing where failure should be surfaced- catch-all fallback paths that silently degrade behavior
- “best effort” logic where the interface promised stronger semantics
- extra conditionals added to avoid stating the real invariant
The problem is not style. The problem is lying about the system.
Classify the situation first
Every suspicious branch is one of three things:
1. Real runtime case
The case can happen during correct operation.
Examples:
- network timeout
- user-supplied malformed input
- resource contention
- stale optimistic concurrency token
Handle it as part of the interface contract.
2. Invariant violation
The case should be impossible if the surrounding system is correct.
Examples:
- host-local slot count exceeds the hard per-host slot limit
- a supposedly exhaustive enum mapping hits “unknown”
- a pointer is absent after earlier validation guaranteed presence
Do not paper over this with fallback behavior. Assert it, crash fast, or return an explicit internal error, depending on the layer.
3. Type-system artifact
The language forces a fallible conversion or optional path, but the domain has already ruled failure out.
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.
- 9d ago First seen · 285 lines · 65 tokens per session scan A afe2c657f333
invariant-first-coding is a skill published in the GitHub repository Kevin-Liu-01/Agent-Machines (29 stars, last pushed today), licensed MIT. It adds 65 tokens to every session and 1,601 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.
Other skills, from other repositories
app-debug-workflow
⚠️ TRIGGER: when auditing an unfamiliar full-stack codebase for bugs — security, performance, reliability, dev tooling. Multi-session workflow: discover → duck-verify → plan → handoff → fix → validate. 90-min timebox. Designed for time-pressure coding/debug tasks.
code-simplifier
Review substantial mcp-reporter changes for unnecessary complexity while preserving tested behavior and public contracts.
vicious-mockery
The bard's cantrip that deals psychic damage through insults. In practice this is adversarial review — the art of finding and articulating exactly what is wrong with something in a way that is impossible to ignore. Unlike polite feedback that gets filed and forgotten, vicious mockery lands. It is the red-team report…
grill-with-docs
Cross-examine codebase architecture against official library documentation and API specs. Identifies deprecations, anti-patterns, and suboptimal library usage.
code
Use BEFORE generating, refactoring, reviewing, or debugging code. Trigger phrases include "write a function/script/class for X", "review this code/diff/PR", "refactor this", "debug this error", "is this implementation correct", "what's wrong with this code", "improve this code", "translate from X to Y", or any prompt…
engineering-incident-response-commander
An incident-response guide for managing production failures, coordinating responders, reviewing what happened afterward, and tracking service targets. SLOs and SLIs are measures used to define and monitor service reliability.