---
title: 构建 Agent Plugin
description: 创建最小的可移植包，并在固定位置添加组件。
---

# 构建 Agent Plugin



Agent Plugin 是一个自包含目录。每个插件的根目录都有一个 `plugin.json`；技能和 MCP 配置均为可选内容。

## 创建最小插件 [#创建最小插件]

```text
hello-plugin/
├── plugin.json
└── skills/
    └── greet/
        └── SKILL.md
```

创建 `plugin.json`：

```json title="plugin.json"
{
  "$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
  "name": "hello-plugin"
}
```

创建技能：

```markdown title="skills/greet/SKILL.md"
---
name: greet
description: Greet the user and offer help.
---

Greet the user and offer help.
```

支持技能的客户端会加载 `plugin.json`，发现 `skills/` 的直接子目录，并根据 Agent Skills 规范验证每个 `SKILL.md`。如需添加 MCP 服务器，请在插件根目录放置 `mcp.json`，并使用与 Agent Plugins 相同的 Schema 版本。

如果需要可直接复制、包含完整清单和实际技能的包，请参阅 [Agent Plugins 示例](https://github.com/agentplugins/agent-plugins-example)。

## 包边界 [#包边界]

包提供的文件解析后必须位于插件根目录内。规范定义为插件相对路径的配置字段以 `./` 开头；不得利用符号链接或同等的文件系统机制逃逸包目录。

由客户端管理的安装、分发、启用、更新和用户界面不属于可移植规范的范围。

## 后续阅读 [#后续阅读]

* **[清单](/zh/plugin-authors/manifest)**：定义插件标识、元数据和目标规范版本。
* **[技能](/zh/plugin-authors/skills)**：在固定的 `skills/` 目录下封装 Agent Skills。
* **[MCP 服务器](/zh/plugin-authors/mcp-servers)**：在 `mcp.json` 中配置本地和远程 MCP 连接。
* **[客户端扩展](/zh/plugin-authors/client-extensions)**：为特定客户端添加命名空间行为，而不改变可移植约定。


---

Source: [content/docs/plugin-authors/index.mdx](https://github.com/agentplugins/agent-plugins-site/blob/237bbf575f5843214923419f9d0933852662f4f3/content/docs/plugin-authors/index.mdx)
Source commit: 237bbf575f5843214923419f9d0933852662f4f3

---

For a semantic overview of all documentation, see [/zh/sitemap.md](/zh/sitemap.md)

For an index of all available documentation, see [/zh/llms.txt](/zh/llms.txt)