11import { describe , expect } from "bun:test"
22import { Effect , Layer } from "effect"
33import { Skill } from "../../src/skill"
4+ import { Discovery } from "../../src/skill/discovery"
5+ import { RuntimeFlags } from "../../src/effect/runtime-flags"
6+ import { Bus } from "../../src/bus"
7+ import { Config } from "../../src/config/config"
48import { CrossSpawnSpawner } from "@opencode-ai/core/cross-spawn-spawner"
9+ import { AppFileSystem } from "@opencode-ai/core/filesystem"
10+ import { Global } from "@opencode-ai/core/global"
511import { provideInstance , provideTmpdirInstance , tmpdir } from "../fixture/fixture"
612import { testEffect } from "../lib/effect"
713import path from "path"
@@ -10,6 +16,19 @@ import fs from "fs/promises"
1016const node = CrossSpawnSpawner . defaultLayer
1117
1218const it = testEffect ( Layer . mergeAll ( Skill . defaultLayer , node ) )
19+ const itWithoutClaudeCodeSkills = testEffect (
20+ Layer . mergeAll (
21+ Skill . layer . pipe (
22+ Layer . provide ( Discovery . defaultLayer ) ,
23+ Layer . provide ( Config . defaultLayer ) ,
24+ Layer . provide ( Bus . layer ) ,
25+ Layer . provide ( AppFileSystem . defaultLayer ) ,
26+ Layer . provide ( Global . layer ) ,
27+ Layer . provide ( RuntimeFlags . layer ( { disableClaudeCodeSkills : true } ) ) ,
28+ ) ,
29+ node ,
30+ ) ,
31+ )
1332
1433async function createGlobalSkill ( homeDir : string ) {
1534 const skillDir = path . join ( homeDir , ".claude" , "skills" , "global-test-skill" )
@@ -364,6 +383,43 @@ description: A skill in the .agents/skills directory.
364383 ) ,
365384 )
366385
386+ itWithoutClaudeCodeSkills . live ( "skips Claude Code skills when disabled" , ( ) =>
387+ provideTmpdirInstance (
388+ ( dir ) =>
389+ Effect . gen ( function * ( ) {
390+ yield * Effect . promise ( ( ) =>
391+ Promise . all ( [
392+ Bun . write (
393+ path . join ( dir , ".claude" , "skills" , "claude-skill" , "SKILL.md" ) ,
394+ `---
395+ name: claude-skill
396+ description: A skill in the .claude/skills directory.
397+ ---
398+
399+ # Claude Skill
400+ ` ,
401+ ) ,
402+ Bun . write (
403+ path . join ( dir , ".agents" , "skills" , "agent-skill" , "SKILL.md" ) ,
404+ `---
405+ name: agent-skill
406+ description: A skill in the .agents/skills directory.
407+ ---
408+
409+ # Agent Skill
410+ ` ,
411+ ) ,
412+ ] ) ,
413+ )
414+
415+ const skill = yield * Skill . Service
416+ const list = ( yield * skill . all ( ) ) . filter ( ( s ) => s . location !== "<built-in>" )
417+ expect ( list . map ( ( s ) => s . name ) ) . toEqual ( [ "agent-skill" ] )
418+ } ) ,
419+ { git : true } ,
420+ ) ,
421+ )
422+
367423 it . live ( "properly resolves directories that skills live in" , ( ) =>
368424 provideTmpdirInstance (
369425 ( dir ) =>
0 commit comments