You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Discover nested skills while preserving existing precedence - #1786
Skill discovery only checks immediate children of each skills root. Organizing a valid skill as ~/.agents/skills/bundle/group/nested-skill/SKILL.md silently removes it from the available skills, despite the CLI already opting into that home root.
Changes
Search grouping directories breadth-first. Stop at a directory containing SKILL.md, so a skill's resources and examples do not become additional skills. Track canonical directory paths to terminate cycles through symlinks/junctions.
Shallower definitions win within one root; sorted traversal makes same-depth selection deterministic. Existing project/global and .agents/.claude precedence still applies between roots. One real-filesystem regression covers the nested layout, a directory cycle, a resource example and a duplicate flat definition.
Verification
New regression: 0 pass / 1 fail before the implementation change (nested skill missing), then 1 pass / 0 fail. It runs against real temporary directories and a Windows junction, without module mocks.
Original SDK skill suite: 20 pass / 2 fail before, then 21 pass / 1 fail. The remaining failure is an existing POSIX path-prefix assertion on Windows. A temporary copy normalizing only that constant and relocating imports passes all 22 tests; this is supplemental verification, not a Linux run.
Related common skill parsing/listing tests: 14 pass / 0 fail. SDK typecheck passes with installed native TypeScript 7.0.2. Frozen-lockfile install reports no changes. ESLint: 0 errors / 6 existing resolver/import-order warnings.
Raw Prettier checks report Windows CRLF and existing test-file style differences. The LF-normalized loader formats cleanly, and comparison against main finds no new formatting differences in either file.
SDK build remains blocked during declaration-generator loading by the existing ts.sys.getCurrentDirectory error. Binary build and smoke were not run because SDK build is a prerequisite.
Scope / Tradeoffs
Two SDK files only. Group directories retain the existing skill-directory naming restrictions. Discovery stops at SKILL.md even when the document is invalid. The home-directory opt-in, skill names, frontmatter validation and public loader API are retained. No namespace prefixes, plugin discovery, new configuration or project-switch behavior is added.
Good bug fix with a clear root cause: discoverSkillsFromDirectory previously only checked immediate children of a skills root, so anything under bundle/group/nested-skill/SKILL.md was invisible even though the root was already opted into. The breadth-first rewrite in sdk/src/skills/load-skills.ts is sound — using the growing directories array as a queue with for...of correctly visits newly-pushed entries, fs.realpathSync + visited set handles symlink/junction cycles, and stopping recursion as soon as a SKILL.md is found correctly avoids treating a skill's resources/ subfolder as more skills.
The within-root precedence (!Object.hasOwn(skills, skill.name)) combined with sorted entries and natural BFS ordering gives a deterministic 'shallowest/first-sorted wins' rule, which matches the stated intent and is exercised directly by the new regression test (nested skill, duplicate flat definition, resource folder, symlink loop all in one test — nice, realistic coverage with real temp dirs rather than mocks).
Two things worth a second look before porting:
Grouping directories now share isValidSkillName restrictions with skill directories (acknowledged in the PR body) — confirm this doesn't surprise users who already have arbitrarily-named organizational folders.
Unbounded directory walking could be slower on large or deeply-nested skills trees versus the old flat scan; worth a quick sanity check on a large repo if that's a realistic shape, though no correctness issue here.
No forbidden paths touched, change is isolated to two SDK files, and the reasoning/trade-offs section is unusually honest about what wasn't verified (SDK build blocked, Windows-only run). This is exactly the kind of focused, well-tested fix worth porting.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem / Why
Fixes #1784.
Skill discovery only checks immediate children of each skills root. Organizing a valid skill as
~/.agents/skills/bundle/group/nested-skill/SKILL.mdsilently removes it from the available skills, despite the CLI already opting into that home root.Changes
Search grouping directories breadth-first. Stop at a directory containing
SKILL.md, so a skill's resources and examples do not become additional skills. Track canonical directory paths to terminate cycles through symlinks/junctions.Shallower definitions win within one root; sorted traversal makes same-depth selection deterministic. Existing project/global and
.agents/.claudeprecedence still applies between roots. One real-filesystem regression covers the nested layout, a directory cycle, a resource example and a duplicate flat definition.Verification
ts.sys.getCurrentDirectoryerror. Binary build and smoke were not run because SDK build is a prerequisite.Scope / Tradeoffs
Two SDK files only. Group directories retain the existing skill-directory naming restrictions. Discovery stops at
SKILL.mdeven when the document is invalid. The home-directory opt-in, skill names, frontmatter validation and public loader API are retained. No namespace prefixes, plugin discovery, new configuration or project-switch behavior is added.