microsoft/apm

GitHub: microsoft/apm

面向 AI 编码助手的包管理器,通过声明式配置统一管理技能、指令、提示词等资源,实现团队间一致的 Agent 环境分发。

Stars: 341 | Forks: 23

# APM – Agent Package Manager [![PyPI version](https://badge.fury.io/py/apm-cli.svg)](https://badge.fury.io/py/apm-cli) [![CI/CD Pipeline](https://static.pigsec.cn/wp-content/uploads/repos/2026/03/d9acdbc4b3002530.svg)](https://github.com/microsoft/apm/actions/workflows/build-release.yml) [![Downloads](https://img.shields.io/pypi/dm/apm-cli.svg)](https://pypi.org/project/apm-cli/) [![GitHub stars](https://img.shields.io/github/stars/microsoft/apm.svg?style=social&label=Star)](https://github.com/microsoft/apm/stargazers) **一个开源、社区驱动的 AI Agent 依赖管理器。** `apm.yml` 声明了你的项目所需的技能、提示词、指令和工具 —— 这样每位开发者都能获得一致的 Agent 配置。包之间可以相互依赖,APM 会解析完整的依赖树。 把它想象成 `package.json`、`requirements.txt` 或 `Cargo.toml` —— 只不过它是用于 AI Agent 配置的。 GitHub Copilot · Cursor · Claude · Codex · Gemini ## 为什么选择 APM AI 编程 Agent 需要上下文才能发挥作用:遵循什么标准、使用什么提示词、利用什么技能。如今这一切都是手动的 —— 每位开发者都要逐个安装,从头编写指令,到处复制文件。这些都不具备可移植性。目前还没有针对这方面的清单(manifest)。 **APM 解决了这个问题。** 你只需声明一次项目的 Agent 依赖,每位克隆你仓库的开发者都能在几秒钟内获得完全配置好的 Agent 环境。包可以依赖其他包 —— APM 会自动解析传递依赖,就像 npm 或 pip 一样。 ## 看看实际效果 ``` # apm.yml — 随项目提供,类似于 package.json name: your project version: 1.0.0 dependencies: apm: # Skills from any repository - anthropics/skills/skills/frontend-design - microsoft/GitHub-Copilot-for-Azure/plugin/skills/azure-compliance # A full APM package with rules, skills, prompts, hooks... - microsoft/apm-sample-package # Specific agent primitives from any repository - github/awesome-copilot/skills/review-and-refactor - github/awesome-copilot/agents/api-architect.agent.md ``` 新开发者加入团队: ``` git clone cd apm install ``` **就这么简单。** Copilot、Claude、Cursor —— 所有 Agent 都配置了正确的技能、提示词和编码标准。 → [查看完整示例项目](https://github.com/microsoft/apm-sample-package) ## 不仅仅是技能 技能注册表只安装技能。APM 管理你的 AI Agent 需要的**每一个原语**: | 原语 | 作用 | 示例 | |-----------|-------------|---------| | **Instructions (指令)** | 编码标准、防护栏 | "在所有 Python 文件中使用类型提示" | | **Skills (技能)** | AI 能力、工作流 | 表单构建器、代码审查器 | | **Prompts (提示词)** | 可复用的斜杠命令 | `/security-audit`, `/design-review` | | **Agents (智能体)** | 专用角色 | 无障碍审计员、API 设计师 | | **Hooks (钩子)** | 生命周期事件处理器 | 工具调用前验证、工具调用后 Linting | | **MCP Servers** | 工具集成 | 数据库访问、API 连接器 | 所有内容都在一个清单中声明。一条命令即可全部安装 —— 包括传递依赖: **`apm install`** → 将提示词、Agent 和技能集成到 `.github/` 和 `.claude/` **`apm compile`** → 将指令编译为 `AGENTS.md` (Copilot, Cursor, Codex) 和 `CLAUDE.md` (Claude) ## 开始使用 **1. 安装 APM** ``` curl -sSL https://raw.githubusercontent.com/microsoft/apm/main/install.sh | sh ```
Homebrew 或 pip ``` brew install microsoft/apm/apm # 或 pip install apm-cli ```
**2. 将 APM 包添加到你的项目** ``` apm install microsoft/apm-sample-package apm install anthropics/skills/skills/frontend-design apm install github/awesome-copilot/agents/api-architect.agent.md ``` **搞定。** 在 VS Code 或 Claude 中打开你的项目,你的 AI 工具就准备就绪了。 ## 从任何地方安装 ``` # GitHub Repo 或 Path apm install owner/repo apm install owner/repo/path # 单文件 apm install github/awesome-copilot/skills/review-and-refactor # GitHub Enterprise Server apm install ghe.company.com/owner/repo # Azure DevOps apm install dev.azure.com/org/project/repo ``` ## 创建与分享包 ``` apm init my-standards && cd my-standards ``` ``` my-standards/ ├── apm.yml # Package manifest └── .apm/ ├── instructions/ # Guardrails (.instructions.md) ├── prompts/ # Slash commands (.prompt.md) ├── skills/ # Agent Skills (SKILL.md) ├── agents/ # Personas (.agent.md) └── hooks/ # Event handlers (.json) ``` 添加一个防护栏并发布: ``` cat > .apm/instructions/python.instructions.md << 'EOF' --- applyTo: "**/*.py" --- # Python Standards - Use type hints for all functions - Follow PEP 8 style guidelines EOF git add . && git commit -m "Initial standards" && git push ``` 现在任何人都可以运行 `apm install you/my-standards`。 ## 所有命令 | 命令 | 作用 | |---------|--------------| | `apm install ` | 添加包并集成其原语 | | `apm compile` | 将指令编译到 AGENTS.md / CLAUDE.md | | `apm init [name]` | 搭建新的 APM 项目或包脚手架 | | `apm run ` | 通过 AI 运行时执行提示词工作流 | | `apm deps list` | 显示已安装的包和版本 | | `apm compile --target` | 指定目标 Agent (`vscode`, `claude`, `all`) | ## 配置 对于私有仓库或 Azure DevOps,请设置 Token: | Token | 使用场景 | |-------|-----------------| | `GITHUB_APM_PAT` | 私有 GitHub 包 | | `ADO_APM_PAT` | Azure DevOps 包 | | `GITHUB_COPILOT_PAT` | 通过 `apm run` 运行提示词 | → [完整设置指南](docs/getting-started.md) ## APM 包 APM 包可以是任何你可以通过 `apm install` 指向的内容:一个包含 `apm.yml` 清单和 `.apm/` 文件夹的完整包、单个原语文件 (`.instructions.md`, `.prompt.md`, `.agent.md`)、一个技能文件夹,或仓库内的任何子树。当包中包含 Hooks 时,它们会被自动发现。有关每种类型的详细信息,请参阅 [Primitives](docs/primitives.md)。 APM 从 **GitHub.com**、**GitHub Enterprise Server**、**GitHub Enterprise Cloud with Data Residency** 和 **Azure DevOps** 安装 —— 无需注册表。有关主机配置,请参阅 [Package Sources](docs/getting-started.md#package-sources)。 这里有一些热门资源帮助你入门: | 包 | 你会得到什么 | |---------|-------------| | [github/awesome-copilot](https://github.com/github/awesome-copilot) | GitHub Copilot 的社区提示词、Agent 和指令 | | [anthropics/skills](https://github.com/anthropics/skills) | Anthropic 官方 Agent 技能 | | [microsoft/GitHub-Copilot-for-Azure](https://github.com/microsoft/GitHub-Copilot-for-Azure/tree/main/plugin/skills) | Azure 技能 | ## 路线图 请查看 [APM Roadmap](https://github.com/microsoft/apm/discussions/116) 了解接下来的计划。 ## 文档 | | | |---|---| | **入门** | [Quick Start](docs/getting-started.md) · [Core Concepts](docs/concepts.md) · [Examples](docs/examples.md) | | **参考** | [CLI Reference](docs/cli-reference.md) · [Compilation Engine](docs/compilation.md) · [Skills](docs/skills.md) · [Integrations](docs/integrations.md) | | **进阶** | [Dependencies](docs/dependencies.md) · [Primitives](docs/primitives.md) · [Contributing](CONTRIBUTING.md) | **基于开放标准构建:** [AGENTS.md](https://agents.md) · [Agent Skills](https://agentskills.io) · [MCP](https://modelcontextprotocol.io) **学习 AI 原生开发** → [Awesome AI Native](https://danielmeppiel.github.io/awesome-ai-native) 一条利用 APM 学习 AI 原生开发的实用路径。 ## 商标 本项目可能包含项目、产品或服务的商标或徽标。经授权使用 Microsoft 商标或徽标须受并必须遵守 [Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general)。在本项目的修改版本中使用 Microsoft 商标或徽标不得造成混淆或暗示 Microsoft 的赞助。任何第三方商标或徽标的使用均受这些第三方政策的约束。
标签:Claude, Copilot, Cursor, CVE检测, DNS解析, LLM工具链, Python, RAG, 上下文管理, 人工智能, 依赖管理, 包管理器, 开源项目, 技能市场, 文档结构分析, 无后门, 标准化, 用户模式Hook绕过, 统一API, 网络调试, 自动化, 软件开发套件, 逆向工具