Defining agent skills in deterministic Nix way
- Nix 100%
| example | ||
| lib | ||
| modules | ||
| flake.lock | ||
| flake.nix | ||
| README.md | ||
Agent Skills Nix
A Nix-based system for fetching, selecting, and installing agent skills.
Skills are installed as symlinks to the Nix store — read-only and automatically updated on rebuild.
Usage
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
agent-skills-nix.url = "github:YOUR_USER/agent-skills-nix";
anthropic-skills = {
url = "github:anthropics/skills";
flake = false;
};
};
outputs = { nixpkgs, agent-skills-nix, anthropic-skills, ... }:
let
pkgs = nixpkgs.legacyPackages.x86_64-linux;
lib = agent-skills-nix.lib.${pkgs.system};
skills = {
"frontend-design" = {
source = anthropic-skills;
description = "Frontend design skill";
enable = true;
};
"my-skill" = {
source = ./.;
path = "skills/my";
description = "My custom skill";
enable = false;
};
};
in
{
packages.x86_64-linux.default = lib.buildSkillBundle { inherit skills; };
};
}
nix run # Build skill bundle
API
lib.buildSkillBundle
buildSkillBundle :: {
skills :: AttrSet # { name = { source, path?, description, enable?, ... }; ... }
} -> Derivation
Parameters:
| Parameter | Type | Description |
|---|---|---|
skills |
AttrSet | Skills to include. See below. |
path |
String? | Optional explicit path within source. Auto-detected if omitted. |
Skill options:
| Option | Type | Default | Description |
|---|---|---|---|
source |
Path | — | Flake input or path containing the skill (required) |
path |
String? | null |
Relative path within source to the skill directory |
description |
String | "" |
Skill description |
enable |
Bool | true |
Whether to include this skill |
version |
String | "1.0.0" |
Skill version |
Skill discovery:
- If
pathis set: usessource/<path> - Otherwise: searches
source/<name>, then recursively searchessource/**/<name>
Output:
$out/share/agent-skills/<name>/
Home Manager
{
imports = [ agent-skills-nix.homeManagerModules.default ];
programs.agent-skills = {
enable = true;
skills = {
"frontend-design" = {
source = anthropic-skills;
description = "Frontend design skill";
};
};
};
}
This creates a symlink at ~/.agents/skills → /nix/store/...-agent-skills/share/agent-skills/.
Example
See example/flake.nix for a complete working example.