Skill hot-reload doesn't detect new skill directories added mid-session
Problem
Skill hot-reload (added in v2.1.0) correctly detects modifications to existing SKILL.md files, but does not detect new skill directories created in .claude/skills/ during a running session.
For example:
- Start a Claude Code session
- Create a new skill:
mkdir -p .claude/skills/my-new-skill && echo '---\nname: my-new-skill\ndescription: Does something\n---\nInstructions here' > .claude/skills/my-new-skill/SKILL.md - The skill does not appear in
/skillsand the Skill tool doesn't recognize it - Starting a new session picks it up fine
Expected behavior
New skill directories created in .claude/skills/ (or ~/.claude/skills/) mid-session should be discovered and made available without restarting the session, consistent with the documented hot-reload behavior.
Root cause (from analyzing cli.js)
The file watcher uses fs.watchFile() on individual SKILL.md files that are known at session start. This detects modifications to existing skills but cannot detect new directory entries. The dynamicSkillDirTriggers path also skips already-discovered parent directories via a dedup set (xCR).
Suggested fix
Add fs.watch() on the skill directories themselves (.claude/skills/, ~/.claude/skills/, etc.) to detect new subdirectory creation, then trigger the existing K0T() re-scan function with a short debounce. The existing trust checks (EP("projectSettings")) and .gitignore filtering should still apply.
Environment
- Claude Code v2.1.17
- macOS (Darwin 25.0.0)
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗