context: fork with custom agent from .claude/agents/ doesn't execute in subagent
Resolved 💬 2 comments Opened Jan 29, 2026 by henry-goluss Closed Jan 29, 2026
Expected behavior
According to the skills documentation:
"Addcontext: forkto your frontmatter when you want a skill to run in isolation." "Theagentfield specifies which subagent configuration to use. Options include built-in agents (Explore,Plan,general-purpose) or any custom subagent from.claude/agents/."
When a skill has context: fork and agent: my-custom-agent, it should automatically execute in an isolated subagent using the specified custom agent.
Actual behavior
The skill content is injected inline into the main conversation context. Claude executes the skill directly instead of spawning a subagent.
Steps to reproduce
- Create a custom agent at
.claude/agents/my-agent.md:
---
name: my-agent
description: Test agent
---
Test instructions
- Create a skill at
.claude/skills/test-skill/SKILL.md:
---
name: test-skill
description: Test skill with fork
context: fork
agent: my-agent
---
Do something in isolation
- Invoke
/test-skill - Observe: skill runs inline, not in a forked subagent
Environment
- Claude Code CLI (latest)
- Custom agent defined in
.claude/agents/
Workaround
Currently, the only workaround is to manually read the SKILL.md, check for context: fork + agent:, and manually invoke Task(subagent_type="agent-name") with the skill content as prompt. This defeats the purpose of the automatic fork mechanism.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗