feat: scaffold knowledge base as shared skill with symlinked reference#140
Merged
Conversation
…ls layout
**Added:**
- `writeReferenceSkill` function in `scaffold.go` that materializes the agent knowledge base as a fleet-level skill at `<agentsDir>/skills/<name>-guide/SKILL.md` and creates a relative symlink from `<agent>/references/<name>-guide.md` to it, enabling both squad injection and `Skill()` tool loading
- YAML frontmatter (`name`, `description`) to `reference.md.tmpl` so the rendered file is a valid named skill consumable by the Skill tool
- Tests in `scaffold_test.go` verifying the skill file exists with correct frontmatter and that the references symlink resolves to matching content
**Changed:**
- `CreateAgent` in `scaffold.go` no longer writes `references/<name>-guide.md` directly; instead delegates to `writeReferenceSkill` for the fleet-layout scaffolding, and updates the post-creation hint to point at `skills/<name>-guide/SKILL.md`
- `system.md.tmpl` knowledge base section now instructs the agent to load `Skill("{{.Name}}-guide")` instead of reading a file path from the `references/` directory, and adds `Skill` to the default tools list
- `README.md.tmpl` file table updated to reference the canonical skill path and document the symlink relationship
- `creating-agents.md` references guidance updated to describe the skill-based layout, explain the symlink convention, and explicitly warn against hardcoding absolute paths
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
**Added:** - `TestCreateAgent_ReferenceSkillErrors` test suite covering four failure branches in `scaffold/scaffold_test.go`: skills dir is a file, SKILL.md path is a directory, stale reference link is an irremovable dir, and references dir is read-only
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.
Key Changes:
skills/<name>-guide/SKILL.md) instead of inline reference files, enabling cross-host portability viaSkill("name")loadingreferences/<name>-guide.mdto the skill file, preserving squad'sagent.yamlinjection while supporting on-demand loading in Claude CodeSkill()instead of hardcodedReadpaths, eliminating machine-specific absolute path breakageAdded:
writeReferenceSkillfunction inscaffold/scaffold.gothat creates the skill directory at<agentsDir>/skills/<name>-guide/SKILL.md, renders the reference template into it, then creates a relative symlink from<agent>/references/<name>-guide.mdback to the skill filereference.md.tmplwithnameanddescriptionfields, making the rendered document a valid named skill loadable by theSkilltoolSkilladded to the defaulttools:list insystem.md.tmplso agents can invokeSkill("name")out of the boxscaffold_test.gofor the happy-path fleet layout (skill exists, symlink resolves, content matches) and four error branches: skills dir blocked by a file, SKILL.md path occupied by a directory, stale reference link that cannot be removed, and read-only references directory blocking symlink creationChanged:
scaffold.goreplaced the directreferences/<name>-guide.mdfile entry in thefilesmap with a call towriteReferenceSkill, and updated the post-creation log message to point users toskills/<name>-guide/SKILL.mdsystem.md.tmplchanged fromReadwith a relative path toSkill("{{.Name}}-guide"), removing any dependency on filesystem path resolutionREADME.md.tmplfile table updated to reference../skills/<name>-guide/SKILL.mdas the canonical location, with a note thatreferences/<name>-guide.mdsymlinks to it for squad injectioncreating-agents.mdupdated to describe the skill-plus-symlink layout, replace the absolute-path fallback phrasing withSkill("criteria"), and explicitly warn against hardcoding absolute paths in agent bodies