Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,10 @@ private static void SearchDirectoriesForSkills(string directory, List<string> re
string skillFilePath = Path.Combine(directory, SkillFileName);
if (File.Exists(skillFilePath))
{
// Once a SKILL.md is found, this directory is the skill root.
// Subdirectories are part of this skill and should not be treated as independent skill roots.
results.Add(Path.GetFullPath(directory));
return;
Comment thread
SergeyMenshykh marked this conversation as resolved.
}

if (currentDepth >= MaxSkillDirectorySearchDepth)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1199,4 +1199,27 @@ public async Task GetSkillsAsync_SymlinkedFileInRealDirectory_SkipsSymlinkedFile
Assert.Equal("references/legit.md", skill.GetTestResources()![0].Name);
}
#endif

[Fact]
public async Task GetSkillsAsync_NestedSkillMd_DoesNotTreatSubdirectoryAsIndependentSkillAsync()
{
// Arrange — parent has SKILL.md; subdirectory also has SKILL.md with a name
// matching its directory so it would pass validation if discovered.
// Only the parent should be discovered as a skill root.
string parentSkillDir = this.CreateSkillDirectory("parent-skill", "Parent skill", "Parent body.");
string childDir = Path.Combine(parentSkillDir, "child");
Directory.CreateDirectory(childDir);
File.WriteAllText(
Path.Combine(childDir, "SKILL.md"),
"---\nname: child\ndescription: Child skill\n---\nChild body.");

var source = new AgentFileSkillsSource(this._testRoot, s_noOpExecutor);

// Act
var skills = await source.GetSkillsAsync();

// Assert — only the parent skill is discovered; the nested child is not an independent skill
Assert.Single(skills);
Assert.Equal("parent-skill", skills[0].Frontmatter.Name);
}
}
Loading