claude-code: added 'skills' option to specify skills from filesystem

This commit is contained in:
t-monaghan 2025-11-25 13:45:10 +11:00 committed by Austin Horstman
parent a26b74229f
commit 6aff254343
11 changed files with 169 additions and 1 deletions

View file

@ -38,6 +38,12 @@
test-hook = "test content";
};
hooksDir = ./hooks;
# assert fail: cannot set skills and skillsDir at the same time.
skills = {
test-skill = "test content";
};
skillsDir = ./skills;
};
test.asserts.assertions.expected = [
@ -46,5 +52,6 @@
"Cannot specify both `programs.claude-code.agents` and `programs.claude-code.agentsDir`"
"Cannot specify both `programs.claude-code.commands` and `programs.claude-code.commandsDir`"
"Cannot specify both `programs.claude-code.hooks` and `programs.claude-code.hooksDir`"
"Cannot specify both `programs.claude-code.skills` and `programs.claude-code.skillsDir`"
];
}

View file

@ -8,7 +8,10 @@
claude-code-agents-dir = ./agents-dir.nix;
claude-code-commands-dir = ./commands-dir.nix;
claude-code-hooks-dir = ./hooks-dir.nix;
claude-code-skills-dir = ./skills-dir.nix;
claude-code-skills-subdir = ./skills-subdir.nix;
claude-code-agents-path = ./agents-path.nix;
claude-code-commands-path = ./commands-path.nix;
claude-code-skills-path = ./skills-path.nix;
claude-code-mixed-content = ./mixed-content.nix;
}

View file

@ -22,6 +22,15 @@
'';
path-agent = ./test-agent.md;
};
skills = {
inline-skill = ''
Use this skill when the user asks you to perform an inline operation.
## Instructions
This skill is defined inline.
'';
path-skill = ./test-skill.md;
};
};
nmt.script = ''
@ -29,10 +38,14 @@
assertFileExists home-files/.claude/commands/path-command.md
assertFileExists home-files/.claude/agents/inline-agent.md
assertFileExists home-files/.claude/agents/path-agent.md
assertFileExists home-files/.claude/skills/inline-skill.md
assertFileExists home-files/.claude/skills/path-skill.md
assertFileContent home-files/.claude/commands/path-command.md \
${./test-command.md}
assertFileContent home-files/.claude/agents/path-agent.md \
${./test-agent.md}
assertFileContent home-files/.claude/skills/path-skill.md \
${./test-skill.md}
'';
}

View file

@ -0,0 +1,8 @@
---
name: convert
description: Convert between file formats
---
# Convert Skill
Convert files between different formats.

View file

@ -0,0 +1,8 @@
---
name: extract
description: Extract data from files
---
# Extract Skill
Extract data from various file formats.

View file

@ -0,0 +1,14 @@
{
programs.claude-code = {
enable = true;
skillsDir = ./skills;
};
nmt.script = ''
assertFileExists home-files/.claude/skills/test-skill.md
assertLinkExists home-files/.claude/skills/test-skill.md
assertFileContent \
home-files/.claude/skills/test-skill.md \
${./skills/test-skill.md}
'';
}

View file

@ -0,0 +1,14 @@
{
programs.claude-code = {
enable = true;
skills = {
test-skill = ./test-skill.md;
};
};
nmt.script = ''
assertFileExists home-files/.claude/skills/test-skill.md
assertFileContent home-files/.claude/skills/test-skill.md \
${./test-skill.md}
'';
}

View file

@ -0,0 +1,21 @@
{
programs.claude-code = {
enable = true;
skills = {
data-processing = ./skill-subdir;
};
};
nmt.script = ''
assertFileExists home-files/.claude/skills/data-processing/extract.md
assertFileExists home-files/.claude/skills/data-processing/convert.md
assertLinkExists home-files/.claude/skills/data-processing/extract.md
assertLinkExists home-files/.claude/skills/data-processing/convert.md
assertFileContent \
home-files/.claude/skills/data-processing/extract.md \
${./skill-subdir/extract.md}
assertFileContent \
home-files/.claude/skills/data-processing/convert.md \
${./skill-subdir/convert.md}
'';
}

View file

@ -0,0 +1,6 @@
Use this skill when the user asks you to perform a test operation.
## Instructions
1. Parse user input
2. Execute test operation
3. Return results

View file

@ -0,0 +1,6 @@
Use this skill when the user asks you to perform a test operation.
## Instructions
1. Parse user input
2. Execute test operation
3. Return results