Defining agent skills in deterministic Nix way
Find a file
2026-07-09 14:25:57 +07:00
example init 2026-07-09 14:25:57 +07:00
lib init 2026-07-09 14:25:57 +07:00
modules init 2026-07-09 14:25:57 +07:00
flake.lock init 2026-07-09 14:25:57 +07:00
flake.nix init 2026-07-09 14:25:57 +07:00
README.md init 2026-07-09 14:25:57 +07:00

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:

  1. If path is set: uses source/<path>
  2. Otherwise: searches source/<name>, then recursively searches source/**/<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.