feat: add SubAgentTool::with_skills#46
Merged
Merged
Conversation
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>
Collaborator
Author
Code reviewNo 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 👎. |
Merged
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
SubAgentTool::with_skills(SkillSet), mirroring the existingAgent::with_skills. Previously skills could only attach to a top-levelAgent, 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:
with_skillsmethod; no existing signatures change.SubAgentToolfields are private and the only constructor isnew(), 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:
SkillSetno-op,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), fullcargo test.🤖 Generated with Claude Code