@@ -172,8 +172,8 @@ describe('loadSkills', () => {
172172
173173 test ( 'skips invalid skill directories and malformed skill definitions' , async ( ) => {
174174 const skillsRoot = path . join ( projectDir , '.agents' , 'skills' )
175- const consoleError = spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } )
176- const consoleWarn = spyOn ( console , 'warn' ) . mockImplementation ( ( ) => { } )
175+ const consoleError = spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } )
176+ const consoleWarn = spyOn ( console , 'warn' ) . mockImplementation ( ( ) => { } )
177177
178178 mkdirSync ( path . join ( skillsRoot , 'missing-skill-file' ) , { recursive : true } )
179179
@@ -238,4 +238,34 @@ describe('loadSkills', () => {
238238 'Skipping invalid skill directory name: special_skill' ,
239239 )
240240 } )
241+
242+ test ( 'loads skills from skillsPath and bypasses default search roots' , async ( ) => {
243+ const customSkillsDir = path . join ( tempRoot , 'custom-skills' )
244+ mkdirSync ( customSkillsDir , { recursive : true } )
245+
246+ // Put a skill in a default root that should NOT be found
247+ writeSkill ( {
248+ skillsRoot : path . join ( projectDir , '.agents' , 'skills' ) ,
249+ skillDirName : 'default-skill' ,
250+ description : 'Should not be found' ,
251+ } )
252+
253+ // Put a skill in the custom directory that SHOULD be found
254+ writeSkill ( {
255+ skillsRoot : customSkillsDir ,
256+ skillDirName : 'custom-skill' ,
257+ description : 'Found via skillsPath' ,
258+ } )
259+
260+ const skills = await loadSkills ( {
261+ cwd : projectDir ,
262+ skillsPath : customSkillsDir ,
263+ } )
264+
265+ expect ( Object . keys ( skills ) . sort ( ) ) . toEqual ( [ 'custom-skill' ] )
266+ expect ( skills [ 'custom-skill' ] ?. description ) . toBe ( 'Found via skillsPath' )
267+ expect ( skills [ 'custom-skill' ] ?. filePath ) . toBe (
268+ path . join ( customSkillsDir , 'custom-skill' , 'SKILL.md' ) ,
269+ )
270+ } )
241271} )
0 commit comments