pub fn write_agent_skills(compose: &Compose, h: AgentHandle<'_>) -> Result<()>Expand description
Materialize (or clear) the per-agent skills scope for one agent (#383
Phase 3b). For a claude-code agent declaring skills:, this creates
state/agent-scope/<project>-<agent>/.claude/skills/ and symlinks each
declared skill directory into it (link name = the skill dir’s basename),
so claude --add-dir <scope> surfaces them additively atop the project
.claude/skills/. Mirrors write_subagents_json: the scoped + full
render paths both call it, and the skills dir is rebuilt from scratch
every render so a renamed or dropped skill never lingers. When the agent
declares no skills (or isn’t claude-code) the scope dir is removed if
present.
Symlink targets are absolute (compose-root-relative input resolved
against compose.root); a missing source becomes a dangling link rather
than an error, matching how role_prompt/hooks treat not-yet-created
paths (existence checks across all path-typed fields are a tracked
follow-up). Clearing always unlinks entries individually — render never
hands a symlink to remove_dir_all, so a skill’s real files are never
followed or deleted.