opencode: skill -> skills

The skills option was creating files under ~/.config/opencode/skill/
(singular) but OpenCode documentation only mentions
~/.config/opencode/skills/ (plural). Both work, but using an
undocumented directory can be confusing.

Fixes: https://github.com/nix-community/home-manager/issues/8907
This commit is contained in:
Bob van der Linden 2026-03-15 18:04:18 +01:00 committed by Robert Helgesson
parent 5ae5f8cedf
commit 9bc3ca1230
7 changed files with 26 additions and 26 deletions

View file

@ -247,16 +247,16 @@ in
If an attribute set is used, the attribute name becomes the skill directory name,
and the value is either:
- Inline content as a string (creates `opencode/skill/<name>/SKILL.md`)
- A path to a file (creates `opencode/skill/<name>/SKILL.md`)
- A path to a directory (creates `opencode/skill/<name>/` with all files)
- Inline content as a string (creates `opencode/skills/<name>/SKILL.md`)
- A path to a file (creates `opencode/skills/<name>/SKILL.md`)
- A path to a directory (creates `opencode/skills/<name>/` with all files)
This also accepts Nix store paths (e.g., source from a package), allowing you to
reference subdirectories within a package source.
If a path is used, it is expected to contain one folder per skill name, each
containing a {file}`SKILL.md`. The directory is symlinked to
{file}`$XDG_CONFIG_HOME/opencode/skill/`.
{file}`$XDG_CONFIG_HOME/opencode/skills/`.
See <https://opencode.ai/docs/skills/> for the documentation.
'';
@ -419,7 +419,7 @@ in
recursive = true;
};
"opencode/skill" = mkIf (lib.isPath cfg.skills) {
"opencode/skills" = mkIf (lib.isPath cfg.skills) {
source = cfg.skills;
recursive = true;
};
@ -460,12 +460,12 @@ in
|| (builtins.isString content && lib.hasPrefix builtins.storeDir content)
then
lib.nameValuePair "opencode/skill/${name}" {
lib.nameValuePair "opencode/skills/${name}" {
source = content;
recursive = true;
}
else
lib.nameValuePair "opencode/skill/${name}/SKILL.md" (
lib.nameValuePair "opencode/skills/${name}/SKILL.md" (
if lib.isPath content then { source = content; } else { text = content; }
)
) (if builtins.isAttrs cfg.skills then cfg.skills else { })

View file

@ -78,14 +78,14 @@
${./test-tool.ts}
# Skills
assertFileExists home-files/.config/opencode/skill/inline-skill/SKILL.md
assertFileExists home-files/.config/opencode/skill/path-skill/SKILL.md
assertFileExists home-files/.config/opencode/skill/dir-skill/SKILL.md
assertFileExists home-files/.config/opencode/skill/dir-skill/notes.txt
assertFileExists home-files/.config/opencode/skills/inline-skill/SKILL.md
assertFileExists home-files/.config/opencode/skills/path-skill/SKILL.md
assertFileExists home-files/.config/opencode/skills/dir-skill/SKILL.md
assertFileExists home-files/.config/opencode/skills/dir-skill/notes.txt
assertFileContent home-files/.config/opencode/skill/path-skill/SKILL.md \
assertFileContent home-files/.config/opencode/skills/path-skill/SKILL.md \
${./git-release-SKILL.md}
assertFileContent home-files/.config/opencode/skill/dir-skill/SKILL.md \
assertFileContent home-files/.config/opencode/skills/dir-skill/SKILL.md \
${./skill-dir/data-analysis/SKILL.md}
# Themes

View file

@ -5,11 +5,11 @@
};
nmt.script = ''
assertFileExists home-files/.config/opencode/skill/git-release/SKILL.md
assertFileExists home-files/.config/opencode/skill/pdf-processing/SKILL.md
assertFileContent home-files/.config/opencode/skill/git-release/SKILL.md \
assertFileExists home-files/.config/opencode/skills/git-release/SKILL.md
assertFileExists home-files/.config/opencode/skills/pdf-processing/SKILL.md
assertFileContent home-files/.config/opencode/skills/git-release/SKILL.md \
${./skills-bulk/git-release/SKILL.md}
assertFileContent home-files/.config/opencode/skill/pdf-processing/SKILL.md \
assertFileContent home-files/.config/opencode/skills/pdf-processing/SKILL.md \
${./skills-bulk/pdf-processing/SKILL.md}
'';
}

View file

@ -7,9 +7,9 @@
};
nmt.script = ''
assertFileExists home-files/.config/opencode/skill/data-analysis/SKILL.md
assertFileExists home-files/.config/opencode/skill/data-analysis/notes.txt
assertFileContent home-files/.config/opencode/skill/data-analysis/SKILL.md \
assertFileExists home-files/.config/opencode/skills/data-analysis/SKILL.md
assertFileExists home-files/.config/opencode/skills/data-analysis/notes.txt
assertFileContent home-files/.config/opencode/skills/data-analysis/SKILL.md \
${./skill-dir/data-analysis/SKILL.md}
'';
}

View file

@ -18,8 +18,8 @@
};
nmt.script = ''
assertFileExists home-files/.config/opencode/skill/git-release/SKILL.md
assertFileContent home-files/.config/opencode/skill/git-release/SKILL.md \
assertFileExists home-files/.config/opencode/skills/git-release/SKILL.md
assertFileContent home-files/.config/opencode/skills/git-release/SKILL.md \
${./git-release-SKILL.md}
'';
}

View file

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

View file

@ -16,9 +16,9 @@ in
};
nmt.script = ''
assertFileExists home-files/.config/opencode/skill/internal-skill/SKILL.md
assertFileExists home-files/.config/opencode/skills/internal-skill/SKILL.md
assertFileContent home-files/.config/opencode/skill/internal-skill/SKILL.md \
assertFileContent home-files/.config/opencode/skills/internal-skill/SKILL.md \
"${src}/skills/external-skill/SKILL.md"
'';
}