Skip to content

Commit 09fbacb

Browse files
n0mahdclaude
andcommitted
fix(server): show a skill that Claude's settings switch off as not used by Claude
The list reported Claude as reaching a skill that Claude's own `skillOverrides` turn off, though the `$` picker already greys out the same skill. The list now reads the overrides the way the picker does (user, project, project-local, then managed policy) and shows such a skill as not used by Claude, the same as for any other copy Claude doesn't load. The override names the skill by folder name, so it applies to every copy of the name. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
1 parent d75d805 commit 09fbacb

5 files changed

Lines changed: 80 additions & 5 deletions

File tree

‎apps/server/src/provider/Drivers/ClaudeSkills.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ function parseSkillOverride(value: typeof SkillOverrideValue.Type): SkillOverrid
247247
}
248248
}
249249

250-
const readSkillOverrides = Effect.fn("readSkillOverrides")(function* (
250+
export const readSkillOverrides = Effect.fn("readSkillOverrides")(function* (
251251
configDirPath: string,
252252
cwd: string | undefined,
253253
environment: NodeJS.ProcessEnv,

‎apps/server/src/skills/SkillCatalog.test.ts‎

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,49 @@ it.layer(NodeServices.layer, { excludeTestServices: true })("SkillCatalog", (it)
330330
}),
331331
);
332332

333+
it.effect.skipIf(!symlinksSupported)(
334+
"shows a skill that Claude's own settings switch off as one Claude doesn't use",
335+
() =>
336+
Effect.gen(function* () {
337+
const { home, project, write } = yield* makeMachine;
338+
// The user's file switches two skills off, by folder name, and keeps one reachable by
339+
// the user only; the project's local file turns one of the two back on and switches off
340+
// a project skill.
341+
yield* write(
342+
".claude/settings.json",
343+
JSON.stringify({
344+
skillOverrides: {
345+
cloudflare: "off",
346+
architect: "off",
347+
"user-only": "user-invocable-only",
348+
},
349+
}),
350+
);
351+
yield* write(
352+
"repos/app/.claude/settings.local.json",
353+
JSON.stringify({ skillOverrides: { architect: "on", "own-copy": "off" } }),
354+
);
355+
yield* write(".claude/skills/user-only/SKILL.md", skillFile("user-only", "By hand."));
356+
const { skills } = yield* withCatalog(home, (catalog) => catalog.list({ cwd: project }));
357+
const byName = byKey(skills);
358+
359+
// Off: Claude doesn't use it, the others still do.
360+
expect(accessOf(byName.get("global:cloudflare"))).toMatchObject({
361+
claudeAgent: { state: "none", folder: "~/.claude/skills" },
362+
cursor: { state: "direct", folder: "~/.claude/skills" },
363+
});
364+
// The project's later layer turns the user's "off" back on.
365+
expect(states(byName.get("global:architect")).claudeAgent).toBe("link");
366+
expect(states(byName.get("project:own-copy")).claudeAgent).toBe("none");
367+
// The user can still invoke a skill that only the model is kept from.
368+
expect(states(byName.get("global:user-only")).claudeAgent).toBe("direct");
369+
370+
// Without the project, only the user's layer applies.
371+
const global = yield* withCatalog(home, (catalog) => catalog.list({}));
372+
expect(states(byKey(global.skills).get("global:architect")).claudeAgent).toBe("none");
373+
}),
374+
);
375+
333376
it.effect.skipIf(!symlinksSupported)(
334377
"flags a name that exists more than once, and whether the copies are identical",
335378
() =>

‎apps/server/src/skills/SkillCatalog.ts‎

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ import { expandHomePath } from "@t3tools/provider-core/server/pathExpansion";
5353

5454
import {
5555
parseSkillFrontmatter,
56+
readSkillOverrides,
5657
resolveClaudeConfigDirPath,
5758
} from "../provider/Drivers/ClaudeSkills.ts";
5859
import * as ProjectService from "../project/ProjectService.ts";
@@ -109,6 +110,11 @@ interface AgentInstance {
109110
readonly instanceId: ProviderInstanceId;
110111
readonly driver: ProviderDriverKind;
111112
readonly reads: readonly ReadRoot[];
113+
/**
114+
* Skill folder names the agent's own settings switch off: Claude's `skillOverrides`. It lists
115+
* such a skill as disabled and loads none of the copies. Empty for an agent without the setting.
116+
*/
117+
readonly switchedOff: ReadonlySet<string>;
112118
}
113119

114120
/** One folder entry that holds a skill: a real directory, or a link to one. */
@@ -331,6 +337,24 @@ const make = Effect.gen(function* () {
331337
return fallback;
332338
});
333339

340+
/**
341+
* The skills Claude's settings switch off, resolved the way the `$` picker resolves them: the
342+
* user's, the project's and its local file, then the managed policy, last one naming a skill
343+
* wins.
344+
*/
345+
const claudeSwitchedOff = Effect.fnUntraced(function* (
346+
instance: ProviderInstanceConfig,
347+
configHome: string,
348+
cwd: string | undefined,
349+
) {
350+
const env = mergeProviderInstanceEnvironment(instance.environment, environment);
351+
const overrides = yield* readSkillOverrides(configHome, cwd, env).pipe(
352+
Effect.provideService(FileSystem.FileSystem, fileSystem),
353+
Effect.provideService(Path.Path, path),
354+
);
355+
return new Set([...overrides].flatMap(([name, override]) => (override.enabled ? [] : [name])));
356+
});
357+
334358
/** The enabled provider instances whose folders T3 Code knows, in the table's order. */
335359
const loadInstances = Effect.fnUntraced(function* (cwd: string | undefined) {
336360
const settings = yield* serverSettings.getSettings.pipe(Effect.option);
@@ -366,6 +390,10 @@ const make = Effect.gen(function* () {
366390
instanceId: ProviderInstanceId.make(instanceId),
367391
driver: table.agent,
368392
reads,
393+
switchedOff:
394+
table.agent === "claudeAgent"
395+
? yield* claudeSwitchedOff(config, configHome, cwd)
396+
: new Set(),
369397
});
370398
}
371399
}
@@ -500,7 +528,9 @@ const make = Effect.gen(function* () {
500528
// A first-wins agent loads only the first copy in its order; the others load every copy.
501529
const firstWins = skillCollisionFor(instance.driver) === "first-wins";
502530
const loaded =
503-
firstWins && found[0]?.owner !== group ? [] : found.filter((f) => f.owner === group);
531+
instance.switchedOff.has(group.name) || (firstWins && found[0]?.owner !== group)
532+
? []
533+
: found.filter((f) => f.owner === group);
504534
// One copy can be reached through several of the agent's folders; the shared one is shown.
505535
const via = (loaded.find((f) => f.entry.root.standard) ?? loaded[0])?.entry;
506536
if (via) {

‎docs/user/skills.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ instead of showing it as empty.
2828

2929
- an installed and enabled agent doesn't use it. Hover the icons to see which agent. An agent
3030
loads one skill per name, the first it finds in its folders (Codex and OpenCode list every
31-
copy), so a copy that another folder shadows is not used by that agent.
31+
copy), so a copy that another folder shadows is not used by that agent. Claude doesn't use a
32+
skill that its own `skillOverrides` setting switches off either.
3233
- the same name exists more than once with different text, in **This project**, in **Global**, or
3334
across them. These rows have a **Conflict** badge.
3435
- Claude can't read the skill's header, the YAML between the `---` lines at the top of

‎packages/contracts/src/skills.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ export type SkillListInput = typeof SkillListInput.Type;
1414
/**
1515
* How one agent reaches a skill. `direct`: it reads a real folder holding the skill (its own
1616
* folder, or one shared with other agents). `link`: a link in a folder it reads points at the
17-
* skill. `none`: it doesn't load this copy of the skill, because it can't see it or because
18-
* another skill of the same name comes first in its folders.
17+
* skill. `none`: it doesn't load this copy of the skill, because it can't see it, because
18+
* another skill of the same name comes first in its folders, or because its own settings switch
19+
* the skill off.
1920
*/
2021
export const SkillAgentState = Schema.Literals(["direct", "link", "none"]);
2122
export type SkillAgentState = typeof SkillAgentState.Type;

0 commit comments

Comments
 (0)