agentleFS
GoogleKnown publishergoogle/zerocopy/anneal/skills/spec-authoring/SKILL.md

spec-authoring

Skill2.7k starsChanged 9 days agoApache-2.0View on GitHub

Use when translating Rust or C reference intent into formal Anneal Lean specifications, auditing specs for echo or vacuity traps, checking client sufficiency, or separating spec changes from proofs. Not for CLI flags or receipt parsing (use cargo-anneal) or Lean proof scaling (use proof-scaling).

8 other projects use a version of this.

Adopted by

Steady: 0 new projects took it in the last 4 weeks, none the 4 weeks before.thin data

Week of Oct 4: 0 new projectsWeek of Oct 11: 0 new projectsWeek of Oct 18: 0 new projectsWeek of Oct 25: 0 new projectsWeek of Nov 1: 0 new projectsWeek of Nov 8: 0 new projectsWeek of Nov 15: 0 new projectsWeek of Nov 22: 0 new projects
Oct 2026Nov 2026Nov 2026
New projects taking a version of this file each week, over the 8 weeks our latest run read: only 0 in all, so this is a hint, not a trend.

Most recently taken up by

Who's talking about google/zerocopy

The biggest 5 of 53 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 53

Talked about on GitHub, Bluesky and Hacker News (53 times).

On GitHub · 50

45 more on GitHub

On Bluesky · 2

On Hacker News · 1

The file

Show its rules and text

We split this skill into the rules it gives an agent

13 rules. 0 are common, 3 are distinctive, and 10 are very specific to this project.

  • 0

    Common

    Most of the 8 edited versions we read keep these.

  • 3

    Distinctive

    This author's own choices. Worth a look.

  • 10

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Do not read the Rust implementation body to invent the spec.

    line 21
  2. Very specific:

    Only after writing the initial Specs.safety (caller preconditions) and Spec.specs / Specs.property (postconditions) from those channels, …

    line 29
  3. Very specific:

    Discrepancy rule: If the Rust body contradicts >= 2 non-body channels, stop and raise an Intent Decision with the user (bug in Rust vs …

    line 34
  4. Distinctive:

    Never silently relax a spec to fit suspicious code.

    line 36
  5. Very specific:

    Write specs in pure Lean term logic importing prelude plus only Init.* modules admitted by cargo anneal's embedded foundation and library …

    line 40
  6. Very specific:

    Zero unguarded partial traps: Never rely on saturating Nat.sub (a - b clamping to 0), totalized Nat / or % (x / 0 = 0), or unguarded …

    line 55
  7. Distinctive:

    Check client sufficiency before freezing the spec:

    line 73
  8. Very specific:

    Write a temporary scratch theorem (note: spec-preflight permits theorem and excludes example in Spec modules) proving the caller's needed …

    line 75
  9. Very specific:

    Run these lightweight checks *before* writing Proof.*, and label results explicitly as assumptions-only [A4] sanity (never as a replacement …

    line 86
  10. Very specific:

    Vacuity & consistency (cargo anneal verify): Check a temporary scratch theorem witnessing concrete valid arguments satisfying …

    line 90
  11. Very specific:

    Positive polarity (forbidden input): Verify a caller violating one conjunct of Specs.safety cannot satisfy the precondition witness.

    line 99
  12. Distinctive:

    Keep specification edits cleanly isolated from proof edits:

    line 104
  13. Very specific:

    Put Spec.lean / Spec.* and request.json scope/precondition updates in their own reviewable commit ahead of Proof.lean / Proof.* changes.

    line 105

“Common” is measured: kept by at least 6 in 10 of the 8 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Author and audit Anneal specifications

Good proofs of weak, vacuous, or echoed specs create false confidence. Author and freeze Spec.lean / Spec.* (AuthoredRole::Specification, defining Spec.specs of type Trusted.MirSemantics.Specs with Specs.safety and Specs.property) before investing in Proof.lean / Proof.*. specification modules define what holds; they must not import Anneal.* proof libraries (rejected by audit).

Step 1: Body-last spec archaeology

Do not read the Rust implementation body to invent the spec. Gather >= 2 non-body channels first and synthesize an initial contract from them plus the Rust signature:

  1. Docstrings, /// # Safety comments, type invariants, and module docs.
  2. Unit tests, doc tests, Miri tests, and real callers / downstream clients.
  3. Upstream RFCs, reference C/hardware specs, or ABI documentation.

Only after writing the initial Specs.safety (caller preconditions) and Spec.specs / Specs.property (postconditions) from those channels, inspect the Rust body to check edge behavior (integer width, error variants, truncation).

Discrepancy rule: If the Rust body contradicts >= 2 non-body channels, stop and raise an Intent Decision with the user (bug in Rust vs stale docs). Never silently relax a spec to fit suspicious code.

Step 2: Trap-free total-logic defaults

Write specs in pure Lean term logic importing prelude plus only Init.* modules admitted by cargo anneal's embedded foundation and library lockfiles (e.g., Init.Data.BitVec.Basic; recorded at anneal/trusted/lean/foundation-lock.json and anneal/trusted/audit/library-lock.json in a google/zerocopy source checkout). Monolithic import Init (~473 MiB RSS vs ~152 MiB targeted) is rejected fail-closed in pinned cargo anneal verify unless --allow-unpinned-lean is passed.

  • Total correctness default: Require termination (¬ Diverges / Behavior, ensuring wpProg / execProg fuel covers execution to return or unwound outcome rather than hitting a fuel = 0 False cutoff) unless the item is explicitly documented to loop or abort on stated inputs.
  • Exact machine arithmetic: Model fixed-width and signed operations via BitVec w and Int.tdiv (or explicit integer bounds), not partial Nat.
  • Zero unguarded partial traps: Never rely on saturating Nat.sub (a - b clamping to 0), totalized Nat / or % (x / 0 = 0), or unguarded BitVec.toNat / Int.toNat casts. Either prove domain preconditions exclude underflow/division-by-zero in Specs.safety, or represent truncation explicitly.
  • Explicit non-vacuous Specs.safety: State exact input bounds and domain invariants callers must establish (note: current scalar Profile v1 rejects pointers/references and enforces empty caller memory). Writing False in Specs.safety lets proofs pass trivially while admitting zero callers.

Step 3: Anti-echo and client-sufficiency gate

Reject tautological echo specs that merely copy the Rust control flow or arithmetic AST branch-for-branch into Lean. State mathematical or behavioral properties that an independent reader can verify: bounds, conservation laws, bit-exact equivalence to a simpler scalar/reference model, order preservation, or round-trip invertibility.

Check client sufficiency before freezing the spec:

  • Identify real caller expectations (tests, callers, or downstream invariants).
  • Write a temporary scratch theorem (note: spec-preflight permits theorem and excludes example in Spec modules) proving the caller's needed post-state property using only Specs.safety + Specs.property (never peeking into Proof.* or Captured.lean), then remove it before commit.
  • Record a clause coverage tally in your review note or commit context: clauses: N, client-exercised: M. Justify any unexercised clause (M < N) or prune dead spec obligations.

Step 4: [A4] pre-proof sanity and dual-polar mutation checks

Run these lightweight checks before writing Proof.*, and label results explicitly as assumptions-only [A4] sanity (never as a replacement for proofs):

  1. Vacuity & consistency (cargo anneal verify): Check a temporary scratch theorem witnessing concrete valid arguments satisfying Specs.safety, and a valid (input, output) pair satisfying Specs.property (Spec admits theorem, not example). Confirm Specs.safety cannot derive False, then delete the temporary theorem.
  2. Dual-polar mutation check (temporary, revert before committing):
    • Negative polarity (wrong body): Temporarily perturb a return value or comparison in Rust (e.g., + 1 or < -> <=) and verify either cargo test fails or Expected.lean rejects the unguarded spec.
    • Positive polarity (forbidden input): Verify a caller violating one conjunct of Specs.safety cannot satisfy the precondition witness.

Step 5: Spec vs Proof separation and handoff

Keep specification edits cleanly isolated from proof edits:

  • Put Spec.lean / Spec.* and request.json scope/precondition updates in their own reviewable commit ahead of Proof.lean / Proof.* changes.
  • Classify every spec diff explicitly using a Spec-Change: line in the commit or PR note: initial | tightening | weakening | refactor.
  • Any weakening requires explicit user authorization and re-running Steps 3-4.

Once the spec passes Steps 1-4, hand off to proof-scaling to prove Expected.claim, or to cargo-anneal for single-command verification.

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.