Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions code-rs/core/src/skills/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ pub fn render_skills_section(skills: &[SkillMetadata]) -> Option<String> {
- Missing/blocked: If a named skill isn't in the list or the path can't be read, say so briefly and continue with the best fallback.
- How to use a skill (progressive disclosure):
1) After deciding to use a skill, open its `SKILL.md`. Read only enough to follow the workflow.
2) If `SKILL.md` points to extra folders such as `references/`, load only the specific files needed for the request; don't bulk-load everything.
3) If `scripts/` exist, prefer running or patching them instead of retyping large code blocks.
4) If `assets/` or templates exist, reuse them instead of recreating from scratch.
2) When `SKILL.md` references bundled skill resources or scripts with relative paths such as `scripts/foo.py`, resolve them relative to the directory containing that `SKILL.md` first, and only consider other paths if needed.
3) If `SKILL.md` points to extra folders such as `references/`, load only the specific files needed for the request; don't bulk-load everything.
4) If `scripts/` exist, prefer running or patching them instead of retyping large code blocks.
5) If `assets/` or templates exist, reuse them instead of recreating from scratch.
- Coordination and sequencing:
- If multiple skills apply, choose the minimal set that covers the request and state the order you'll use them.
- Announce which skill(s) you're using and why (one short line). If you skip an obvious skill, say why.
Expand Down Expand Up @@ -97,4 +98,14 @@ mod tests {
assert!(rendered.contains("- compact: full trigger description"));
assert!(!rendered.contains("compact UI summary"));
}

#[test]
fn render_skills_section_resolves_relative_paths_from_skill_dir() {
let rendered = render_skills_section(&[skill("helper", None)])
.expect("implicit skill should render");

assert!(rendered.contains(
"When `SKILL.md` references bundled skill resources or scripts with relative paths such as `scripts/foo.py`, resolve them relative to the directory containing that `SKILL.md` first, and only consider other paths if needed."
));
}
}
3 changes: 3 additions & 0 deletions docs/skills.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ Skills are behind the experimental `skills` feature flag and are enabled by defa

- Mention a skill by name in a message using `$<skill-name>`.
- In the TUI, you can also use `/skills` to browse and insert skills.
- Relative paths to bundled skill resources or scripts, such as
`references/foo.md` or `scripts/foo.py`, resolve relative to the directory
containing that skill's `SKILL.md`.

## Validation and errors

Expand Down