TIL ·

Claude Code has a tool, named Task, that didn’t make it to the official list of built-in tools, but is probably one of the most possible tools it has.

I found it while reading through the source code of the meta-prompting project Get Shit Done. In some of the commands and “workflows”, Claude is instructed to invoke the Task tool, which spawans subagents to execute a nested prompt. This prevents the all the resulting context generated to execute that prompt from polluting the current context. I knew that subagents were designed for this, but previously I thought that the only way that a subagent was spawned was if claude code decided that the subagent was most appriorate based on its description or via a skill that had a forked context.

But, by exposing a tool, a custom slash command or skill can actually invoke that tool.

I couldn’t find documentation online for the Task tool, so I asked Claude what the arguments to the tool are.

Task Tool Parameters

ParameterRequiredTypeDescription
promptYesstringThe task for the agent to perform
subagent_typeYesstringThe type of specialized agent to use
descriptionYesstringShort (3-5 word) description of the task
modelNoenum"sonnet", "opus", or "haiku" — inherits from parent if not specified
resumeNostringAgent ID to resume a previous execution
run_in_backgroundNobooleanRun asynchronously; use TaskOutput to check results
max_turnsNointegerMax API round-trips before stopping

Built-in subagent_type Options

TypePurpose
general-purposeComplex multi-step tasks with full tool access
ExploreFast codebase search/analysis (read-only, uses Haiku)
PlanResearch for planning mode
BashCommand execution specialist
claude-code-guideAnswer questions about Claude Code itself

Example Usage

<invoke name="Task">
  <parameter name="prompt">Search for all authentication-related files and explain how login works</parameter>
  <parameter name="subagent_type">Explore</parameter>
  <parameter name="description">Explore auth system</parameter>
</invoke>
With model override:


<invoke name="Task">
  <parameter name="prompt">Implement the user profile feature based on the PLAN.md</parameter>
  <parameter name="subagent_type">general-purpose</parameter>
  <parameter name="description">Execute profile plan</parameter>
  <parameter name="model">opus</parameter>
</invoke>
Background execution:


<invoke name="Task">
  <parameter name="prompt">Run full test suite and report failures</parameter>
  <parameter name="subagent_type">Bash</parameter>
  <parameter name="description">Run tests</parameter>
  <parameter name="run_in_background">true</parameter>
</invoke>