claude-code: fix skills implementation

Claude skills are only found when using `SKILL.md` entrypoints.
Attribute names should be used for the directory structure, not the
filename.

Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
This commit is contained in:
Austin Horstman 2026-02-18 20:51:14 -06:00
parent 167e0b6837
commit 91be7cce76
7 changed files with 34 additions and 16 deletions

View file

@ -298,14 +298,14 @@ in
default = { }; default = { };
description = '' description = ''
Custom skills for Claude Code. Custom skills for Claude Code.
The attribute name becomes the skill filename or directory name, and the value is either: The attribute name becomes the skill directory name, and the value is either:
- Inline content as a string (creates .claude/skills/<name>.md) - Inline content as a string (creates .claude/skills/<name>/SKILL.md)
- A path to a file (creates .claude/skills/<name>.md) - A path to a file (creates .claude/skills/<name>/SKILL.md)
- A path to a directory (creates .claude/skills/<name>/ with all files) - A path to a directory (creates .claude/skills/<name>/ with all files)
''; '';
example = lib.literalExpression '' example = lib.literalExpression ''
{ {
xlsx = ./skills/xlsx.md; xlsx = ./skills/xlsx/SKILL.md;
data-analysis = ./skills/data-analysis; data-analysis = ./skills/data-analysis;
pdf-processing = ''' pdf-processing = '''
--- ---
@ -334,8 +334,9 @@ in
type = lib.types.nullOr lib.types.path; type = lib.types.nullOr lib.types.path;
default = null; default = null;
description = '' description = ''
Path to a directory containing skill files for Claude Code. Path to a directory containing skill directories for Claude Code.
Skill files from this directory will be symlinked to .claude/skills/. Each skill directory should contain a SKILL.md entrypoint file.
Skill directories from this path will be symlinked to .claude/skills/.
''; '';
example = lib.literalExpression "./skills"; example = lib.literalExpression "./skills";
}; };
@ -516,7 +517,7 @@ in
recursive = true; recursive = true;
} }
else else
lib.nameValuePair ".claude/skills/${name}.md" ( lib.nameValuePair ".claude/skills/${name}/SKILL.md" (
if lib.isPath content then { source = content; } else { text = content; } if lib.isPath content then { source = content; } else { text = content; }
) )
) cfg.skills; ) cfg.skills;

View file

@ -38,14 +38,14 @@
assertFileExists home-files/.claude/commands/path-command.md assertFileExists home-files/.claude/commands/path-command.md
assertFileExists home-files/.claude/agents/inline-agent.md assertFileExists home-files/.claude/agents/inline-agent.md
assertFileExists home-files/.claude/agents/path-agent.md assertFileExists home-files/.claude/agents/path-agent.md
assertFileExists home-files/.claude/skills/inline-skill.md assertFileExists home-files/.claude/skills/inline-skill/SKILL.md
assertFileExists home-files/.claude/skills/path-skill.md assertFileExists home-files/.claude/skills/path-skill/SKILL.md
assertFileContent home-files/.claude/commands/path-command.md \ assertFileContent home-files/.claude/commands/path-command.md \
${./test-command.md} ${./test-command.md}
assertFileContent home-files/.claude/agents/path-agent.md \ assertFileContent home-files/.claude/agents/path-agent.md \
${./test-agent.md} ${./test-agent.md}
assertFileContent home-files/.claude/skills/path-skill.md \ assertFileContent home-files/.claude/skills/path-skill/SKILL.md \
${./test-skill.md} ${./test-skill.md}
''; '';
} }

View file

@ -0,0 +1,12 @@
---
name: data-processing
description: Process and transform structured data files.
---
# Data Processing Skill
Use this skill for data-processing tasks.
## Supporting files
- `extract.md`: extraction workflow details
- `convert.md`: conversion workflow details

View file

@ -5,10 +5,10 @@
}; };
nmt.script = '' nmt.script = ''
assertFileExists home-files/.claude/skills/test-skill.md assertFileExists home-files/.claude/skills/test-skill/SKILL.md
assertLinkExists home-files/.claude/skills/test-skill.md assertLinkExists home-files/.claude/skills/test-skill/SKILL.md
assertFileContent \ assertFileContent \
home-files/.claude/skills/test-skill.md \ home-files/.claude/skills/test-skill/SKILL.md \
${./skills/test-skill.md} ${./skills/test-skill/SKILL.md}
''; '';
} }

View file

@ -7,8 +7,8 @@
}; };
nmt.script = '' nmt.script = ''
assertFileExists home-files/.claude/skills/test-skill.md assertFileExists home-files/.claude/skills/test-skill/SKILL.md
assertFileContent home-files/.claude/skills/test-skill.md \ assertFileContent home-files/.claude/skills/test-skill/SKILL.md \
${./test-skill.md} ${./test-skill.md}
''; '';
} }

View file

@ -7,10 +7,15 @@
}; };
nmt.script = '' nmt.script = ''
assertFileExists home-files/.claude/skills/data-processing/SKILL.md
assertFileExists home-files/.claude/skills/data-processing/extract.md assertFileExists home-files/.claude/skills/data-processing/extract.md
assertFileExists home-files/.claude/skills/data-processing/convert.md assertFileExists home-files/.claude/skills/data-processing/convert.md
assertLinkExists home-files/.claude/skills/data-processing/SKILL.md
assertLinkExists home-files/.claude/skills/data-processing/extract.md assertLinkExists home-files/.claude/skills/data-processing/extract.md
assertLinkExists home-files/.claude/skills/data-processing/convert.md assertLinkExists home-files/.claude/skills/data-processing/convert.md
assertFileContent \
home-files/.claude/skills/data-processing/SKILL.md \
${./skill-subdir/SKILL.md}
assertFileContent \ assertFileContent \
home-files/.claude/skills/data-processing/extract.md \ home-files/.claude/skills/data-processing/extract.md \
${./skill-subdir/extract.md} ${./skill-subdir/extract.md}