diff --git a/README.md b/README.md index cb7e508b..66eb6df3 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,12 @@ # nixos +### Agent skills + +Add a directory named after the skill with a `SKILL.md` and any supporting files. +Use [`skills/generic/`](skills/generic) for skills shared by Claude Code and Pi, +or [`skills/claude/`](skills/claude) for skills that rely on Claude Code features. +Both directories are picked up automatically on the next system switch. + ### Secret management Two secret mechanisms coexist in this repo. They store, register, and rekey differently, so before working with any `.age` file identify which one it uses. diff --git a/modules/home/claude/default.nix b/modules/home/claude/default.nix index fa25c4b9..edc56d27 100644 --- a/modules/home/claude/default.nix +++ b/modules/home/claude/default.nix @@ -3,6 +3,11 @@ let cfg = config.custom.home.claude; user = config.custom.user; + claudeSkills = pkgs.symlinkJoin { + name = "claude-code-skills"; + paths = [ ../../../skills/generic ../../../skills/claude ]; + }; + claudeSettings = { remoteControlAtStartup = false; permissions.defaultMode = "auto"; @@ -55,11 +60,7 @@ in # leaves ~/.claude/settings.json for Claude Code to save its choices in. environment.etc = { "claude-code/managed-settings.json".text = builtins.toJSON claudeSettings; - "claude-code/.claude/skills/commit/SKILL.md".source = ./commit-skill/SKILL.md; - "claude-code/.claude/skills/github-fetch/SKILL.md".source = ./github-fetch-skill/SKILL.md; - "claude-code/.claude/skills/megamerge/SKILL.md".source = ./megamerge-skill/SKILL.md; - "claude-code/.claude/skills/megamerge-sync/SKILL.md".source = ./megamerge-sync-skill/SKILL.md; - "claude-code/.claude/skills/megamerge-place/SKILL.md".source = ./megamerge-place-skill/SKILL.md; + "claude-code/.claude/skills".source = claudeSkills; }; home-manager.users.${user} = { lib, ... }: { diff --git a/modules/home/pi/default.nix b/modules/home/pi/default.nix index 3b49dd7c..7c1084a9 100644 --- a/modules/home/pi/default.nix +++ b/modules/home/pi/default.nix @@ -133,6 +133,10 @@ in home.file = { ".pi/agent/AGENTS.md".source = ./AGENTS.md; + ".pi/agent/skills" = { + source = ../../../skills/generic; + recursive = true; + }; ".pi/agent/models.json" = { text = builtins.toJSON piModels; force = true; diff --git a/modules/services/async-coder/default.nix b/modules/services/async-coder/default.nix index dd0f0d30..ee7f80b1 100644 --- a/modules/services/async-coder/default.nix +++ b/modules/services/async-coder/default.nix @@ -5,10 +5,13 @@ let fqdnParts = lib.splitString "." config.networking.fqdn; shortHost = "${builtins.elemAt fqdnParts 0}.${builtins.elemAt fqdnParts 1}"; - skillsDir = pkgs.linkFarm "async-coder-skills" [ - { name = "commit.md"; path = ../../home/claude/commit-skill/SKILL.md; } - { name = "github-fetch.md"; path = ../../home/claude/github-fetch-skill/SKILL.md; } - ]; + allowedSkills = [ "commit" "github-fetch" ]; + skillsDir = pkgs.linkFarm "async-coder-skills" (map + (name: { + name = "${name}.md"; + path = ../../../skills/generic + "/${name}/SKILL.md"; + }) + allowedSkills); in { options.custom.services.async_coder = { @@ -107,7 +110,7 @@ in git_author_email = "jake@hillion.co.uk"; skills_path = skillsDir; - allowed_skills = [ "commit" "github-fetch" ]; + allowed_skills = allowedSkills; permissions.allow = [ { exact = "cargo --version"; } diff --git a/modules/home/claude/megamerge-place-skill/SKILL.md b/skills/claude/megamerge-place/SKILL.md similarity index 100% rename from modules/home/claude/megamerge-place-skill/SKILL.md rename to skills/claude/megamerge-place/SKILL.md diff --git a/modules/home/claude/megamerge-sync-skill/SKILL.md b/skills/claude/megamerge-sync/SKILL.md similarity index 100% rename from modules/home/claude/megamerge-sync-skill/SKILL.md rename to skills/claude/megamerge-sync/SKILL.md diff --git a/modules/home/claude/megamerge-skill/SKILL.md b/skills/claude/megamerge/SKILL.md similarity index 100% rename from modules/home/claude/megamerge-skill/SKILL.md rename to skills/claude/megamerge/SKILL.md diff --git a/modules/home/claude/commit-skill/SKILL.md b/skills/generic/commit/SKILL.md similarity index 100% rename from modules/home/claude/commit-skill/SKILL.md rename to skills/generic/commit/SKILL.md diff --git a/modules/home/claude/github-fetch-skill/SKILL.md b/skills/generic/github-fetch/SKILL.md similarity index 100% rename from modules/home/claude/github-fetch-skill/SKILL.md rename to skills/generic/github-fetch/SKILL.md