generated from nhcarrigan/template
feat: add /skill command for invoking Claude Code skills
- New slash command: /skill <name> <data> - Sends prompt to Claude to run skills from ~/.claude/skills/ - Shows usage help if skill name is missing Closes #57
This commit is contained in:
@@ -183,6 +183,47 @@ export const slashCommands: SlashCommand[] = [
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "skill",
|
||||||
|
description: "Invoke a Claude Code skill from ~/.claude/skills/",
|
||||||
|
usage: "/skill <name> <data>",
|
||||||
|
execute: async (args: string) => {
|
||||||
|
const conversationId = get(claudeStore.activeConversationId);
|
||||||
|
if (!conversationId) {
|
||||||
|
claudeStore.addLine("error", "No active conversation");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const parts = args.trim().split(/\s+/);
|
||||||
|
const skillName = parts[0];
|
||||||
|
const skillData = parts.slice(1).join(" ");
|
||||||
|
|
||||||
|
if (!skillName) {
|
||||||
|
claudeStore.addLine(
|
||||||
|
"error",
|
||||||
|
"Usage: /skill <skill-name> <data>\nExample: /skill onboard-mentee Discord ID: 123, GitHub: username"
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
claudeStore.addLine("system", `Invoking skill: ${skillName}`);
|
||||||
|
characterState.setState("thinking");
|
||||||
|
|
||||||
|
const message = skillData
|
||||||
|
? `Please run the /${skillName} skill with the following data:\n\n${skillData}`
|
||||||
|
: `Please run the /${skillName} skill.`;
|
||||||
|
|
||||||
|
await invoke("send_prompt", {
|
||||||
|
conversationId,
|
||||||
|
message,
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
claudeStore.addLine("error", `Failed to invoke skill: ${error}`);
|
||||||
|
characterState.setTemporaryState("error", 3000);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
export function parseSlashCommand(input: string): {
|
export function parseSlashCommand(input: string): {
|
||||||
|
|||||||
Reference in New Issue
Block a user