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

ClaudeSkills.test.ts

689 lines24.3 KB

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