Skip to content

Commit b747e4f

Browse files
committed
fix(claude): keep agent-only skills out of the slash menu
Claude Code's `user-invocable: false` is the mirror of `disable-model-invocation`: the skill stays available to the agent but is left out of the CLI's own slash commands. Confirmed against the Agent SDK init handshake — a skill carrying it is absent from the published list, so the `/` picker was offering something the CLI would reject. Parse it as `userInvocable`, kept separate from `userInvocationOnly` since the two describe opposite halves, and drop those skills from the slash menu. They remain mentionable, which is the half that still works. Model: Claude Opus 5 (1M) via Claude Code.
1 parent ce83647 commit b747e4f

5 files changed

Lines changed: 44 additions & 1 deletion

File tree

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,28 @@ it.layer(NodeServices.layer)("discoverClaudeSkills", (it) => {
473473
}),
474474
);
475475

476+
it.effect("records a skill Claude Code keeps out of its own slash commands", () =>
477+
Effect.gen(function* () {
478+
const fs = yield* FileSystem.FileSystem;
479+
const path = yield* Path.Path;
480+
const tempDir = yield* fs.makeTempDirectoryScoped({ prefix: "t3-claude-skills-" });
481+
const configDir = path.join(tempDir, "claude-home");
482+
483+
yield* writeSkill(
484+
path.join(configDir, "skills"),
485+
"agent-only",
486+
["---", "name: agent-only", "user-invocable: false", "---", "", "# Body"].join("\n"),
487+
);
488+
489+
const skills = yield* discoverClaudeSkills({ homePath: configDir });
490+
491+
assert.deepEqual(
492+
skills.map((skill) => [skill.name, skill.userInvocable]),
493+
[["agent-only", false]],
494+
);
495+
}),
496+
);
497+
476498
it.effect("returns an empty list when no skill roots exist", () =>
477499
Effect.gen(function* () {
478500
const fs = yield* FileSystem.FileSystem;

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ type SkillFrontmatter =
3636
readonly name?: string;
3737
readonly description?: string;
3838
readonly userInvocationOnly?: boolean;
39+
readonly userInvocable?: boolean;
3940
};
4041

4142
function parseSkillFrontmatter(contents: string): SkillFrontmatter {
@@ -62,6 +63,7 @@ function parseSkillFrontmatter(contents: string): SkillFrontmatter {
6263
...(name ? { name } : {}),
6364
...(description ? { description } : {}),
6465
...(record["disable-model-invocation"] === true ? { userInvocationOnly: true } : {}),
66+
...(record["user-invocable"] === false ? { userInvocable: false } : {}),
6567
};
6668
}
6769

@@ -286,6 +288,9 @@ export const discoverClaudeSkills = Effect.fn("discoverClaudeSkills")(function*
286288
? { description: frontmatter.description }
287289
: {}),
288290
...(userInvocationOnly ? { userInvocationOnly: true } : {}),
291+
...(frontmatter.kind === "parsed" && frontmatter.userInvocable === false
292+
? { userInvocable: false }
293+
: {}),
289294
});
290295
}
291296
}

‎packages/client-runtime/src/providerSkills.test.ts‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,16 @@ describe("getProviderSkillsForSlashMenu", () => {
6767
]);
6868
});
6969

70+
it("drops a skill the provider keeps out of its own slash commands", () => {
71+
const agentOnly = {
72+
name: "agent-only",
73+
path: "/Users/matt/.agents/skills/agent-only/SKILL.md",
74+
enabled: true,
75+
userInvocable: false,
76+
};
77+
expect(getProviderSkillsForSlashMenu([agentOnly], true, 0)).toEqual([]);
78+
});
79+
7080
it("keeps offering mentionable skills once the trigger no longer opens the message", () => {
7181
const askMatt = {
7282
name: "ask-matt",

‎packages/client-runtime/src/providerSkills.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ export function getProviderSkillsForSlashMenu(
8282
): ServerProviderSkill[] {
8383
if (!showSkillsInSlashMenu) return [];
8484
return triggerRangeStart === 0
85-
? skills.filter((skill) => skill.enabled)
85+
? skills.filter((skill) => skill.enabled && skill.userInvocable !== false)
8686
: skills.filter(isProviderSkillMentionable);
8787
}
8888

‎packages/contracts/src/server.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,12 @@ export const ServerProviderSkill = Schema.Struct({
9999
* it as a slash command; naming it in prose does nothing.
100100
*/
101101
userInvocationOnly: Schema.optional(Schema.Boolean),
102+
/**
103+
* The mirror of {@link ServerProviderSkill.userInvocationOnly}: Claude Code's
104+
* `user-invocable: false` keeps the skill out of its own slash commands, so
105+
* only the agent can start it. Composers must not offer it under `/`.
106+
*/
107+
userInvocable: Schema.optional(Schema.Boolean),
102108
});
103109
export type ServerProviderSkill = typeof ServerProviderSkill.Type;
104110

0 commit comments

Comments
 (0)