Skip to content

feat: scaffold knowledge base as shared skill with symlinked reference#140

Merged
l50 merged 2 commits into
mainfrom
scaffold-skill-references
Jul 2, 2026
Merged

feat: scaffold knowledge base as shared skill with symlinked reference#140
l50 merged 2 commits into
mainfrom
scaffold-skill-references

Conversation

@l50

@l50 l50 commented Jul 2, 2026

Copy link
Copy Markdown
Member

Key Changes:

  • Knowledge base documents are now created as fleet-level skills (skills/<name>-guide/SKILL.md) instead of inline reference files, enabling cross-host portability via Skill("name") loading
  • Agent scaffolding creates a relative symlink from references/<name>-guide.md to the skill file, preserving squad's agent.yaml injection while supporting on-demand loading in Claude Code
  • System prompt template updated to load the knowledge base via Skill() instead of hardcoded Read paths, eliminating machine-specific absolute path breakage
  • Documentation and tests updated to reflect the new fleet layout and symlink-based reference strategy

Added:

  • writeReferenceSkill function in scaffold/scaffold.go that 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.md back to the skill file
  • YAML frontmatter block to reference.md.tmpl with name and description fields, making the rendered document a valid named skill loadable by the Skill tool
  • Skill added to the default tools: list in system.md.tmpl so agents can invoke Skill("name") out of the box
  • Test coverage in scaffold_test.go for 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 creation

Changed:

  • Agent scaffolding in scaffold.go replaced the direct references/<name>-guide.md file entry in the files map with a call to writeReferenceSkill, and updated the post-creation log message to point users to skills/<name>-guide/SKILL.md
  • Knowledge base loading instruction in system.md.tmpl changed from Read with a relative path to Skill("{{.Name}}-guide"), removing any dependency on filesystem path resolution
  • README.md.tmpl file table updated to reference ../skills/<name>-guide/SKILL.md as the canonical location, with a note that references/<name>-guide.md symlinks to it for squad injection
  • Documentation in creating-agents.md updated to describe the skill-plus-symlink layout, replace the absolute-path fallback phrasing with Skill("criteria"), and explicitly warn against hardcoding absolute paths in agent bodies

…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
@github-actions github-actions Bot added the area/docs Changes made to project documentation label Jul 2, 2026
@codecov

codecov Bot commented Jul 2, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.85714% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
scaffold/scaffold.go 92.85% 1 Missing and 1 partial ⚠️

📢 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
@l50 l50 changed the title feat: scaffold knowledge base as fleet-level skill with symlinked reference feat: scaffold knowledge base as shared skill with symlinked reference Jul 2, 2026
@l50 l50 merged commit c11449b into main Jul 2, 2026
5 checks passed
@l50 l50 deleted the scaffold-skill-references branch July 2, 2026 22:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/docs Changes made to project documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant