AnthropicClaude Certified Architect – Foundations2026-103.2 Create and configure custom slash commands and skills
Give forked skills self-contained research tasks
Completed by the knowledge check
Learning objective
Isolate verbose skills with context: fork, supplying self-contained instructions because the subagent does not inherit the caller’s conversation history.
Core idea
context: fork runs a skill as an isolated subagent task. The skill’s content becomes the subagent’s prompt, its investigation happens in a separate context, and its result returns to the caller. This fits work whose intermediate file reads or discarded alternatives should not fill the main conversation.
Despite its name, this field does not copy the current conversation into the subagent. The assignment must say what to investigate and which constraints to preserve. “Analyze the design we agreed on” is incomplete if that design exists only in the caller’s history.
The architectural choice combines isolation with an explicit handoff. Isolation removes the verbose working context from the caller; a self-contained task replaces the conversation history the worker does not receive. See 1.3.3 for delegation context more broadly and 1.7.2 for forks into separate resumable sessions.
How it works
Make the skill an assignment
Set context: fork in frontmatter and write a task in the body. This project skill investigates one subsystem without requiring the caller’s earlier discussion:
---
name: dependency-study
context: fork
agent: Explore
background: false
argument-hint: "[subsystem-path]"
---
Investigate the subsystem at $ARGUMENTS.
Map its entry points and direct dependencies using repository files.
Compare keeping its interface with extracting a separate module.
Return a concise recommendation, supporting file references,
and unresolved questions. Do not infer prior design decisions.The body carries the target, comparison, evidence source, and result contract. The invocation supplies the subsystem path. If the caller needs additional constraints, such as retaining a public interface, those must appear in the supplied task rather than remain implicit in a previous message.
A body containing only broad conventions has no actionable assignment for a forked subagent. Anthropic specifically warns that context: fork makes sense for skills with explicit instructions: guidelines such as “use these API conventions” can produce no meaningful result because they do not specify work to perform.
Choose the execution environment
The agent field selects the subagent configuration, including its model, tools, and permissions. Claude Code documents built-in choices such as Explore, Plan, and general-purpose, as well as custom agents from .claude/agents/. If you omit agent, the forked skill uses general-purpose.
Explore suits repository research because it provides read-only tools optimized for codebase exploration. That is a property of the selected agent, not an effect of the word fork. Do not infer read-only execution for a skill that uses a different agent. Tool pre-approval and restriction are separate concerns covered in 3.2.5.
Startup instructions also depend on the agent type. The skills documentation says the built-in Explore and Plan agents skip CLAUDE.md and Git status to keep context small. A forked skill using agent: Explore therefore receives the skill content and the agent’s own system prompt, not the project’s CLAUDE.md as an assumed source of missing task constraints.
When a convention is essential to an Explore investigation, include it in the task or explicitly direct the worker to the relevant evidence. Do not assume that “no conversation history” still implies “all project instructions are automatically present.” The environment and the task content together determine what the worker can use.
Decide when the result must arrive
Forked skills normally run in the background in interactive sessions. Set background: false to wait for the result in the turn that invoked the skill. The documented field requires Claude Code v2.1.218 or later; before that version, forked skills always blocked the turn until completion.
Claude Code also waits without background: false in non-interactive mode (-p or the Agent SDK), when CLAUDE_CODE_DISABLE_BACKGROUND_TASKS=1, while an earlier invocation of the same skill is still running, and when a scheduled task fires with the skill as its prompt. Thus a skill used in Claude Code CI does not become asynchronous merely because it omits background: false.
The sample chooses background: false because the caller needs the recommendation before deciding the next implementation step. For a separate investigation that can finish while the caller continues other work, the default background behavior can fit instead. Neither scheduling choice changes the absence of the caller’s conversation history.
Background execution also has a narrower tool set than foreground subagent execution. If the skill’s steps need a tool outside that set, Anthropic recommends background: false. Backgrounded fork edits occur outside the session’s checkpoints, so /rewind does not undo them. The read-only Explore sample avoids making edits, but that sample does not establish a universal property of forked skills.
Return the useful result, not the entire investigation
The subagent returns a result to the caller; isolated working context does not mean the caller receives nothing. Specify a concise recommendation, file evidence, and open questions when that is what the caller needs. A request to return every file read can defeat the purpose of isolating a verbose task even though execution remains separate.
The result should preserve enough evidence for the next decision. For a dependency study, a bare recommendation loses the basis for accepting it. A concise report with relevant file references carries the decision evidence without reproducing the whole exploratory transcript.
Key distinctions and trade-offs
Skill-context fork versus conversation fork: context: fork starts an isolated task using skill content. For a history-dependent side task within the session, /subtask starts a forked subagent that inherits the conversation; its tool calls remain separate and only its final result returns. /subtask requires Claude Code v2.1.212 or later. When agent view is turned off, /subtask is unavailable and /fork starts that subagent instead. See 1.7.2 when you need a separate resumable session rather than an in-session side task.
Context isolation versus tool restriction: Separate context controls where the investigation happens. The chosen agent and permission configuration control what tools it can use. One does not establish the other.
Background versus blocking execution: background: false requests a wait in the invoking turn; non-interactive and other documented cases wait even without it. Waiting does not add history or make the task more self-contained.
Forking trades shared conversational convenience for a smaller caller context. It fits well when the assignment can name its target and evidence independently. It fits poorly when the task depends on unstated conclusions scattered across the caller’s discussion.
Architecture / decision scenario
A developer productivity workflow examines a large codebase before a developer chooses a module boundary. An inline skill reads many files and explores several discarded alternatives. The final recommendation is useful, but the working material occupies the main conversation.
The team sets context: fork, chooses agent: Explore, and supplies the subsystem path in the invocation. The body names the two alternatives, asks for entry-point and dependency evidence, and requires a compact recommendation with unresolved questions. Because Explore skips CLAUDE.md, the team puts the essential compatibility constraint in the assignment instead of assuming the worker inherits it.
The developer needs this result before approving the next implementation step, so the skill sets background: false. A later independent exploration in an interactive session can use background execution when none of the documented waiting conditions applies. The fix is therefore both an execution setting and a complete assignment, not merely the addition of the word fork.
Common exam traps
- Assuming
context: forkcopies the caller’s conversation history. - Giving a fresh worker an assignment that refers only to “what we discussed.”
- Forking a collection of guidelines without specifying a task.
- Assuming every forked skill is read-only or receives
CLAUDE.md. - Confusing context isolation with whether the caller waits for completion.
- Returning a huge transcript and expecting isolation alone to keep the caller’s context small.
What to remember
Use context: fork for an explicit investigation with a self-contained prompt and useful result contract. Select the agent deliberately and supply the constraints it does not inherit. Use background: false when the caller must receive the result before continuing that turn.
Knowledge check
A codebase-analysis skill gives good answers, but each run leaves dozens of file contents and search results in the main conversation, and later requests in the session suffer. Which frontmatter change addresses this?
context: forkallowed-tools: Read Grep Globargument-hint: "[subsystem]"disable-model-invocation: truecontext: fork runs the skill as an isolated subagent, so its file reads and discarded alternatives stay in that context and only the result returns. Pre-approving tools changes approval prompts, a hint changes autocomplete, and blocking model invocation changes who starts the skill — none of them moves the working material out of the conversation.A skill with context: fork and agent: Explore says: “Assess the module extraction we agreed on against the constraints we discussed.” Its recommendation ignores the public-interface constraint the developer stated earlier in the session. What fixes this?
background: false in the skill’s frontmatterCLAUDE.mdagent: Explore with agent: general-purposeCLAUDE.md to keep its context small, so the constraint has to travel in the task itself.In an interactive session, a developer invokes a forked dependency-study skill and needs its recommendation before choosing the next implementation step in that same turn. Instead, the turn ends and the result arrives later. The investigation must stay out of the main conversation. What should change?
context: fork from the skill’s frontmatteragent: Plan in the skill’s frontmatterdisable-model-invocation: true in the skill’s frontmatterbackground: false in the skill’s frontmatterbackground: false makes the invoking turn wait for the result while keeping the fork’s isolation. Running inline would also wait but would put the investigation back into the main conversation, which the requirement excludes. The agent type and invocation control do not decide whether the caller waits.A team adds context: fork to its api-conventions skill, a list of naming and error-format rules, hoping to keep it out of the main context. When it is invoked, the subagent returns almost nothing useful. Why?
agent: Explore before it can apply repository conventionsbackground: false before it can use the supplied instructionsReferences
- Anthropic, Extend Claude with skills
- Anthropic, How Claude remembers your project
- Anthropic, Create custom subagents