Why this matters
SkillTool is the bridge between command-style skills and the normal tool
runtime. It is where “use a skill” becomes an actual execution path.
Big picture first
The important pieces are:
SkillTool/prompt.tsteaches the model when invoking a skill is mandatory.getAllCommands(...)collects both local skills and MCP-loaded prompt skills.executeForkedSkill(...)turns one skill invocation into a forked agent run.
tools/SkillTool/SkillTool.ts also anchors the exported tool name as SKILL_TOOL_NAME.
Important:
- Available skills are listed in system-reminder messages in the conversation
- When a skill matches the user's request, this is a BLOCKING REQUIREMENT: invoke the relevant Skill tool BEFORE generating any other response about the task The command bridge
async function getAllCommands(context: ToolUseContext): Promise<Command[]> {
const mcpSkills = context
.getAppState()
.mcp.commands.filter(
cmd => cmd.type === 'prompt' && cmd.loadedFrom === 'mcp',
)
if (mcpSkills.length === 0) return getCommands(getProjectRoot())
const localCommands = await getCommands(getProjectRoot())
return uniqBy([...localCommands, ...mcpSkills], 'name')
}
That helper is why the chapter is called a bridge. SkillTool is not only
about bundled skills on disk. It also merges in MCP-loaded prompt skills.
A skill often becomes a forked agent run
async function executeForkedSkill(
command: Command & { type: 'prompt' },
commandName: string,
args: string | undefined,
context: ToolUseContext,
canUseTool: CanUseToolFn,
parentMessage: AssistantMessage,
onProgress?: ToolCallProgress<Progress>,
): Promise<ToolResult<Output>> {
for await (const message of runAgent({
agentDefinition,
promptMessages,
toolUseContext: {
...context,
getAppState: modifiedGetAppState,
},
canUseTool,
isAsync: false,
querySource: 'agent:custom',
So the mental model is: SkillTool receives a skill request, loads the command
context, and often turns it into a forked runAgent(...) execution.
Takeaways
- SkillTool bridges command discovery and the normal tool runtime.
- MCP-loaded prompt skills enter the same command pool as local skills.
- A skill call often becomes a forked agent run instead of a tiny local helper.