feat: add context: fork to all skills and commands - #36
Conversation
Adds `context: fork` to the YAML frontmatter of all SKILL.md files and all .claude/commands/*.md slash commands so each skill and command runs in an isolated subagent context rather than injecting instructions into the active conversation. Benefits: context isolation, consistent repeatable execution, token efficiency in the main session, stronger skill fidelity, and cleaner skill handoff. Closes addyosmani#35
|
Thanks for the PR — the rationale for However, I have some doubts after reading the docs closely. The commands are good candidates for fork. Files like The SKILL.md files are a different story. They're hybrid documents — they contain process steps but also large sections of reference material ("When to Use", "Common Rationalizations", "Red Flags", "Handling Disagreements"). They don't have a self-contained task; the task comes from the command that invokes them. The docs warn:
Subagent nesting is a concern. Every command starts with So |
Skills are hybrid reference documents — they contain process steps but also large sections of guidelines (When to Use, Common Rationalizations, Red Flags) without a self-contained task prompt. context: fork is designed for explicit task instructions, not reference material. Additionally, commands invoke skills via the Skill tool. If both the command and the skill had context: fork, the command's subagent would need to spawn another subagent — which is architecturally blocked: "subagents cannot spawn other subagents" (Claude Code docs). context: fork remains on the 7 .claude/commands/ files, where each file IS a self-contained task with explicit instructions.
|
Thanks @federicobartoli, you're right on both counts. I verified the nesting limitation in the official docs:
And the warning about guidelines-only skills also applies here — SKILL.md files are hybrid documents with reference sections (When to Use, Common Rationalizations, Red Flags) that don't form a self-contained task prompt. I've pushed a fix: Good catch, learned something new about subagent architecture here. |
|
Nice fix on removing One more thought after looking at the individual commands: Good fit for fork:
Potentially problematic:
Borderline:
Have you tested all seven commands with fork in a real session (not just single-prompt)? I'd be curious to hear your results. I'll take the time to test them all end-to-end on my side too. Thanks for iterating on this — the discussion has been valuable! |
|
Closing this in favor of the consolidated approach in #316, same direction as #272. Rather than editing The intent here is good and still wanted, it just belongs in the per-agent config doc rather than as global frontmatter changes. Folding it into #316. Thanks! |
Address review feedback on addyosmani#316: - State explicitly that this supersedes the inline top-level frontmatter approach, so kind/model/temperature/max_turns/tools/context must not appear at the top level of a skill. - Add a copy-pasteable .gemini/agents/*.md example using thinking_level instead of hardcoded temperature for Gemini 3.x. - Update Status: addyosmani#272 and addyosmani#36 are closed in favor of this approach.
Closes #35
What
Adds
context: forkto the YAML frontmatter ofall 20files and all 7SKILL.md.claude/commands/*.mdslash commands.Why
Skills and commands currently inject their instructions directly into the active conversation context. With
context: fork, each skill or command runs in an isolated subagent context instead, which brings five concrete benefits:Per the official docs,
.claude/commands/filesandshare the same frontmatter spec andSKILL.mdfilescontext: forkis validin both.Files changed
Commands (
.claude/commands/) — 7 filesSkills (skills/*/SKILL.md) — 20 files