fix: skillkit read searches all agent dirs and finds standalone .md skills

getSearchDirs now collects skill directories from ALL agent adapters
instead of only the configured agent. This fixes 'skill not found' when
skills were installed to .claude/skills/ but the default agent is
universal (which only searches skills/).

findSkill now also checks name.md for standalone .md skills that were
installed as plain files.
This commit is contained in:
Rohit Ghumare
2026-04-10 21:56:06 +01:00
parent ba09309d5b
commit d9d775b189
2 changed files with 27 additions and 11 deletions
+20 -10
View File
@@ -8,7 +8,7 @@ import {
loadSkillMetadata as coreLoadSkillMetadata,
saveSkillMetadata as coreSaveSkillMetadata,
} from "@skillkit/core";
import { getAdapter, detectAgent } from "@skillkit/agents";
import { getAdapter, detectAgent, getAllAdapters } from "@skillkit/agents";
import type { AgentType, AgentAdapterInfo } from "@skillkit/core";
// Re-export metadata functions directly (they don't need adapter bridging)
@@ -16,15 +16,25 @@ export const loadSkillMetadata = coreLoadSkillMetadata;
export const saveSkillMetadata = coreSaveSkillMetadata;
export function getSearchDirs(agentType?: AgentType): string[] {
const type = agentType || loadConfig().agent;
const adapter = getAdapter(type);
const adapterInfo: AgentAdapterInfo = {
type: adapter.type,
name: adapter.name,
skillsDir: adapter.skillsDir,
configFile: adapter.configFile,
};
return coreGetSearchDirs(adapterInfo);
const dirs = new Set<string>();
const adapters = agentType
? [getAdapter(agentType)]
: getAllAdapters();
for (const adapter of adapters) {
const info: AgentAdapterInfo = {
type: adapter.type,
name: adapter.name,
skillsDir: adapter.skillsDir,
configFile: adapter.configFile,
};
for (const dir of coreGetSearchDirs(info)) {
dirs.add(dir);
}
}
return [...dirs];
}
export function getInstallDir(global = false, agentType?: AgentType): string {
+7 -1
View File
@@ -311,11 +311,17 @@ export function findSkill(name: string, searchDirs: string[]): Skill | null {
for (const dir of searchDirs) {
if (!existsSync(dir)) continue;
const location: SkillLocation = dir.includes(process.cwd()) ? 'project' : 'global';
const skillPath = join(dir, name);
if (existsSync(skillPath)) {
const location: SkillLocation = dir.includes(process.cwd()) ? 'project' : 'global';
return parseSkill(skillPath, location);
}
const mdPath = join(dir, name.endsWith('.md') ? name : `${name}.md`);
if (existsSync(mdPath)) {
return parseStandaloneSkill(mdPath, location);
}
}
return null;