.pi/agent/skills/quint-spec/SKILL.md
Quint specification language reference for writing formal specs in plans. Use when a TODO needs a behavioral specification: state transitions, invariants, concurrency constraints. Write Quint modules to describe WHAT the system must do, not HOW to implement it.
npx skillsauth add popoffvg/dotfiles quint-specInstall 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.
Quint is a typed specification language for describing system behavior formally. Use it in plan TODOs to specify state machines, invariants, and edge cases that pseudocode cannot express precisely.
Reference: https://quint-lang.org/docs/lang
When NOT to use Quint:
// Basic types
bool, int, str
// Collections
Set[int], List[str], Map[str, int]
// Tuples and records
(int, str)
{ name: str, age: int }
// Sum types (tagged unions)
type Status = Pending | Active(int) | Failed(str)
// Type aliases
type UserId = int
type TokenStore = Map[str, { userId: UserId, expiresAt: int }]
module Example {
// Constants — fixed for a given system instance
const MAX_RETRIES: int
const TIMEOUT: int
// State variables — change over time
var counter: int
var status: Status
// Pure functions — no state dependency
pure def clamp(x: int, lo: int, hi: int): int =
if (x < lo) lo else if (x > hi) hi else x
// State-dependent values
val isActive = status == Active
// Actions — state transitions (delayed assignment with ')
action init = all {
counter' = 0,
status' = Pending,
}
action increment = all {
counter < MAX_RETRIES, // guard: action enabled only when true
counter' = counter + 1,
status' = status, // unchanged
}
// Non-deterministic choice
action next = any {
increment,
reset,
timeout,
}
}
action withdraw(amount: int) = all {
amount > 0, // guard: positive amount
balance >= amount, // guard: sufficient funds
balance' = balance - amount,
}
action receiveRequest = {
nondet userId = oneOf(Users)
nondet amount = oneOf(1.to(MAX_AMOUNT))
processRequest(userId, amount)
}
// State invariant
val balanceNonNegative = balance >= 0
// Temporal: always true across all states
temporal safetyProperty = always(balanceNonNegative)
run happyPath =
init
.then(deposit(100))
.then(withdraw(50))
.expect(balance == 50)
run overdraftBlocked =
init
.then(deposit(10))
.then(withdraw(20))
.fail() // withdraw should be disabled
// Sets
Set(1, 2, 3)
S.contains(e) // membership
S.union(T) // S ∪ T
S.exists(x => P) // ∃ x ∈ S: P
S.forall(x => P) // ∀ x ∈ S: P
S.filter(x => P) // { x ∈ S | P }
S.map(x => e) // { e | x ∈ S }
S.fold(init, (acc, x => e))
S.size()
// Maps
Map("a" -> 1, "b" -> 2)
m.get(key) // lookup
m.keys() // domain
m.set(key, val) // update (returns new map)
m.put(key, val) // add entry
S.mapBy(x => e) // { x ↦ e | x ∈ S }
// Lists
[1, 2, 3]
l.head() // first element
l.tail() // all but first
l.append(e) // add to end
l.length()
l.foldl(init, (acc, x => e))
l[i] // 0-indexed access
// Records
{ name: "alice", age: 30 }
r.name // field access
r.with("name", "bob") // update field
When writing a Quint spec inside a TODO, keep it focused:
The spec is a contract: the implementer must satisfy the invariants and the runs must pass against the implementation logic.
Eval checklist:
Test inputs:
Can change: Quint examples, guard/invariant templates, selection criteria, run patterns Cannot change: WHAT-not-HOW principle, formal spec focus, skip criteria for simple workflows Min sessions before eval: 5 Runs per experiment: 3
tools
Improve a whole CLAUDE.local.md — the private, per-project rules captured from user corrections. Wraps each conditional rule in a <task-relevant> block so it only surfaces for matching work, merges duplicates, generalizes one-off facts, drops stale entries, and routes raw project facts to engram. Use when the user says "improve claude.local", "clean up the local rules", "claude.local is bloated", or after the Stop hook has appended many rules.
testing
WM pipeline and conventions shared across all phases. Agents must read this before spec, impl, or verify work.
development
One entry point for spec writing, implementation, and bug fixing. Default is new (write spec → grill loop → produce notes → author TODO bodies). Other subcommands: verify (audit), revise (sync to shipped), prototype (settle a decision), code-map (diagram), impl (execute one TODO), fix (analyze cause, correct thoughts, fix behavior), help (this page). Invoke as /code <subcommand>.
development
Red-Green-Refactor cycle for bug fixes. Before fixing a bug, first write a failing test that reproduces it (Red), then make the minimal change to pass (Green), then clean up the code (Refactor). Use on any bug fix, error correction, failing test repair, or when user says "fix this bug".