agentleFS
arxdsilvaarxdsilva/ai-loops/skills/consistency/SKILL.md

consistency

Skill0 starsChanged 7 days agoMITView on GitHub

Use when implementing or reviewing code whose results must be repeatable and safe under retries and concurrency - injected clock and RNG, ordering and tie-breaks, idempotency keys, worker pipelines, schema migrations with versions and fixtures, atomic writes, untrusted persisted input.

7 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

1 rule. 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 5 edited versions we read keep these.

  • 0

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

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

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

    Randomness: No global math/rand. Inject an RNG or ID generator.

    line 16

“Common” is measured: kept by at least 6 in 10 of the 5 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

Consistency: repeatable, retry-safe, concurrency-safe

Load

  • Your language: loops:lang-<id> (clock, RNG and concurrency idioms). Go: specs/languages/go/RULES.md §13 (ordering and clocks), §20 time, §21 randomness, §45 migrations, §46 idempotency.
  • specs/ARCHITECTURE.md §12 one owner per state, §18 persistence, §20 time boundary.

Procedure

  1. Clock. Authoritative code takes a Clock port; no time.Now outside cmd, adapters and platform. Tests use a fake clock and never sleep.
  2. Randomness. No global math/rand. Inject an RNG or ID generator; derive randomness from stable inputs so an unrelated draw does not shift later outcomes. Never couple the number of draws to an iteration count.
  3. Ordering. Where records, actors or results can conflict, define a tie-break (priority, then sequence, then ID; ORDER BY with a unique column). Never rely on hash-map iteration, thread or task completion order, or storage order unless guaranteed.
  4. Idempotency. Anything retried (webhook, queue redelivery, client retry) carries an idempotency key; applying it twice has the same effect as once. Store the key and result atomically with the state change; define the key's TTL and the behaviour on key reuse with a different payload.
  5. Worker pipeline. Workers compute from immutable inputs and never mutate live state:
snapshot -> request(sequence, revision) -> parallel compute -> collect
-> deterministic order -> validate revision -> commit on the owner
  1. Schema migrations. Versioned and explicit; never infer from "field missing" when a version exists. Prefer expand, backfill, switch, contract. Test with historical fixtures and corrupt/truncated input. Never "best effort" corrupt authoritative state.
  2. Atomic writes. Files: temp file, fsync where policy requires, rename. Databases: one transaction per command; outbox for events that must publish with the change.
  3. Untrusted persisted or external input. Bound sizes, counts, nesting, string lengths, decompression expansion, referenced IDs and schema versions (Go: specs/languages/go/RULES.md §28, §38).
  4. Hashes and checksums. Stable ordering, fixed numeric encoding, no pointers, no wall-clock fields.

Tests to add

Any consistency-sensitive change adds one or more of: repeat-run equality; retry/duplicate delivery equality; round trip (write, read, equal); migration fixtures old to new; worker-count equality (vary the pool size and scheduler threads, e.g. Go GOMAXPROCS); concurrent writers under the pack's race policy.

Review red flags

time.Now() in domain; global RNG; draw count tied to iteration count; decisions from map range; channel receive order deciding outcomes; a worker mutating shared state; retry without idempotency key; migration inferred from missing fields; non-atomic write; unbounded external input; hashing raw structs with padding or pointers.

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.