createSkillsMiddleware(
options: SkillsMiddlewareOptions
): AgentMiddleware<StateSchema<__type>, undefined, unknown, readonly | Name | Type | Description |
|---|---|---|
options* | SkillsMiddlewareOptions |
Create backend-agnostic middleware for loading and exposing agent skills.
This middleware loads skills from configurable backend sources and injects skill metadata into the system prompt. It implements the progressive disclosure pattern: skill names and descriptions are shown in the prompt, but the agent reads full SKILL.md content only when needed.
Configuration options
const middleware = createSkillsMiddleware({
backend: new FilesystemBackend({ rootDir: "/" }),
sources: ["/skills/user/", "/skills/project/"],
});