# PluginSkillsMiddleware

> **Class** in `deepagents_code`

📖 [View in docs](https://reference.langchain.com/python/deepagents-code/plugins/adapters/skills_middleware/PluginSkillsMiddleware)

Load namespaced plugin skills without extending the SDK source API.

Wraps the SDK `SkillsMiddleware`. Sources without a namespace load exactly
as the SDK loads them. Sources carrying a plugin namespace are walked
recursively so nested skill directories (`skills/foo/bar/review/SKILL.md`)
are discovered, and each skill's name is qualified as
`plugin_id:foo:bar:review` before the last-one-wins merge — matching
the plugin skill naming convention.

## Signature

```python
PluginSkillsMiddleware(
    self,
    *,
    backend: BackendProtocol,
    sources: Sequence[CodeSkillSource],
    system_prompt: str | None = sdk_skills.SKILLS_SYSTEM_PROMPT,
    path_base: Path | None = None,
)
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `backend` | `BackendProtocol` | Yes | Backend used to load skill files. |
| `sources` | `Sequence[CodeSkillSource]` | Yes | Ordered Code skill sources, optionally including a plugin namespace as the third tuple item. |
| `system_prompt` | `str \| None` | No | Skills prompt template passed to the SDK middleware. (default: `sdk_skills.SKILLS_SYSTEM_PROMPT`) |
| `path_base` | `Path \| None` | No | Directory that relative `skills.extra_allowed_dirs` entries resolve against. If `None`, the process working directory is used. (default: `None`) |

## Extends

- `SkillsMiddleware`

## Constructors

```python
__init__(
    self,
    *,
    backend: BackendProtocol,
    sources: Sequence[CodeSkillSource],
    system_prompt: str | None = sdk_skills.SKILLS_SYSTEM_PROMPT,
    path_base: Path | None = None,
) -> None
```

| Name | Type |
|------|------|
| `backend` | `BackendProtocol` |
| `sources` | `Sequence[CodeSkillSource]` |
| `system_prompt` | `str \| None` |
| `path_base` | `Path \| None` |


## Properties

- `state_schema`

## Methods

- [`before_model()`](https://reference.langchain.com/python/deepagents-code/plugins/adapters/skills_middleware/PluginSkillsMiddleware/before_model)
- [`abefore_model()`](https://reference.langchain.com/python/deepagents-code/plugins/adapters/skills_middleware/PluginSkillsMiddleware/abefore_model)
- [`before_agent()`](https://reference.langchain.com/python/deepagents-code/plugins/adapters/skills_middleware/PluginSkillsMiddleware/before_agent)
- [`abefore_agent()`](https://reference.langchain.com/python/deepagents-code/plugins/adapters/skills_middleware/PluginSkillsMiddleware/abefore_agent)

---

[View source on GitHub](https://github.com/langchain-ai/deepagents/blob/2069079e09546060f5b52b2cd4f0e3c813e820f3/libs/code/deepagents_code/plugins/adapters/skills_middleware.py#L423)