nix-flakelisted
Install: claude install-skill atvari-eu/nix-skills
# Nix Flake
Every repository an agent works in should have a `flake.nix`. It gives you —
and any human or agent that comes after you — a one-command, reproducible
toolchain: `nix develop` drops into a shell with the project's compiler,
package manager, and linters, independent of whatever happens to be installed
on the host.
This skill covers two things: noticing when a repo is missing its `flake.nix`,
and writing a good one. The template below is the official default since
August 2026 ([NixOS/templates#103](https://github.com/NixOS/templates/pull/103)),
explained in depth by
[Nixcademy](https://nixcademy.com/posts/new-default-nix-flake-template/).
## Checking for a flake
When you start working in a Git repository, check whether a `flake.nix`
already exists at the repo root:
```bash
test -f "$(git rev-parse --show-toplevel)/flake.nix"
```
- **If it exists**, carry on with the user's task. Nothing to do here.
(Exception: if it uses `flake-utils`, you may offer a migration — see
[Migrating away from flake-utils](#migrating-away-from-flake-utils).)
- **If it is missing**, offer to add one as part of your work: a single
sentence like *"This repo has no flake.nix — want me to add one with a dev
shell for <detected stack>?"* Then continue with what the user actually
asked. Do not silently create files in someone else's project, but do not
nag either: if they decline, drop it and move on.
- Ask which toolchain belongs in the dev shell only if the project type is