agentleFS
Tsurai7Tsurai7/agentic-playbook/skills/invariant-audit/SKILL.md

invariant-audit

Skill0 starsChanged 4 months agoMITView on GitHub

Adversarially sweep a repo's standing invariants (billing/idempotency, PII, published contracts, deploy order) across every execution path a diff touches — retry, redelivery, timer, error, concurrency, rollout — not just the happy path. Use before merging changes that touch money, external calls, PII, published contracts, or workflow/state-machine definitions. Skip for docs-only diffs and refactors that add no execution paths.

The file

Files
SKILL.md

Invariant audit

Acceptance criteria verify designed paths; invariants must hold on paths nobody designed. The audit is a matrix — invariant × path — with evidence per cell.

Inputs

  • The repo's invariant catalog (INVARIANTS.md or equivalent). If absent, derive candidates from the diff's blast surface — what costs money, what is PII, what is a published contract, what must be idempotent — propose the file, and audit against the candidates.
  • The diff's path inventory: happy path; retry/redelivery; timeout/timer; error/exception; concurrent or duplicate delivery; partial rollout (old config with new code, and the reverse).

Method

  1. For each invariant, walk each path and ask: can this path violate it?
  2. Fill the matrix. Every cell needs evidence — a code citation, a test, or check output. "Surely fine" is an empty cell.
  3. An unswept cell is a finding, not a footnote.
Invarianthappyretrytimererrorconcurrentrollout

Classic cells (each shipped past multi-model review once)

  • Billed call re-executed by job redelivery after a failed completion ack.
  • Retry of a non-idempotent start command → second billed instance.
  • Metric counts successful parses, not attempts → reconciliation blind to exactly the error window you audit.
  • PII escaping through an upstream error message wrapped into logged errors.
  • Required config key plus a lagging config repo → total outage on rollout.

Provenance

Distilled from an internal retrospective of two production PRs (2026-08): the seven costliest review findings were invariant violations on non-designed paths, while the invariants themselves existed as happy-path acceptance criteria.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.