SkillsMiddleware(
self,
*,
backend: BACKEND_TYPES,
sources: Sequence[SkillSource]
)| Name | Type | Description |
|---|---|---|
backend* | BACKEND_TYPES | Backend instance for file operations. |
sources* | Sequence[SkillSource] | List of skill sources. Each entry is either a bare path (backwards-compatible) or a
|
| Name | Type |
|---|---|
| backend | BACKEND_TYPES |
| sources | Sequence[SkillSource] |
Middleware for loading and exposing agent skills to the system prompt.
Loads skills from backend sources and injects them into the system prompt using progressive disclosure (metadata first, full content on demand).
Skills are loaded in source order with later sources overriding earlier ones.
Example:
from deepagents.backends.filesystem import FilesystemBackend
backend = FilesystemBackend(root_dir="/path/to/skills")
middleware = SkillsMiddleware(
backend=backend,
sources=[
"/path/to/skills/user/",
"/path/to/skills/project/",
# Pass a (path, label) tuple to disambiguate sources whose
# leaf directories would otherwise collide
("/home/me/.claude/skills", "User Claude"),
("/repo/.claude/skills", "Project Claude"),
],
)