refactor: merge slashcommand tool into skill tool

Per reviewer feedback (code-yeongyu), keep the 'skill' tool as the main
tool and merge slashcommand functionality INTO it, rather than the reverse.

Changes:
- skill/tools.ts: Add command discovery (discoverCommandsSync) support;
  handle both SKILL.md skills and .omo/commands/ slash commands in a single
  tool; show combined listing in tool description
- skill/types.ts: Add 'commands' option to SkillLoadOptions
- skill/constants.ts: Update description to mention both skills and commands
- plugin/tool-registry.ts: Replace createSlashcommandTool with createSkillTool;
  register tool as 'skill' instead of 'slashcommand'
- tools/index.ts: Export createSkillTool instead of createSlashcommandTool
- plugin/tool-execute-before.ts: Update tool name checks from 'slashcommand'
  to 'skill'; update arg name from 'command' to 'name'
- agents/dynamic-agent-prompt-builder.ts: Categorize 'skill' tool as 'command'
- tools/skill-mcp/tools.ts: Update hint message to reference 'skill' tool
- hooks/auto-slash-command/executor.ts: Update error message

The slashcommand/ module files are kept (they provide shared utilities used
by the skill tool), but the slashcommand tool itself is no longer registered.
This commit is contained in:
Bo Li
2026-02-18 18:40:10 +08:00
parent 8b3cc5e011
commit 462bf7b277
9 changed files with 138 additions and 73 deletions
+10 -4
View File
@@ -1,8 +1,14 @@
export const TOOL_NAME = "skill" as const
export const TOOL_DESCRIPTION_NO_SKILLS = "Load a skill to get detailed instructions for a specific task. No skills are currently available."
export const TOOL_DESCRIPTION_NO_SKILLS = "Load a skill or execute a slash command to get detailed instructions for a specific task. No skills or commands are currently available."
export const TOOL_DESCRIPTION_PREFIX = `Load a skill to get detailed instructions for a specific task.
export const TOOL_DESCRIPTION_PREFIX = `Load a skill or execute a slash command to get detailed instructions for a specific task.
Skills provide specialized knowledge and step-by-step guidance.
Use this when a task matches an available skill's description.`
Skills and commands provide specialized knowledge and step-by-step guidance.
Use this when a task matches an available skill's or command's description.
**How to use:**
- Call with a skill name: name='code-review'
- Call with a command name (without leading slash): name='publish'
- The tool will return detailed instructions with your context applied.
`