Skip to content

Commit 4402d2a

Browse files
modified the documentation to include skills folder structure
1 parent 2fc1932 commit 4402d2a

1 file changed

Lines changed: 44 additions & 4 deletions

File tree

‎docs/advanced/skills.md‎

Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,23 @@ or register each file: `SkillCatalog` reads the folder and answers everything fo
127127
Say you have this layout:
128128

129129
```text
130-
skills/
131-
└── git-workflow/
132-
├── SKILL.md
130+
skills/ <-- the path you give FilesystemSkillProvider
131+
└── git-workflow/ <-- one skill: a folder named after the skill
132+
├── SKILL.md <-- required: YAML frontmatter, then instructions
133133
└── references/
134-
└── conventions.md
134+
└── conventions.md <-- any other files the skill needs
135+
```
136+
137+
The `SKILL.md` starts with the skill's `name` and `description`, and `name` must match the
138+
folder name:
139+
140+
```markdown
141+
---
142+
name: git-workflow
143+
description: Follow this team's Git conventions for branching and commits
144+
---
145+
146+
Branch from `main` using `type/short-description`. ...
135147
```
136148

137149
Load it and pass it to your server:
@@ -155,6 +167,27 @@ from the folder, and every file in it is served as a `skill://` resource.
155167

156168
### How skills are found
157169

170+
The path you give `FilesystemSkillProvider` is the **root**: a folder that holds one folder per
171+
skill. A fuller example:
172+
173+
```text
174+
skills/ <-- FilesystemSkillProvider(Path("skills"))
175+
├── git-workflow/ <-- a skill, served as skill://git-workflow/SKILL.md
176+
│ ├── SKILL.md
177+
│ ├── references/
178+
│ │ └── conventions.md
179+
│ └── scripts/
180+
│ └── check-branch.sh
181+
├── pdf-processing/ <-- another skill
182+
│ ├── SKILL.md
183+
│ └── assets/
184+
│ └── template.pdf
185+
├── .git/ <-- ignored: names starting with `.` are skipped
186+
├── README.md <-- not served: it is outside any skill folder
187+
└── draft/ <-- not a skill: it has no SKILL.md
188+
└── notes.txt
189+
```
190+
158191
A skill is a directory that contains a `SKILL.md`. Its files are everything beneath that
159192
directory, including the files of any skill nested inside it, which is also listed as a skill in
160193
its own right.
@@ -163,6 +196,13 @@ Each file's URI is `skill://` followed by its path, with every segment percent-e
163196
directories whose names start with `.` are ignored entirely, and files outside any skill directory
164197
are not served.
165198

199+
!!! warning
200+
Point the provider at the folder that **contains** your skill folders, not at a skill folder
201+
itself. A skill's URI is built from its path under the root, and its last segment must match
202+
the skill's `name`. With `FilesystemSkillProvider(Path("skills/git-workflow"))`, the
203+
`SKILL.md` sits directly in the root, so it has no directory name and the skill is skipped
204+
(an error with `strict=True`). Use `FilesystemSkillProvider(Path("skills"))` instead.
205+
166206
!!! note
167207
The catalog reads and hashes every file **once**, when `load()` runs, and serves that snapshot.
168208
That's how the `digest` and `size` in each skill's manifest are guaranteed to match what

0 commit comments

Comments
 (0)