nix-review
Skill1 starsChanged 43 days agoMITView on GitHub
Nix code-review rubric — the flake quality gate (nix flake check, formatter --check, statix, deadnix, nix build/eval), a severity-tiered checklist (purity, reproducibility, injection, packaging, dev-env, modules; language-independent severity, classes and sweeps come from review-rules), the Approve/Warning/Block verdict (at most Warning when the gate could not be established; INCOMPLETE only when the review itself could not run), the "what proves what" table, and posting findings on a PR (defects only; doubtful ones go to the human first). Use when reviewing Nix code or a flake, checking for impure derivations or IFD, or deciding if a change is mergeable. Its review workflow needs Claude Code's Workflow tool (not in Codex or OpenCode); the rubric applies anywhere. Triggers: nix review, review flake, statix, deadnix, nix flake check, impure derivation, IFD.
In this repository42 other files it gives its agents.
- AGENTS.mdAGENTS.md
- addressing-findingsSkill
- auditSkill
- codebase-onboardingSkill
- codex-reviewSkill
- compatibilitySkill
- debuggingSkill
- developSkill
- distributed-racesSkill
- memorySkill
- nix-dev-envSkill
- nix-flakesSkill
- nixosSkill
- nix-packagingSkill
- refactoringSkill
- retroSkill
- review-initSkill
- review-rulesSkill
- rust-architecture-reviewSkill
- rust-architectureSkill
- rust-cliSkill
- rust-cloud-nativeSkill
- rust-concurrencySkill
- rust-ecosystemSkill
- rust-embeddedSkill
- rust-errorsSkill
- rust-fintechSkill
- rust-idiomsSkill
- rust-macrosSkill
- rust-mlSkill
- rust-navigationSkill
- rust-ownershipSkill
- rust-performanceSkill
- rust-pluginsSkill
- rust-reviewSkill
- rust-securitySkill
- rust-testingSkill
- rust-traitsSkill
- rust-unsafeSkill
- rust-webSkill
- specsSkill
- sql-reviewSkill
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 3 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 17
If the workflow fails with at workflow.js:<line>:<column>, that place is in the bundled engine: node "<this skill's base …
- Very specific: line 71
If gh is missing, unauthenticated, offline, or finds no PR → fall straight through to the local gate (never fail on detection).
- Distinctive: line 111
Read the diff and report findings anyway, but the verdict is Warning: say the gate was not established locally, name what was missing, …
- Distinctive: line 119
If any signal is red (a local run, or a red CI check that runs it), stop and report — don't review further.
- Very specific: line 128
Read flake.lock to resolve the real revisions for inputs the diff touches.
- Very specific: line 178
Import-from-derivation (IFD) forcing eval-time builds, or --impure reliance (REP-002)
- Distinctive: line 254
Every finding (lens or seed) is checked before it can be Confirmed:
- Very specific: line 256
Mechanical first: if a tool can decide the finding (a statix/deadnix rule, a failing nix eval), the verifier re-runs it scoped to the cited …
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Nix Review
The rubric for reviewing Nix changes: run the mechanical gate first, then read the diff against
the severity checklist, then issue a verdict. This is the knowledge; the craft:nix-reviewer agent
applies it to an actual diff and reports back.
The review entry point is the craft:review workflow (the craft CLI's review, driven from Claude Code):
it sends each changed Nix file to the Nix profile, scout-scales depth to the diff, fans out the lenses below,
grounds findings in tool output, and verifies each one. This skill is the rubric its Nix lenses (on the review's task agent) and the
craft:nix-reviewer agent, run by hand, apply.
If the workflow fails with at workflow.js:<line>:<column>, that place is in the bundled engine:
node "<this skill's base directory>/../../integrations/shared/engine-source-map.mjs" review workflow.js:<line>:<column>
gives it in the plugin's source.
Once a workflow run has ended (completed, failed or stopped — not while you may still resume it),
fold its real cost into the records it filed:
sh "<this skill's base directory>/../../integrations/shared/craft-cli.sh" runs enrich-cost --run-id <wf_…>, with the
run id the Workflow completion names. Best-effort: if it fails, say so in one line and go on.
The workflow recalls the project's active decisions, open questions and project rules for the diff's paths
itself, on every launch; priorDecisions (the object argument, never a string, each record with
its kind) only adds records the store may not hold yet and never replaces that recall
(→ memory, "Before a review"): a finding the project already rejected comes back under Rejected before with who,
when and why, one it deferred under Known and deferred, and one a project rule covers (a judge agreed its
concern is exactly what the rule accepts; never a Critical) under Covered by project rules, instead of
being raised as new. A finding the same judges say goes against an active decision or rule stays in the
verdict, listed under Contradicts project memory with the record's id, and is a defect whatever
other doubt sign it carries — unless its line is marked not confirmed: then it is a doubt to check
(verify it before fixing), and with comment it is also listed under Doubtful, the record named first.
With comment the workflow posts only defects on the PR; a doubtful finding (not confirmed, raised by
the compat, intent or api-boundary lens, a design question naming no harm, about rollback, rollout,
old replicas, migration or a breaking change, or outside the changed lines) is listed under Doubtful — for the reviewer, not posted and
waits for the human: show him that list, and act on his choice for each — ask the author, post as a
defect, or do not post — as craft:addressing-findings says (its doubtful findings section).
When to Use
- Reviewing a diff / PR of Nix code (flakes, packages, NixOS modules, dev shells)
- Deciding whether changes are safe to commit or merge
- A self-check before opening a PR
Step 1 — Establish the gate (CI informs, never certifies)
The mechanical gate is non-negotiable: formatter --check, statix check, deadnix,
nix flake check, and nix build / nix eval must be green before human-style review is worth
doing. You establish each signal yourself, by running its command. CI informs, it never
certifies: a green CI check is reported (CI green for <check>), but the signal it covers stays
unknown until your own run computes it, and no verdict — Approve least of all — rests on it. A red
CI check that runs the command still blocks (required or not — most repos have no branch
protection; required-ness governs whether RED blocks a merge, and never turns GREEN into a signal
you did not compute).
With no flake.nix, nix flake check, nix eval and nix build have no flake to evaluate: the
gate is the linters (step 3) and the formatter (step 2). Both linters run clean — nothing to gate,
no gap; one missing, timed out or broken — NOT ESTABLISHED, at most Warning.
The formatter check applies whenever the repository names a formatter, with a flake or
without, and a red one blocks; with no formatter named it is skipped, and that is no gap.
Establish each signal:
- Detect the PR's CI for the current branch:
Ifgh pr checks --json name,state,bucket,linkghis missing, unauthenticated, offline, or finds no PR → fall straight through to the local gate (never fail on detection). - Formatter — only when the repository names one (see above). If a conclusive check
(required or not) whose name matches (
alejandra,nixpkgs-fmt,fmt,format) is conclusive:- failed → gate red → Block;
- green → report
CI green for <check> · PR #N; the signal stays unknown — run it locally; - absent/pending → run locally:
alejandra --check . # or: nixpkgs-fmt --check $(find . -name '*.nix')
- Linters — always run locally, whatever CI shows (a green CI check only informs):
statix check deadnix --fail - Flake check / build / eval (a flake only) — if a conclusive check (required or not) matching
flake-check,nix build, ornix evalis conclusive:- failed → gate red → Block;
- green → report
CI green for <check> · PR #N; the signal stays unknown — run it locally; - absent/pending → run locally:
nix flake check nix build # or: nix build .#<target>
The gate could not be established — the third outcome. No red CI check covers it and nothing could execute locally:
nixis not on PATH, flakes are disabled, evaluation cannot fetch its locked inputs (offline, an input unreachable), and no linter (statix,deadnix, a formatter) is installed either. Nothing was evaluated — that is neither red nor green. A green CI check does not change that: it is reported beside a gate that stays NOT ESTABLISHED.What happened Gate status Verdict Ran locally and passed PASSED continue Failed (a local run, or a red CI check that runs it) FAILED Block Could not run locally (a green CI check, if any, only informs) NOT ESTABLISHED Warning at most — never Approve Read the diff and report findings anyway, but the verdict is Warning: say the gate was not established locally, name what was missing, report the CI you saw beside it, and say the change is UNVERIFIED, not clean. A Confirmed CRITICAL/HIGH found by reading still wins — that is a Block. A partly unknown gate (statix ran,
nix flake checkdid not) caps the same way: at most Warning, the gap named in the## Gateline. An unestablished gate is never INCOMPLETE: INCOMPLETE means the review itself could not run (no diff to read, the lenses failed).
If any signal is red (a local run, or a red CI check that runs it), stop and report — don't review further. A green gate — green by your own runs — is the floor, not the ceiling.
Step 1.5 — Resolve flake input context
Review against the input versions the project actually locks, not against nixpkgs-in-the-abstract.
An attribute available on nixpkgs 24.05 may have been renamed or removed on the 23.11 this flake
locks. Before judging input usage:
- Read
flake.lockto resolve the real revisions for inputs the diff touches. - For any nontrivial input the diff exercises, check usage against that revision's API / option set.
Version-specific misuse of a NixOS option or nixpkgs attribute is
DEP-001(Medium). - Known-stale or floating inputs are a separate axis, caught by
REP-001in Step 2.
Best-effort: skip if there are no external-input changes.
Step 2 — Severity checklist
Review the diff against these tiers. This skill owns only the review process; cite the owning
skill for each fix. Each item has a stable ID in the rules.md catalog — cite it in a
finding (e.g. INJ-001) so the finding is addressable and dedup-able; novel issues without a
catalog ID are still welcome. The tiers are defaults: every finding names its harm, and the harm
cap of the review-rules skill (severity.md) bounds its severity — read that skill alongside this
one for severity, finding classes and the search sweeps.
- Purity / reproducibility →
nix-packaging,nix-flakes - Command injection / untrusted interpolation →
nix-packaging - Packaging correctness (hashes, meta) →
nix-packaging - Dev-env config (
allowUnfree, overlays) →nix-dev-env - NixOS / HM modules (secrets, options) →
nixos - Maintainability (deadnix, statix, anti-idioms) →
nix-dev-env - Flake input management →
nix-flakes
CRITICAL — block on sight
Security / injection
- Untrusted value interpolated directly into a build phase or shell script without sanitization
(
INJ-001)
Purity & secrets
- Secret embedded as a plaintext string inside a derivation or store path instead of managed by
agenix/sops-nix (
MOD-001)
HIGH — block unless justified
Purity
- Impure builtin used in a derivation (
builtins.currentTime,builtins.getEnv,<nixpkgs>channel path) — breaks reproducibility (PUR-001) - Fetcher missing a fixed output hash (
fetchgit/fetchurlwithoutsha256/hash) (PUR-002)
Reproducibility
- Flake input unpinned or channel-based (no
flake.lockentry /followsmissing) (REP-001)
Packaging
- Wrong or missing dependency hash (
cargoHash/vendorHash/npmDepsHash) (PKG-001)
MEDIUM — warn, may merge
Reproducibility
- Import-from-derivation (IFD) forcing eval-time builds, or
--impurereliance (REP-002)
Packaging
- Missing
meta(description/license/mainProgram) on a package (PKG-002)
Dev-env
allowUnfree/config set inflake.nixbut not propagated tonix develop(DEV-001)
Modules
- NixOS/HM option without a
typeordefault; non-cross-platform assumption (MOD-002)
Dependencies
- Flake input pin stale or floating where it should be locked (
DEP-001)
LOW — optional, never blocks
Maintainability
- Dead code (
deadnix) / anti-idiom (statix) / needlessrec/with(MNT-001) — raised only when a harm is named (review-rulesseverity.md)
Review lenses
The workflow fans the rubric out into independent lenses, each reviewing ONE slice blind to the others (higher recall than one broad pass):
| Lens | Slice | Owning skill for the fix |
| purity | impure builtins, missing hashes, channel paths | nix-packaging |
| reproducibility | IFD, unpinned inputs, --impure reliance | nix-flakes |
| injection | untrusted interpolation in build/shell scripts | nix-packaging |
| packaging | hash correctness, meta completeness | nix-packaging |
| dev-env | allowUnfree propagation, overlays, shell config | nix-dev-env |
| modules | NixOS/HM option types, defaults, secrets management | nixos |
| maintainability | deadnix, statix, needless rec/with, structural simplification | nix-dev-env |
| dependencies | stale/floating inputs, version-specific misuse | nix-flakes |
| intent | does the change do what the brief/spec says? | specs |
Confidence tiers — surface, don't censor
- Confirmed — located and survived verification; drives the verdict.
- Suspected — borderline or unverified; surfaced for the author, never changes the verdict.
Report everything you suspect. Borderline findings go to Suspected, not the bin.
Tool grounding (seed findings)
Beyond the gate, the workflow runs real tools scoped to the diff and feeds their output in as seed
findings (each still verified): statix check (anti-idioms), deadnix --fail (dead code),
nix flake check --all-systems (eval errors, cycle detection), and nix build --dry-run
(missing dependencies). Optional tools degrade gracefully when absent. Each seed carries, beside its
catalog ruleId, the tool's own rule name as toolRule (the statix code, such as W04) — what
tells two lints under one catalog rule (MNT-001) apart. deadnix and the formatter print no rule
name, so their seeds carry no toolRule and match a past decision outright only by line, lens and
the same title (deadnix names the binding there). A deadnix or statix seed's title is the tool's message verbatim; the report lists the titles of seeds without a toolRule (deadnix always, statix when it printed no code) under Tool finding titles (verbatim) — a decision on one is recorded with the title listed there; a
formatter seed is the whole file — line 0, the fixed title "File not formatted: <path>" — and matches
by file, lens and title. Two tool seeds at one spot with different titles and no rule name are never
merged; another title goes to the match judge and stays raised when the judge gives no verdict.
Premise grounding — cite it or drop the claim
Most findings rest on a premise not visible at the line they cite: "that flake input provides this", "the module default is X", "no other module sets it", "the fetcher is already pinned upstream". Nix makes this especially easy to get wrong — the truth usually lives in a locked input's own source or in a module merged from elsewhere, not in the file under review.
Pin every off-site premise to a file:line you actually opened (the locked input's source
included — nix flake metadata / the store path) and report it in the finding's whereChecked. A
premise you did not open is not admissible: open it, or drop the claim and report only what the
cited line shows. This binds rejection as much as confirmation — dismissing a finding on an
unopened "the module already sets that" discards a real bug silently.
An unpinnable off-site premise costs a finding its Confirmed tier — it drops to Suspected, never to refuted. Unsupported is not disproven.
Verification protocol
Every finding (lens or seed) is checked before it can be Confirmed:
- Mechanical first: if a tool can decide the finding (a statix/deadnix rule, a failing
nix eval), the verifier re-runs it scoped to the cited file and the tool's output overrides judgement in both directions. Tool-reported seeds can never be refuted on reasoning alone — only by the tool demonstrably no longer reporting them. - Adversarial: skeptics try to REFUTE it (default to refuted when uncertain — except tool-reported seeds, per above). One skeptic by default; three-vote consensus for Critical/High.
- Self-verification (anti-hallucination): re-read the cited
file:line— does the code actually say what the finding claims? A wrong citation drops the finding. A path only reachable from an example overlay or test derivation (not a real build) does NOT drop it — it demotes the confirmed severity one notch.
Step 3 — Verdict
| Verdict | When |
| Approve ✅ | every gate signal green by your own runs (a green CI check never counts), no Confirmed CRITICAL/HIGH/MEDIUM |
| Warning ⚠️ | Confirmed MEDIUM at most over a gate green by your own runs, or a gate NOT ESTABLISHED or partly unknown (Step 1, item 5) with nothing Confirmed CRITICAL/HIGH — Suspected items listed but don't block |
| Block ⛔ | gate red (a local run, or a red CI check that runs the command), or any Confirmed CRITICAL/HIGH |
| INCOMPLETE 🚫 | the review itself could not run — no diff to read, or the lenses failed — so nothing was judged; never for a gate that could not be established |
Report findings as severity · file:line · [rule-id] · what · why · fix. Cite the rules.md
catalog ID when the finding maps to one (e.g. PUR-001); novel findings need no ID. Be specific
and cite the line; a finding without a location isn't actionable.
"Gate green / red" is read from Step 1 — green only from your own run; red from your own run
or a red CI check that runs the command. Cite which in the ## Gate line of the output, and report
a green CI check there as CI green for <check> beside a signal that stays unknown. When the gate
could not be established, in whole or in part, the ## Gate line says so (NOT ESTABLISHED — nix
not on PATH, with the CI you saw) and the verdict is at most Warning, never Approve.
Proving a claim — what proves what
| Claim | Proof (run it) | Not proof |
| flake evaluates | nix flake check → exit 0 | "looks fine" |
| package builds | nix build .#<pkg> → exit 0 | eval passing |
| formatter clean | alejandra --check . / nixpkgs-fmt --check → exit 0 | "I ran fmt earlier" |
| no dead code | deadnix --fail → exit 0 | "looks unused" |
| no anti-idioms | statix check → exit 0 | code review alone |
| hash correct | nix build succeeds with hash present | hash field exists |
| input pinned | flake.lock entry present for input | follows set |
| no IFD | nix flake check without --impure → exit 0 | "shouldn't be IFD" |
| secret not in store | runtime secret management confirmed (agenix/sops-nix) | "looks encrypted" |
| bug fixed | re-run the case that reproduced it → passes | code changed |
A green CI check (required or not) for the same command is not proof of that command: report it
(CI green for <check>) and still produce the fresh signal yourself (see Step 1 — Establish the
gate). A red one is proof the command fails.
Boundaries
- How to package a derivation correctly →
nix-packaging(this rubric only flags that it's wrong). - How to manage flake inputs / lock files →
nix-flakes. - How to configure a dev shell →
nix-dev-env. - How to write NixOS/HM modules or manage secrets →
nixos. - This skill judges; it does not rewrite. Propose the fix, let the author apply it.
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
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.

