Skip to content

feat: add SubAgentTool::with_skills#46

Merged
yuanhao merged 1 commit into
mainfrom
feat/subagent-with-skills
Jun 21, 2026
Merged

feat: add SubAgentTool::with_skills#46
yuanhao merged 1 commit into
mainfrom
feat/subagent-with-skills

Conversation

@yuanhao

@yuanhao yuanhao commented Jun 21, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds SubAgentTool::with_skills(SkillSet), mirroring the existing Agent::with_skills. Previously skills could only attach to a top-level Agent, so a skill-using parent dispatching a sub-agent dropped all skill context — the sub-agent couldn't follow skill recipes (it answered from parametric knowledge instead of using the skill's tools/recipe).

The skills index (XML per the AgentSkills standard) is appended to the sub-agent's system prompt at dispatch time, before the shared-state block.

Closes #45

Backward compatibility

Purely additive — existing callers are unaffected:

  • New with_skills method; no existing signatures change.
  • New struct field defaults to an empty skills prompt (a no-op append).
  • SubAgentTool fields are private and the only constructor is new(), so adding a field is non-breaking.

Semver-minor. Downstream apps need no changes; they opt in via .with_skills(set).

Tests

Covers all three branches of the prompt-assembly logic:

  • appended to a non-empty base prompt,
  • used as the whole prompt when the base is empty (verbatim, no stray newline),
  • empty-SkillSet no-op,
  • ordering before the shared-state block.

Tests use a shared CapturingProvider (asserts on the provider-observed system prompt) and per-test temp dirs with RAII cleanup to stay safe under parallel execution.

Verified: cargo fmt --check, cargo clippy --all-targets (no warnings), full cargo test.

🤖 Generated with Claude Code

Sub-agents had no way to receive a SkillSet — skills attached only to a
top-level Agent. A skill-using parent dispatching a sub-agent dropped all
skill context, so the sub-agent couldn't follow skill recipes.

Add `SubAgentTool::with_skills(SkillSet)`, mirroring `Agent::with_skills`:
the skills index (XML per the AgentSkills standard) is appended to the
sub-agent's system prompt at dispatch time, before the shared-state block.

Purely additive — existing callers are unaffected (default empty skills
prompt is a no-op). Fields are private, so the new struct field is non-
breaking.

Tests cover all three branches of the prompt-assembly logic: appended to a
non-empty base prompt, used as the whole prompt when the base is empty,
empty-SkillSet no-op, and ordering before the shared-state block. Tests use
per-test temp dirs with RAII cleanup to stay safe under parallel execution.

Closes #45

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@yuanhao

yuanhao commented Jun 21, 2026

Copy link
Copy Markdown
Collaborator Author

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

🤖 Generated with Claude Code

- If this code review was useful, please react with 👍. Otherwise, react with 👎.

@yuanhao yuanhao merged commit 5b3e3bd into main Jun 21, 2026
1 check passed
@yuanhao yuanhao deleted the feat/subagent-with-skills branch June 21, 2026 18:20
@yuanhao yuanhao mentioned this pull request Jun 21, 2026
yuanhao added a commit that referenced this pull request Jun 21, 2026
Adds SubAgentTool::with_skills (#46) — sub-agents can now be given a
SkillSet, mirroring Agent::with_skills.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SubAgentTool cannot attach a SkillSet (no with_skills)

1 participant