内容
<p align="left">
<picture><source media="(prefers-color-scheme: dark)" srcset="https://shieldcn.dev/header/transparent.svg?title=代理插件SDK&subtitle=编写一次代理插件,可用于所有平台。技能、命令、子代理、钩子、MCP 和共享工具均来自一个 TypeScript 定义。&size=wide&mode=dark&align=left&font=jetbrains-mono&watermark=true&border=false" /><img alt="header" src="https://shieldcn.dev/header/transparent.svg?title=代理插件SDK&subtitle=编写一次代理插件,可用于所有平台。技能、命令、子代理、钩子、MCP 和共享工具均来自一个 TypeScript 定义。&size=wide&mode=light&align=left&font=jetbrains-mono&watermark=true&border=false" /></picture>
</p>
<p align="center">
<picture><source media="(prefers-color-scheme: dark)" srcset="https://shieldcn.dev/group/npm/@jal-co/agent-plugin-sdk+github/stars/jal-co/agent-plugin-sdk+github/jal-co/agent-plugin-sdk/contributors+github/jal-co/agent-plugin-sdk/license.svg" /><img alt="badge group" src="https://shieldcn.dev/group/npm/@jal-co/agent-plugin-sdk+github/stars/jal-co/agent-plugin-sdk+github/jal-co/agent-plugin-sdk/contributors+github/jal-co/agent-plugin-sdk/license.svg?mode=light" /></picture>
</p>
> 最初由 Sahaj Jain ([@jnsahaj](https://github.com/jnsahaj)) 创建,现由他人在此继续开发。
每个编码代理 — Claude Code、Codex、Gemini CLI、Copilot、Cursor、Windsurf、Pi、OpenCode — 都有自己的插件系统、文件布局和 frontmatter 规则。**agent-plugin-sdk** 允许您用 TypeScript 定义一个插件,并将其编译为每个平台期望的原生可安装工件。无需运行时,无需包装器 — 输出的文件与这些平台加载的文件完全相同。
```ts
import { definePlugin, defineSkill } from "@jal-co/agent-plugin-sdk";
export default definePlugin({
id: "git-helper",
description: "用于在 git 仓库中审查和提交更改的辅助工具。",
skills: [
defineSkill({
name: "diff-review",
description:
"总结并标记未提交更改的风险。用户询问更改内容时使用。",
instructions: "运行 `git diff HEAD` 并总结更改内容,列出 2-4 个要点。",
}),
],
});
```
```bash
agent-plugin build # → .aps-out/{claude,codex,gemini,copilot,cursor,windsurf,pi,opencode}/
agent-plugin install # → 将工件放入本地平台目录中
```
## 安装
```bash
pnpm add -D @jal-co/agent-plugin-sdk
```
[文档](https://github.com/jal-co/agent-plugin-sdk) · [示例](./packages/agent-plugin-sdk/examples)
## 许可证
[MIT](./LICENSE) · 最初由 [Sahaj Jain](https://github.com/jnsahaj) 创建,现由 [Justin Levine](https://github.com/jal-co) 继续开发。