fix(claude): skills picked from the composer now run (#9128)
Co-authored-by: Rodrigo Brechard <[email protected]> Co-authored-by: Claude Opus 5 <[email protected]>
This commit is contained in:
16 files changed
+1080
-82
No files matched your search
@@ -108,6 +108,30 @@ describe("getProviderSkillsForSlashMenu", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("getProviderSkillsForSlashMenu", () => {
|
||||
it("drops a skill the provider reserves for the agent", () => {
|
||||
const skills = [
|
||||
{
|
||||
name: "legacy-system-context",
|
||||
path: "/Users/matt/.claude/skills/legacy-system-context/SKILL.md",
|
||||
enabled: true,
|
||||
userInvocable: false,
|
||||
},
|
||||
{
|
||||
name: "deploy",
|
||||
path: "/Users/matt/.claude/skills/deploy/SKILL.md",
|
||||
enabled: true,
|
||||
// Reserved for the user, not the agent: still a valid pick.
|
||||
userInvocationOnly: true,
|
||||
},
|
||||
];
|
||||
|
||||
expect(getProviderSkillsForSlashMenu(skills, true).map((skill) => skill.name)).toEqual([
|
||||
"deploy",
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
describe("getProviderSlashCommandsForSlashMenu", () => {
|
||||
const commands = [
|
||||
{ name: "ask-matt", description: "Ask which skill fits your situation." },
|
||||
|
||||
@@ -39,12 +39,25 @@ export function dedupeProviderSkillsByName(
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether a composer pick can start this skill. A skill switched off in the
|
||||
* provider's settings will not run, and one the provider reserves for the
|
||||
* agent (Claude Code's `user-invocable: false`) rejects a user invocation.
|
||||
* Everything else, including skills the agent may not start on its own, is
|
||||
* fair game: the server dispatches the pick in the provider's native form.
|
||||
*/
|
||||
export function isProviderSkillUserInvocable(
|
||||
skill: Pick<ServerProviderSkill, "enabled" | "userInvocable">,
|
||||
): boolean {
|
||||
return skill.enabled && skill.userInvocable !== false;
|
||||
}
|
||||
|
||||
export function getProviderSkillsForSlashMenu(
|
||||
skills: ReadonlyArray<ServerProviderSkill>,
|
||||
showSkillsInSlashMenu: boolean,
|
||||
): ServerProviderSkill[] {
|
||||
return showSkillsInSlashMenu
|
||||
? dedupeProviderSkillsByName(skills.filter((skill) => skill.enabled))
|
||||
? dedupeProviderSkillsByName(skills.filter(isProviderSkillUserInvocable))
|
||||
: [];
|
||||
}
|
||||
|
||||
|
||||
@@ -95,6 +95,18 @@ export const ServerProviderSkill = Schema.Struct({
|
||||
enabled: Schema.Boolean,
|
||||
displayName: Schema.optional(TrimmedNonEmptyString),
|
||||
shortDescription: Schema.optional(TrimmedNonEmptyString),
|
||||
/**
|
||||
* The skill is hidden from the agent's own skill tool, so only the user can
|
||||
* start it — Claude Code's `disable-model-invocation`. Composers must offer
|
||||
* it as a slash command; naming it in prose does nothing.
|
||||
*/
|
||||
userInvocationOnly: Schema.optional(Schema.Boolean),
|
||||
/**
|
||||
* The mirror of {@link ServerProviderSkill.userInvocationOnly}: Claude Code's
|
||||
* `user-invocable: false` keeps the skill out of its own slash commands, so
|
||||
* only the agent can start it. Composers must not offer it under `/`.
|
||||
*/
|
||||
userInvocable: Schema.optional(Schema.Boolean),
|
||||
});
|
||||
export type ServerProviderSkill = typeof ServerProviderSkill.Type;
|
||||
|
||||
|
||||
Reference in new issue
Block a user