Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

ClaudeSkills.test.ts

683 lines23.9 KB

1import * as NodeServices from "@effect/platform-node/NodeServices";
2import { assert, it } from "@effect/vitest";
3import * as Effect from "effect/Effect";
4import * as FileSystem from "effect/FileSystem";
5import * as Path from "effect/Path";
6​
7import { discoverClaudeSkills, skillOverrideSettingsPaths } from "./ClaudeSkills.ts";
8​
9const writeSkill = Effect.fn(function* (
10 skillsDir: string,
11 directoryName: string,
12 contents: string,
13) {
14 const fs = yield* FileSystem.FileSystem;
15 const path = yield* Path.Path;
16 const skillDir = path.join(skillsDir, directoryName);
17 yield* fs.makeDirectory(skillDir, { recursive: true });
18 yield* fs.writeFileString(path.join(skillDir, "SKILL.md"), contents);
19});
20​
21it.layer(NodeServices.layer)("discoverClaudeSkills", (it) => {
22 it.effect("discovers user and project skills with frontmatter metadata", () =>
23 Effect.gen(function* () {
24 const fs = yield* FileSystem.FileSystem;
25 const path = yield* Path.Path;
26 const tempDir = yield* fs.makeTempDirectoryScoped({ prefix: "t3-claude-skills-" });
27 const configDir = path.join(tempDir, "claude-home");
28 const workspace = path.join(tempDir, "workspace");
29​
30 yield* writeSkill(
31 path.join(configDir, "skills"),
32 "codex-review",
33 [
34 "---",
35 "name: codex-review",
36 "description: Ask Codex for a review.",
37 "---",
38 "",
39 "# Body",
40 ].join("\n"),
41 );
42 yield* writeSkill(
43 path.join(workspace, ".claude", "skills"),
44 "deploy",
45 ["---", "name: deploy", "description: Deploy the app.", "---", "", "# Deploy"].join("\n"),
46 );
47​
48 const skills = yield* discoverClaudeSkills({ homePath: configDir }, workspace);
49​
50 assert.deepEqual(skills, [
51 {
52 name: "codex-review",
53 path: path.join(configDir, "skills", "codex-review", "SKILL.md"),
54 enabled: true,
55 scope: "user",
56 description: "Ask Codex for a review.",
57 },
58 {
59 name: "deploy",
60 path: path.join(workspace, ".claude", "skills", "deploy", "SKILL.md"),
61 enabled: true,
62 scope: "project",
63 description: "Deploy the app.",
64 },
65 ]);
66 }),
67 );
68​
69 it.effect("ignores .agents/skills, which Claude Code does not load", () =>
70 Effect.gen(function* () {
71 const fs = yield* FileSystem.FileSystem;
72 const path = yield* Path.Path;
73 const tempDir = yield* fs.makeTempDirectoryScoped({ prefix: "t3-claude-skills-" });
74 const configDir = path.join(tempDir, "claude-home");
75 const workspace = path.join(tempDir, "workspace");
76​
77 // Verified against the CLI: `/review` here is answered with
78 // `Unknown command`, so offering it would dispatch a dead command.
79 yield* writeSkill(
80 path.join(workspace, ".agents", "skills"),
81 "review",
82 ["---", "name: review", "description: Review the changes.", "---"].join("\n"),
83 );
84​
85 const skills = yield* discoverClaudeSkills({ homePath: configDir }, workspace);
86​
87 assert.deepEqual(skills, []);
88 }),
89 );
90​
91 it.effect("prefers user skills on name collisions even with a stray .agents copy", () =>
92 Effect.gen(function* () {
93 const fs = yield* FileSystem.FileSystem;
94 const path = yield* Path.Path;
95 const tempDir = yield* fs.makeTempDirectoryScoped({ prefix: "t3-claude-skills-" });
96 const configDir = path.join(tempDir, "claude-home");
97 const workspace = path.join(tempDir, "workspace");
98​
99 yield* writeSkill(
100 path.join(configDir, "skills"),
101 "deploy",
102 ["---", "name: deploy", "description: User deploy.", "---"].join("\n"),
103 );
104 yield* writeSkill(
105 path.join(workspace, ".agents", "skills"),
106 "deploy",
107 ["---", "name: deploy", "description: Agents deploy.", "---"].join("\n"),
108 );
109 yield* writeSkill(
110 path.join(workspace, ".claude", "skills"),
111 "deploy",
112 ["---", "name: deploy", "description: Claude deploy.", "---"].join("\n"),
113 );
114​
115 const skills = yield* discoverClaudeSkills({ homePath: configDir }, workspace);
116​
117 assert.deepEqual(skills, [
118 {
119 name: "deploy",
120 path: path.join(configDir, "skills", "deploy", "SKILL.md"),
121 enabled: true,
122 scope: "user",
123 description: "User deploy.",
124 },
125 ]);
126 }),
127 );
128​
129 it.effect("prefers user skills over project skills on name collisions", () =>
130 Effect.gen(function* () {
131 const fs = yield* FileSystem.FileSystem;
132 const path = yield* Path.Path;
133 const tempDir = yield* fs.makeTempDirectoryScoped({ prefix: "t3-claude-skills-" });
134 const configDir = path.join(tempDir, "claude-home");
135 const workspace = path.join(tempDir, "workspace");
136​
137 yield* writeSkill(
138 path.join(configDir, "skills"),
139 "deploy",
140 ["---", "name: deploy", "description: User deploy.", "---"].join("\n"),
141 );
142 yield* writeSkill(
143 path.join(workspace, ".claude", "skills"),
144 "deploy",
145 ["---", "name: deploy", "description: Project deploy.", "---"].join("\n"),
146 );
147​
148 const skills = yield* discoverClaudeSkills({ homePath: configDir }, workspace);
149​
150 assert.equal(skills.length, 1);
151 assert.equal(skills[0]?.scope, "user");
152 assert.equal(skills[0]?.description, "User deploy.");
153 }),
154 );
155​
156 it.effect("falls back to the directory name and skips malformed frontmatter", () =>
157 Effect.gen(function* () {
158 const fs = yield* FileSystem.FileSystem;
159 const path = yield* Path.Path;
160 const tempDir = yield* fs.makeTempDirectoryScoped({ prefix: "t3-claude-skills-" });
161 const configDir = path.join(tempDir, "claude-home");
162 const skillsDir = path.join(configDir, "skills");
163​
164 yield* writeSkill(skillsDir, "no-frontmatter", "# Just a heading\n");
165 yield* writeSkill(skillsDir, "broken-yaml", "---\nname: [unclosed\n---\n");
166 // A stray file (not a directory with SKILL.md) must be skipped.
167 yield* fs.makeDirectory(skillsDir, { recursive: true });
168 yield* fs.writeFileString(path.join(skillsDir, "README.md"), "not a skill");
169​
170 const skills = yield* discoverClaudeSkills({ homePath: configDir }, undefined);
171​
172 // A skill with no frontmatter falls back to its directory name; a skill
173 // whose frontmatter fails to parse is skipped entirely (Claude Code
174 // won't load it either).
175 assert.deepEqual(
176 skills.map((skill) => skill.name),
177 ["no-frontmatter"],
178 );
179 assert.equal(skills[0]?.description, undefined);
180 }),
181 );
182​
183 it.effect("honors CLAUDE_CONFIG_DIR from the environment when homePath is unset", () =>
184 Effect.gen(function* () {
185 const fs = yield* FileSystem.FileSystem;
186 const path = yield* Path.Path;
187 const tempDir = yield* fs.makeTempDirectoryScoped({ prefix: "t3-claude-skills-" });
188 const environmentConfigDir = path.join(tempDir, "env-config");
189​
190 yield* writeSkill(
191 path.join(environmentConfigDir, "skills"),
192 "env-skill",
193 ["---", "name: env-skill", "description: From env config dir.", "---"].join("\n"),
194 );
195​
196 const skills = yield* discoverClaudeSkills({ homePath: "" }, undefined, {
197 CLAUDE_CONFIG_DIR: environmentConfigDir,
198 });
199​
200 assert.deepEqual(
201 skills.map((skill) => skill.name),
202 ["env-skill"],
203 );
204​
205 // An explicit homePath wins over the environment variable, matching
206 // makeClaudeEnvironment which overwrites CLAUDE_CONFIG_DIR for the CLI.
207 const explicitHome = path.join(tempDir, "explicit-home");
208 yield* writeSkill(
209 path.join(explicitHome, "skills"),
210 "explicit-skill",
211 ["---", "name: explicit-skill", "---"].join("\n"),
212 );
213 const explicitSkills = yield* discoverClaudeSkills({ homePath: explicitHome }, undefined, {
214 CLAUDE_CONFIG_DIR: environmentConfigDir,
215 });
216 assert.deepEqual(
217 explicitSkills.map((skill) => skill.name),
218 ["explicit-skill"],
219 );
220 }),
221 );
222​
223 it.effect("resolves a relative CLAUDE_CONFIG_DIR against the workspace cwd", () =>
224 Effect.gen(function* () {
225 const fs = yield* FileSystem.FileSystem;
226 const path = yield* Path.Path;
227 const tempDir = yield* fs.makeTempDirectoryScoped({ prefix: "t3-claude-skills-" });
228 const workspace = path.join(tempDir, "workspace");
229 yield* fs.makeDirectory(workspace, { recursive: true });
230​
231 // The spawned CLI resolves a relative CLAUDE_CONFIG_DIR against its own
232 // cwd (the workspace), so discovery must do the same.
233 yield* writeSkill(
234 path.join(workspace, "relative-config", "skills"),
235 "relative-skill",
236 ["---", "name: relative-skill", "---"].join("\n"),
237 );
238​
239 const skills = yield* discoverClaudeSkills({ homePath: "" }, workspace, {
240 CLAUDE_CONFIG_DIR: "relative-config",
241 });
242​
243 assert.deepEqual(
244 skills.map((skill) => skill.name),
245 ["relative-skill"],
246 );
247 assert.equal(skills[0]?.scope, "user");
248 }),
249 );
250​
251 it.effect("marks skills that only the user can invoke", () =>
252 Effect.gen(function* () {
253 const fs = yield* FileSystem.FileSystem;
254 const path = yield* Path.Path;
255 const tempDir = yield* fs.makeTempDirectoryScoped({ prefix: "t3-claude-skills-" });
256 const configDir = path.join(tempDir, "claude-home");
257 const workspace = path.join(tempDir, "workspace");
258​
259 yield* writeSkill(
260 path.join(workspace, ".claude", "skills"),
261 "re-release-version",
262 [
263 "---",
264 "name: re-release-version",
265 "description: Move the current tag forward.",
266 "disable-model-invocation: true",
267 "---",
268 "",
269 "# Body",
270 ].join("\n"),
271 );
272 yield* writeSkill(
273 path.join(workspace, ".claude", "skills"),
274 "release-version",
275 ["---", "name: release-version", "description: Cut a release.", "---", "", "# Body"].join(
276 "\n",
277 ),
278 );
279​
280 const skills = yield* discoverClaudeSkills({ homePath: configDir }, workspace);
281​
282 assert.equal(
283 skills.find((skill) => skill.name === "re-release-version")?.userInvocationOnly,
284 true,
285 );
286 assert.equal(
287 skills.find((skill) => skill.name === "release-version")?.userInvocationOnly,
288 undefined,
289 );
290 }),
291 );
292​
293 it.effect("disables skills switched off by skillOverrides", () =>
294 Effect.gen(function* () {
295 const fs = yield* FileSystem.FileSystem;
296 const path = yield* Path.Path;
297 const tempDir = yield* fs.makeTempDirectoryScoped({ prefix: "t3-claude-skills-" });
298 const configDir = path.join(tempDir, "claude-home");
299 const workspace = path.join(tempDir, "workspace");
300​
301 for (const name of ["kept", "off-by-user", "off-by-project"]) {
302 yield* writeSkill(
303 path.join(configDir, "skills"),
304 name,
305 ["---", `name: ${name}`, "---", "", "# Body"].join("\n"),
306 );
307 }
308​
309 yield* fs.makeDirectory(configDir, { recursive: true });
310 yield* fs.writeFileString(
311 path.join(configDir, "settings.json"),
312 '{ "skillOverrides": { "off-by-user": "off", "kept": "on" } }',
313 );
314 yield* fs.makeDirectory(path.join(workspace, ".claude"), { recursive: true });
315 yield* fs.writeFileString(
316 path.join(workspace, ".claude", "settings.json"),
317 '{ "skillOverrides": { "off-by-project": "off" } }',
318 );
319​
320 const skills = yield* discoverClaudeSkills({ homePath: configDir }, workspace);
321​
322 assert.deepEqual(
323 skills.map((skill) => [skill.name, skill.enabled]),
324 [
325 ["kept", true],
326 ["off-by-project", false],
327 ["off-by-user", false],
328 ],
329 );
330 }),
331 );
332​
333 it.effect("ignores unreadable settings when resolving skillOverrides", () =>
334 Effect.gen(function* () {
335 const fs = yield* FileSystem.FileSystem;
336 const path = yield* Path.Path;
337 const tempDir = yield* fs.makeTempDirectoryScoped({ prefix: "t3-claude-skills-" });
338 const configDir = path.join(tempDir, "claude-home");
339​
340 yield* writeSkill(
341 path.join(configDir, "skills"),
342 "kept",
343 ["---", "name: kept", "---", "", "# Body"].join("\n"),
344 );
345 yield* fs.writeFileString(path.join(configDir, "settings.json"), "{ not json");
346​
347 const skills = yield* discoverClaudeSkills({ homePath: configDir });
348​
349 assert.deepEqual(
350 skills.map((skill) => [skill.name, skill.enabled]),
351 [["kept", true]],
352 );
353 }),
354 );
355​
356 it.effect("treats a user-invocable-only override like disable-model-invocation", () =>
357 Effect.gen(function* () {
358 const fs = yield* FileSystem.FileSystem;
359 const path = yield* Path.Path;
360 const tempDir = yield* fs.makeTempDirectoryScoped({ prefix: "t3-claude-skills-" });
361 const configDir = path.join(tempDir, "claude-home");
362​
363 yield* writeSkill(
364 path.join(configDir, "skills"),
365 "ask-matt",
366 ["---", "name: ask-matt", "---", "", "# Body"].join("\n"),
367 );
368 yield* fs.writeFileString(
369 path.join(configDir, "settings.json"),
370 '{ "skillOverrides": { "ask-matt": "user-invocable-only" } }',
371 );
372​
373 const skills = yield* discoverClaudeSkills({ homePath: configDir });
374​
375 assert.deepEqual(
376 skills.map((skill) => [skill.name, skill.enabled, skill.userInvocationOnly === true]),
377 [["ask-matt", true, true]],
378 );
379 }),
380 );
381​
382 it.effect("drops every override in a file when one value is invalid, as Claude Code does", () =>
383 Effect.gen(function* () {
384 const fs = yield* FileSystem.FileSystem;
385 const path = yield* Path.Path;
386 const tempDir = yield* fs.makeTempDirectoryScoped({ prefix: "t3-claude-skills-" });
387 const configDir = path.join(tempDir, "claude-home");
388​
389 for (const name of ["unknown-mode", "boolean-false", "sibling-off"]) {
390 yield* writeSkill(
391 path.join(configDir, "skills"),
392 name,
393 ["---", `name: ${name}`, "---", "", "# Body"].join("\n"),
394 );
395 }
396 // Verified against the CLI: with an unknown string or a boolean in the
397 // map, the valid "off" sibling is ignored too and every skill runs.
398 yield* fs.writeFileString(
399 path.join(configDir, "settings.json"),
400 '{ "skillOverrides": { "unknown-mode": "some-future-mode", "boolean-false": false, "sibling-off": "off" } }',
401 );
402​
403 const skills = yield* discoverClaudeSkills({ homePath: configDir });
404​
405 assert.deepEqual(
406 skills.map((skill) => [skill.name, skill.enabled]),
407 [
408 ["boolean-false", true],
409 ["sibling-off", true],
410 ["unknown-mode", true],
411 ],
412 );
413 }),
414 );
415​
416 it.effect("reads repository root settings from a nested workspace", () =>
417 Effect.gen(function* () {
418 const fs = yield* FileSystem.FileSystem;
419 const path = yield* Path.Path;
420 const tempDir = yield* fs.makeTempDirectoryScoped({ prefix: "t3-claude-skills-" });
421 const configDir = path.join(tempDir, "claude-home");
422 const repo = path.join(tempDir, "repo");
423 const workspace = path.join(repo, "packages", "app");
424​
425 for (const name of ["root-off", "root-off-cwd-on", "cwd-off-root-on"]) {
426 yield* writeSkill(
427 path.join(configDir, "skills"),
428 name,
429 ["---", `name: ${name}`, "---", "", "# Body"].join("\n"),
430 );
431 }
432 yield* fs.makeDirectory(path.join(repo, ".git"), { recursive: true });
433 yield* fs.makeDirectory(path.join(repo, ".claude"), { recursive: true });
434 yield* fs.makeDirectory(path.join(workspace, ".claude"), { recursive: true });
435 // The CLI ignores the root's plain settings.json from a nested cwd.
436 yield* fs.writeFileString(
437 path.join(repo, ".claude", "settings.json"),
438 '{ "skillOverrides": { "cwd-off-root-on": "off" } }',
439 );
440 // The root local file outranks the workspace local file, as in the CLI.
441 yield* fs.writeFileString(
442 path.join(repo, ".claude", "settings.local.json"),
443 '{ "skillOverrides": { "root-off": "off", "root-off-cwd-on": "off", "cwd-off-root-on": "on" } }',
444 );
445 yield* fs.writeFileString(
446 path.join(workspace, ".claude", "settings.local.json"),
447 '{ "skillOverrides": { "root-off-cwd-on": "on", "cwd-off-root-on": "off" } }',
448 );
449​
450 const skills = yield* discoverClaudeSkills({ homePath: configDir }, workspace);
451​
452 assert.deepEqual(
453 skills.map((skill) => [skill.name, skill.enabled]),
454 [
455 ["cwd-off-root-on", true],
456 ["root-off", false],
457 ["root-off-cwd-on", false],
458 ],
459 );
460 }),
461 );
462​
463 it.effect("ignores ancestor settings outside a repository", () =>
464 Effect.gen(function* () {
465 const fs = yield* FileSystem.FileSystem;
466 const path = yield* Path.Path;
467 const tempDir = yield* fs.makeTempDirectoryScoped({ prefix: "t3-claude-skills-" });
468 const configDir = path.join(tempDir, "claude-home");
469 const parent = path.join(tempDir, "not-a-repo");
470 const workspace = path.join(parent, "workspace");
471​
472 yield* writeSkill(
473 path.join(configDir, "skills"),
474 "kept",
475 ["---", "name: kept", "---", "", "# Body"].join("\n"),
476 );
477 yield* fs.makeDirectory(path.join(parent, ".claude"), { recursive: true });
478 yield* fs.makeDirectory(workspace, { recursive: true });
479 yield* fs.writeFileString(
480 path.join(parent, ".claude", "settings.local.json"),
481 '{ "skillOverrides": { "kept": "off" } }',
482 );
483​
484 const skills = yield* discoverClaudeSkills({ homePath: configDir }, workspace);
485​
486 assert.deepEqual(
487 skills.map((skill) => [skill.name, skill.enabled]),
488 [["kept", true]],
489 );
490 }),
491 );
492​
493 it.effect("lets the administrator's managed policy outrank every other settings file", () =>
494 Effect.gen(function* () {
495 const path = yield* Path.Path;
496​
497 for (const [platform, expected] of [
498 ["darwin", "/Library/Application Support/ClaudeCode/managed-settings.json"],
499 ["linux", "/etc/claude-code/managed-settings.json"],
500 ] as const) {
501 const paths = skillOverrideSettingsPaths(path, "/home/.claude", "/workspace", platform, {});
502 assert.deepEqual(paths, [
503 "/home/.claude/settings.json",
504 "/workspace/.claude/settings.json",
505 "/workspace/.claude/settings.local.json",
506 expected,
507 ]);
508 }
509​
510 assert.deepEqual(
511 skillOverrideSettingsPaths(path, "/home/.claude", undefined, "win32", {
512 PROGRAMDATA: "C:/ProgramData",
513 }).at(-1),
514 "C:/ProgramData/ClaudeCode/managed-settings.json",
515 );
516 assert.deepEqual(skillOverrideSettingsPaths(path, "/home/.claude", undefined, "win32", {}), [
517 "/home/.claude/settings.json",
518 ]);
519​
520 // Only the repository root's local file joins in, after the
521 // workspace's own local file so it wins.
522 assert.deepEqual(
523 skillOverrideSettingsPaths(
524 path,
525 "/home/.claude",
526 "/repo/packages/app",
527 "linux",
528 {},
529 "/repo",
530 ),
531 [
532 "/home/.claude/settings.json",
533 "/repo/packages/app/.claude/settings.json",
534 "/repo/packages/app/.claude/settings.local.json",
535 "/repo/.claude/settings.local.json",
536 "/etc/claude-code/managed-settings.json",
537 ],
538 );
539 // A workspace that is the root itself is not read twice.
540 assert.deepEqual(
541 skillOverrideSettingsPaths(path, "/home/.claude", "/repo", "linux", {}, "/repo"),
542 [
543 "/home/.claude/settings.json",
544 "/repo/.claude/settings.json",
545 "/repo/.claude/settings.local.json",
546 "/etc/claude-code/managed-settings.json",
547 ],
548 );
549 }),
550 );
551​
552 it.effect("records a skill Claude Code keeps out of its own slash commands", () =>
553 Effect.gen(function* () {
554 const fs = yield* FileSystem.FileSystem;
555 const path = yield* Path.Path;
556 const tempDir = yield* fs.makeTempDirectoryScoped({ prefix: "t3-claude-skills-" });
557 const configDir = path.join(tempDir, "claude-home");
558​
559 yield* writeSkill(
560 path.join(configDir, "skills"),
561 "agent-only",
562 ["---", "name: agent-only", "user-invocable: false", "---", "", "# Body"].join("\n"),
563 );
564​
565 const skills = yield* discoverClaudeSkills({ homePath: configDir });
566​
567 assert.deepEqual(
568 skills.map((skill) => [skill.name, skill.userInvocable]),
569 [["agent-only", false]],
570 );
571 }),
572 );
573​
574 it.effect("identifies a skill by its directory, as Claude Code does", () =>
575 Effect.gen(function* () {
576 const fs = yield* FileSystem.FileSystem;
577 const path = yield* Path.Path;
578 const tempDir = yield* fs.makeTempDirectoryScoped({ prefix: "t3-claude-skills-" });
579 const configDir = path.join(tempDir, "claude-home");
580​
581 yield* writeSkill(
582 path.join(configDir, "skills"),
583 "probe-alias",
584 ["---", "name: probe-alias-frontmatter", "---", "", "# Body"].join("\n"),
585 );
586 yield* fs.writeFileString(
587 path.join(configDir, "settings.json"),
588 '{ "skillOverrides": { "probe-alias-frontmatter": "off" } }',
589 );
590​
591 const skills = yield* discoverClaudeSkills({ homePath: configDir });
592​
593 // The frontmatter name is not the command, so an override naming it is
594 // not the override Claude Code would apply either.
595 assert.deepEqual(
596 skills.map((skill) => [skill.name, skill.enabled]),
597 [["probe-alias", true]],
598 );
599 }),
600 );
601​
602 it.effect("switches a skill off by its directory name", () =>
603 Effect.gen(function* () {
604 const fs = yield* FileSystem.FileSystem;
605 const path = yield* Path.Path;
606 const tempDir = yield* fs.makeTempDirectoryScoped({ prefix: "t3-claude-skills-" });
607 const configDir = path.join(tempDir, "claude-home");
608​
609 yield* writeSkill(
610 path.join(configDir, "skills"),
611 "probe-alias",
612 ["---", "name: probe-alias-frontmatter", "---", "", "# Body"].join("\n"),
613 );
614 yield* fs.writeFileString(
615 path.join(configDir, "settings.json"),
616 '{ "skillOverrides": { "probe-alias": "off" } }',
617 );
618​
619 const skills = yield* discoverClaudeSkills({ homePath: configDir });
620​
621 assert.deepEqual(
622 skills.map((skill) => [skill.name, skill.enabled]),
623 [["probe-alias", false]],
624 );
625 }),
626 );
627​
628 it.effect("accepts the YAML 1.1 boolean spellings Claude Code allows", () =>
629 Effect.gen(function* () {
630 const fs = yield* FileSystem.FileSystem;
631 const path = yield* Path.Path;
632 const tempDir = yield* fs.makeTempDirectoryScoped({ prefix: "t3-claude-skills-" });
633 const configDir = path.join(tempDir, "claude-home");
634 const skillsDir = path.join(configDir, "skills");
635​
636 yield* writeSkill(
637 skillsDir,
638 "user-only-yes",
639 ["---", "disable-model-invocation: yes", "---", "", "# Body"].join("\n"),
640 );
641 yield* writeSkill(
642 skillsDir,
643 "agent-only-no",
644 ["---", "user-invocable: no", "---", "", "# Body"].join("\n"),
645 );
646 yield* writeSkill(
647 skillsDir,
648 "plain-off",
649 ["---", "disable-model-invocation: off", "---", "", "# Body"].join("\n"),
650 );
651​
652 const skills = yield* discoverClaudeSkills({ homePath: configDir });
653​
654 assert.deepEqual(
655 skills.map((skill) => [
656 skill.name,
657 skill.userInvocationOnly === true,
658 skill.userInvocable === false,
659 ]),
660 [
661 ["agent-only-no", false, true],
662 ["plain-off", false, false],
663 ["user-only-yes", true, false],
664 ],
665 );
666 }),
667 );
668​
669 it.effect("returns an empty list when no skill roots exist", () =>
670 Effect.gen(function* () {
671 const fs = yield* FileSystem.FileSystem;
672 const path = yield* Path.Path;
673 const tempDir = yield* fs.makeTempDirectoryScoped({ prefix: "t3-claude-skills-" });
674​
675 const skills = yield* discoverClaudeSkills(
676 { homePath: path.join(tempDir, "missing-home") },
677 path.join(tempDir, "missing-workspace"),
678 );
679​
680 assert.deepEqual(skills, []);
681 }),
682 );
683});