BrainBank
AI Classroom/AI ModelsClaude Code Deep Dive

SkillTool: Execute Skills

8/2/2026, 3:02:50 PM · updated 8/2/2026, 3:03:16 PM · Source

AI-translated on 8/2/2026, 3:04:25 PM · by Qwen3.6 35B (fast, default)

#claude-code#agent-architecture#mcp-integration#skilltool#command-execution#ai-models

SkillTool is the core skill executor of Claude Code, responsible for locating commands, parsing arguments, and dispatching local or MCP skills, while elevating skills from text prompts into formally schedulable capability units by forking sub-agents.

It's not a command alias, but a skill runtime

When people first see skills like /commit, /verify, and /update-config, they might assume they're just shortcuts for longer prompts.
But looking at the source code, SkillTool is clearly much more complex than a "text alias."

It handles:

  • Finding the command associated with the skill
  • Parsing arguments
  • Handling local skills and MCP skills
  • Forking a sub-Agent to run it when necessary

So a more accurate description is:

SkillTool is the skill executor for Claude Code.

Key Source Code

tools/SkillTool/SkillTool.ts:

import {
  builtInCommandNames,
  findCommand,
  getCommands,
} from 'src/commands.js'
import { runAgent } from '../AgentTool/runAgent.js'

The file also contains a crucial snippet:

async function executeForkedSkill(
  command: Command & { type: 'prompt' },
  ...
): Promise<ToolResult<Output>> {
  ...
}

This shows that skill execution isn't always completed within the current thread; complex skills can be forked.

Call Chain

User or model triggers skill > SkillTool > finds corresponding command/prompt > parses arguments and metadata > executes in current thread or forks sub-Agent > returns results to main thread

It Also Supports MCP Skills

There's a dedicated snippet in the source code:

async function getAllCommands(context: ToolUseContext): Promise<Command[]> {
  const mcpSkills = context
    .getAppState()
    .mcp.commands.filter(
      cmd => cmd.type === 'prompt' && cmd.loadedFrom === 'mcp',
    )
  ...
}

This indicates that SkillTool doesn't just execute local skills; it can also uniformly schedule prompt skills exposed from the MCP side.

A Typical Usage Path

  1. User inputs /commit
  2. SkillTool finds the command for this skill
  3. The skill prompt is expanded
  4. When necessary, a sub-Agent is forked to run the complete flow
  5. Results return to the main thread

Its Relationship with Adjacent Tools

image.png

Summary

SkillTool represents a step toward platformization for Claude Code:

It elevates "skills" from ordinary prompt text into formal capability units that can be scheduled by the system, forked, tracked, and scaled.

Learning map

Learning Map: SkillTool Architecture

Phase 1 — Conceptual Foundation

  • Understand the difference between command aliases and true skill executors
  • Learn how Claude Code routes user input to registered commands
  • Explore the role of builtInCommandNames and the command registry

Phase 2 — Core Mechanism

  • Study findCommand() discovery and parameter parsing flow
  • Trace execution through the main thread path
  • Understand when and how executeForkedSkill() triggers a child agent

Phase 3 — MCP Integration

  • Map how MCP prompt skills are loaded and discovered
  • Learn the loadedFrom: 'mcp' tagging convention
  • Explore unified scheduling of local vs. remote skills

Phase 4 — Advanced Patterns

  • Design your own skill and register it in Claude Code
  • Handle complex skill workflows across forked agents
  • Monitor and debug skill execution chains

Get hands-on — step by step

  1. Install Claude Code and verify the SkillTool module is loaded by triggering a built-in skill like /commit
  2. Open the source file tools/SkillTool/SkillTool.ts in your IDE — locate the findCommand() dispatcher and trace how /commit maps to its underlying Command object
  3. Follow the parameter-parsing logic: identify where arg strings split on spaces or named flags, and confirm metadata (type, loadedFrom) gets attached
  4. Find the executeForkedSkill() function: note its signature (command: Command & { type: 'prompt' }) and observe when the condition triggers a fork vs. inline execution
  5. Add a local skill by defining a new Command entry in the commands registry, then trigger it to see the full dispatch cycle — from user input → discovery → parsing → execution → result return

Top 3 sources

  1. 1
    Claude Code Documentation

    Official Anthropic documentation covering Claude Code's skills, commands, and agent architecture.

    https://docs.anthropic.com/en/docs/claude-code/introduction

  2. 2
    Model Context Protocol (MCP) Specification

    The MCP standard that defines how prompt skills are exposed and discovered for integration with Claude Code.

    https://modelcontextprotocol.io/specification

  3. 3
    Claude Code GitHub Repository

    Claude Code's source code repository, including the SkillTool implementation and command system.

    https://github.com/anthropics/claude-code

Links are AI-suggested — worth a quick sanity check before diving in.