Skip to content

SOP 007: Run Skills in a Subagent

Fresh
FieldValue
SOP ID007
Version1.0
StatusActive
Last Updated2026-02-14

Purpose

Execute skills in isolated forked contexts using context: fork, keeping them separate from your main conversation.

Architecture

Skills vs Subagents

ApproachSystem PromptTaskAlso Loads
Skill with context: forkFrom agent type (Explore, Plan, etc.)SKILL.md contentCLAUDE.md
Subagent with skills fieldSubagent's markdown bodyClaude's delegation messagePreloaded skills + CLAUDE.md

Procedure

Step 1: Add context: fork

yaml
---
name: deep-research
description: Research a topic thoroughly
context: fork
agent: Explore
---

Research $ARGUMENTS thoroughly:

1. Find relevant files using Glob and Grep
2. Read and analyze the code
3. Summarize findings with specific file references

Step 2: Choose an Agent Type

AgentBest ForTools Available
ExploreRead-only research, codebase explorationGlob, Grep, Read (no writes)
PlanArchitecture planning, design decisionsRead-only + planning output
general-purposeFull capability tasksAll tools
Custom (.claude/agents/)Specialized workflowsAs configured

Step 3: Understand Execution

When the skill runs:

  1. A new isolated context is created
  2. The subagent receives skill content as its prompt
  3. The agent field determines the execution environment
  4. Results are summarized and returned to main conversation

context: fork only works with task content

If your skill contains guidelines without a task, the subagent receives guidelines but no actionable prompt, and returns without meaningful output.

Step 4: Example - PR Summary Skill

yaml
---
name: pr-summary
description: Summarize changes in a pull request
context: fork
agent: Explore
allowed-tools: Bash(gh *)
---

## Pull request context
- PR diff: !`gh pr diff`
- PR comments: !`gh pr view --comments`
- Changed files: !`gh pr diff --name-only`

## Your task
Summarize this pull request:
- What changed and why
- Key files modified
- Potential risks or concerns

Verification Checklist

  • [ ] context: fork is set in frontmatter
  • [ ] agent field matches the intended execution environment
  • [ ] Skill content contains actionable task instructions
  • [ ] allowed-tools grants necessary permissions
  • [ ] Results return correctly to main conversation

See Also

Built with VitePress + Claude Code Skills RAG Chat