Feature Request: Add skills parameter to Task tool for dynamic skill injection at spawn time
Feature Request
Problem
When spawning subagents via the Task tool, there is no way to dynamically attach skills at spawn time. Currently, skills can only be statically defined in subagent frontmatter files (.claude/agents/*.md).
This means if you want the same subagent type to load different skills depending on context, you must either:
- Create separate subagent
.mdfiles for each skill combination - Embed the skill content manually in the
promptparameter (loses the benefits of the skill system)
Proposed Solution
Add an optional skills parameter to the Task tool, similar to the skills frontmatter field in custom subagent definitions:
Task(
subagent_type="general-purpose",
description="Validate spec plan",
skills=["spec-validate", "remotion-best-practices"],
prompt="Validate the mainspec at specs/my-feature/mainspec.md..."
)
The skills would be injected into the subagent's context at startup, exactly as they are when defined in subagent frontmatter.
Use Case
Multi-agent orchestration patterns (fan-out/fan-in) where an orchestrator skill spawns multiple subagents that each need domain knowledge from existing skills. For example:
- An orchestrator spawns 3 parallel validators, each needing the
spec-validateskill plus a domain expert skill - An orchestrator spawns researchers that need the
spec-planningskill conventions - A generic multi-agent wrapper that works with any skill by passing the skill name dynamically
Without this, users must create a separate .claude/agents/*.md file for every skill combination, which doesn't scale when skills are composed dynamically.
Current Workarounds
- Static subagent files — Create a
.claude/agents/my-agent.mdwithskills: [...]in frontmatter. Works but requires a file per skill combination. - Prompt embedding — Read the skill content and paste it into the
promptparameter. Works but bypasses the skill system entirely.
Additional Context
The Task tool currently accepts: prompt, description, subagent_type, and model. Adding skills would align the Task tool's capabilities with the subagent frontmatter's skills field, making dynamic orchestration patterns first-class.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗