writing-nix
Skill2 starsChanged 4 months agoMITView on GitHub
Use when authoring, reviewing, packaging, or debugging Nix expressions, flakes, derivations, NixOS or nix-darwin modules, Nixpkgs contributions, or Nix build/check failures. Do not invoke merely because an ordinary command happens to use the nix CLI.
In this repository27 other files it gives its agents.
- capture-collaboration-evidenceSkill
- clarify-before-buildingSkill
- cross-platform-project-build-archSkill
- deep-code-reviewSkill
- dispatchSkill
- erect-agent-stackSkill
- fix-zig-deps-hashSkill
- gather-project-intentionsSkill
- handoffSkill
- i18nSkill
- lean4-developmentSkill
- llvm-guided-optimizationSkill
- mechatron-ciSkill
- memoriesSkill
- mficSkill
- no-ai-slopSkill
- onboardSkill
- performance-profilingSkill
- planning-workSkill
- scaffold-zig-projectSkill
- shipSkill
- test-isolationSkill
- universal-app-frontendSkill
- walking-decisionsSkill
- writing-bendSkill
- writing-rocSkill
- zig-microbenchmarksSkill
The file
We split this skill into the rules it gives an agent
10 rules. About 0 are common, 7 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Very specific: line 21
Before nix build, nix develop, or nix flake check after adding, renaming, or generating a referenced file:
- Distinctive: line 24
Run git status --short at the flake's Git root.
- Very specific: line 26
Run scripts/check-flake-inputs --repo "$root" PATH...
- Distinctive: line 27
If it reports an untracked path, review it and stage that exact path with git add -- PATH.
- Distinctive: line 29
If it reports an ignored path, review the ignore policy before considering git add -f or changing the flake source design.
- Distinctive: line 36
Read references/sources-and-flakes.md for source filtering, path inputs, flake outputs, or missing-source failures.
- Distinctive: line 60
Read only the references relevant to the task.
- Distinctive: line 68
Keep derivation computation pure.
- Very specific: line 73
Test every supported system explicitly, including --all-systems when checking the whole flake.
- Distinctive: line 75
Verify the resulting executable, closure, or activation behavior rather than accepting a successful evaluation as proof.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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
Writing Nix
Produce Nix code whose source closure, dependency roles, checks, and activation effects are explicit. Supply enough current ecosystem context to contribute without applying obsolete technical or community assumptions.
Start with the source boundary
Fleet policy (2026-10-23): builds require nix build through pinned flakes.
Language builders run inside derivations; a devShell-only compilation is not
the canonical build. Follow cross-platform-project-build-arch
for thin wrappers, target selection, publication and migration away from optional
Nix/direct backends. Keep native runtime testing and credentialed release steps
explicitly separate from artifact construction.
Before nix build, nix develop, or nix flake check after adding, renaming,
or generating a referenced file:
- Run
git status --shortat the flake's Git root. - Identify only the new paths required by the current change.
- Run
scripts/check-flake-inputs --repo "$root" PATH...from this skill. - If it reports an untracked path, review it and stage that exact path with
git add -- PATH. Never substitutegit add -Ain a dirty worktree. - If it reports an ignored path, review the ignore policy before considering
git add -for changing the flake source design.
The checker reports state and never mutates the index. A Git-backed flake sees staged files and tracked files with unstaged edits. It does not see untracked files. This preflight is part of the build, not optional cleanup.
Read references/sources-and-flakes.md for source filtering, path inputs, flake outputs, or missing-source failures.
Route by the work being done
- Read references/dependency-portability.md before adding or repairing Rust/Zig dependencies, private-repository sources, workspace paths or Nix source staging. Server-local paths are not portable dependency pins; distinguish valid in-repository paths from undeclared sibling checkouts. Use staged-manifest checks plus a clean Nix build.
- Read references/derivations-and-packaging.md for dependency roles, phases, hooks, overrides, cross compilation, and package-language dependency caches.
- Read references/diagnostics-and-activation.md for build failures, fixed-output hashes, closure diagnosis, NixOS activation, garbage collection, or store inspection.
- Read references/ecosystem-and-community.md before contributing to Nixpkgs or Nix itself, choosing among upstream Nix, Lix, Determinate Nix, Snix, or Guix, or when ecosystem lore about governance, debates, and forks could affect the work.
Read only the references relevant to the task.
Working sequence
- Establish the supported Nix/Nixpkgs version and target systems. Treat experimental features and release-note behavior as versioned contracts.
- Separate evaluation, realization, and activation. Test the cheapest layer that can falsify the current hypothesis.
- Keep derivation computation pure. Put network access in declared fetchers or fixed-output derivations and pin every external input.
- Expose intentional packages and checks.
nix flake checkevaluates many output types, but it builds onlychecks; alias a package intochecksif the package must be realized by CI. - Test every supported system explicitly, including
--all-systemswhen checking the whole flake. - Verify the resulting executable, closure, or activation behavior rather than accepting a successful evaluation as proof.
Evaluation and realization are normally reversible diagnostics. Lock-file updates, profile changes, garbage collection, service actions, and system activation mutate state. Keep them within Peter's stated scope and preserve a rollback path.
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.

