Load Agent Skills in `clai2`'s `coder` plugin, with a `/skill-name` command for each
Merged
DO
2mo ago+877+877+012345678901234567890123456789-70-70-01234567890123456789
- Stacked on #9802 (base branch
harness-skills-discovery); retarget tomainonce it merges. No tracking issue: scoped by @DouweM.
Why we make these changes
CLAI loaded no Agent Skills, so the skills in a project's .agents/skills or .claude/skills and in the user's home never reached the model. There was also no way to invoke one directly, as /skill-name args does in Claude Code. The built-in coder plugin now does both, following the agent_folders pattern.
New public surface
CoderSettings.skill_folders(default.agents/skills,.claude/skills,~/.agents/skills,~/.claude/skills;[]turns skills off), taggedcoder-skill-foldersPlugin.prepare(): async, awaited by the loader once per load before theget_*methods.load_pluginraisesTypeErrorfor a plugin that overrides it; a test callsfrom_host, awaitsprepare(), thencollect.PluginHost.submit_prompt(text): a/commandhandler starts a turn once it returns (it raises anywhere else).PluginHost(submit_prompt=...)supplies it for a host built without a shell, such as in a test.Command(overridable=True): gives way to another command of the same name, with a printed notice. Command names may now contain hyphens.
User-visible behavior
$ clai2 # in this repo
> /pre-push-review main # sends the rendered skill as the next prompt
- The model's catalog lists this repo's 10 skills once each.
.agents/skillsholds copies of.claude/skillsskills, and they count once. - Malformed skills and name clashes print one line each when
coderloads. - A skill named like a command (
/model) leaves the command alone. - New skills reach the model on the next turn, and their
/commandafter/reload. - With no skills, nothing is added: no catalog, no
load_capability.
Verification
tests/clai2/test_coder_skills.py: folders, catalog, no-overhead, notices,/skillturn throughchat(), reload, command clashestests/clai2/test_settings_compatibility.py: savedskill_foldersin builds with and without the feature- End-to-end: headless
clai2 -m test -p hiin~/pydantic-ai, withTestModelpatched to print its request. The catalog lists each of the 10 skills once. In an empty directory and home, it shows no catalog and noload_capability. In tmux: startup notices,/help, and/review src/app.pysubmitting the rendered skill.
What changes for existing users
The stock coder (and saved coder declarations without skill_folders) now loads skills from the four default folders; set "skill_folders": [] to opt out.
Checklist
- No breaking changes in accordance with the version policy.
- Any permitted compatibility impact has a label, warning, migration, release note, and exact API-check waiver.
- PR title is fit for the release changelog.
Opened by Claude (Douwe's coding agent).