Packages API Reference
The bundled-file layer: what a skill package ships alongside its SKILL.md.
harness reads a skill's instructions and stops there — it does not enumerate, read, or execute a
package's references/, assets/ or scripts/ files. This module indexes exactly those, keyed by
the same name harness gives the skill's capability, which is what lets read_skill_resource and
run_skill_script resolve a skill the model has loaded.
Discovery mirrors harness's rule: a skill is an immediate child directory of a library
containing a SKILL.md.
Index the bundled files of every skill package in libraries.
Scans the immediate child directories of each library for a SKILL.md, exactly as
harness's Skills does, so the keys of the returned mapping line up with the id
of each deferred capability harness produces.
Later libraries win on a duplicate name, matching the argument order the caller
passed to Skills. (harness rejects duplicates among selected skills outright, so
a surviving duplicate here belongs to a skill that was excluded from the catalog.)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
libraries
|
Sequence[str | Path]
|
Skill-library directories. Non-existent entries are skipped rather than raising — harness validates library paths itself and reports them with a better message. |
required |
script_executor
|
SkillScriptExecutor | None
|
Executor used for the discovered scripts. Defaults to
|
None
|
exclude_resources
|
Iterable[str] | None
|
Extra glob patterns to exclude from resource discovery, in
addition to the built-in :data: |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, SkillPackage]
|
Mapping of NFKC-normalized skill name to its |
dict[str, SkillPackage]
|
Source code in pydantic_ai_skills/packages.py
286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 | |
The on-disk files of one Agent Skill package.
Built by index_libraries for every
immediate child directory of a skill library that contains a SKILL.md. Holds only
what harness's Skills does not: the package's directory and its bundled resources
and scripts.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
The skill's directory name, NFKC-normalized so it matches the |
directory |
Path | None
|
The resolved skill directory, or None for a programmatic skill that has
no on-disk package. When set, this is the value substituted for
|
resources |
tuple[SkillResource, ...]
|
Bundled text files, keyed in |
scripts |
tuple[SkillScript, ...]
|
Bundled executables, named by their skill-relative posix path
(e.g. |
Source code in pydantic_ai_skills/packages.py
251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 | |
__post_init__
__post_init__() -> None
Build the name lookups the skill-file tools resolve against.
Source code in pydantic_ai_skills/packages.py
280 281 282 283 | |
Discovery rules
Resources — any file under the skill directory, at any depth, that reads as UTF-8 text, other
than SKILL.md. Binary files are skipped, as is anything matching an exclude glob. Named by its
posix path relative to the skill directory (references/FORMS.md).
Scripts — files in the skill root and its scripts/ subdirectory that either carry a known
extension (.py, .sh, .bash, .zsh, .fish, .ps1, .bat, .cmd) or have the executable
bit set. Named the same way (scripts/run.py).
A file discovered as a script is never also offered as a resource.
Symlinks that resolve outside the skill directory are skipped with a UserWarning — following one
would let a skill hand the model, or execute, an arbitrary file on the host.