Aspire 分布式应用编排管理
aspire
使用 Aspire CLI 编排 Aspire 分布式应用程序,用于运行、调试和管理分布式应用。适用于:aspire start、aspire stop、启动 aspire 应用、aspire describe、列出 aspire 集成、调试 aspire 问题、查看 aspire 日志、添加 aspire 资源、aspire dashboard、更新 aspire apphost。不适用于:非 Aspire 的 .NET 应用(使用 dotnet CLI)、纯容器部署(使用 docker/podman)、本地测试后的 Azure 部署(使用 azure-deploy 技能)。调用:Aspire CLI 命令(aspire start、aspire describe、aspire otel logs、aspire docs search、aspire add)、bash。对于单一操作:直接使用 Aspire CLI 命令进行快速的资源状态查询或文档查找。
- License 许可
- MIT
- 最近更新
- 2026-11-15
- Stars
- ★ 206
- Forks
- 99
01 前言 Front Matter
- name
- aspire
- description
- Orchestrates Aspire distributed applications using the Aspire CLI for running, debugging, and managing distributed apps. USE FOR: aspire start, aspire stop, start aspire app, aspire describe, list aspire integrations, debug aspire issues, view aspire logs, add aspire resource, aspire dashboard, update aspire apphost. DO NOT USE FOR: non-Aspire .NET apps (use dotnet CLI), container-only deployments (use docker/podman), Azure deployment after local testing (use azure-deploy skill). INVOKES: Aspire CLI commands (aspire start, aspire describe, aspire otel logs, aspire docs search, aspire add), bash. FOR SINGLE OPERATIONS: Use Aspire CLI commands directly for quick resource status or doc lookups.
03 SKILL.md 正文
Aspire Skill
This repository uses Aspire to orchestrate its distributed application. Resources are defined in the AppHost project (apphost.cs or apphost.mts).
CLI command reference
| Task | Command |
|---|---|
| Start the app | aspire start |
| Start isolated (worktrees) | aspire start --isolated |
| Restart the app | aspire start (stops previous automatically) |
| Wait for resource healthy | aspire wait <resource> |
| Stop the app | aspire stop |
| List resources | aspire describe or aspire resources |
| Run resource command | aspire resource <resource> <command> |
| Start/stop/restart resource | `aspire resource <resource> start |
| View console logs | aspire logs [resource] |
| View structured logs | aspire otel logs [resource] |
| View traces | aspire otel traces [resource] |
| Logs for a trace | aspire otel logs --trace-id <id> |
| Add an integration | aspire add |
| List running AppHosts | aspire ps |
| Update AppHost packages | aspire update |
| Search docs | aspire docs search <query> |
| Get doc page | aspire docs get <slug> |
| List doc pages | aspire docs list |
| Environment diagnostics | aspire doctor |
| List resource MCP tools | aspire mcp tools |
| Call resource MCP tool | aspire mcp call <resource> <tool> --input <json> |
Most commands support --format Json for machine-readable output. Use --apphost <path> to target a specific AppHost.
Key workflows
Running in agent environments
Use aspire start to run the AppHost in the background. When working in a git worktree, use --isolated to avoid port conflicts and to prevent sharing user secrets or other local state with other running instances:
aspire start --isolated
Use aspire wait <resource> to block until a resource is healthy before interacting with it:
aspire start --isolated
aspire wait myapi
Relaunching is safe — aspire start automatically stops any previous instance. Re-run aspire start whenever changes are made to the AppHost project.
Debugging issues
Before making code changes, inspect the app state:
aspire describe— check resource statusaspire otel logs <resource>— view structured logsaspire logs <resource>— view console outputaspire otel traces <resource>— view distributed traces
Adding integrations
Use aspire docs search to find integration documentation, then aspire docs get to read the full guide. Use aspire add to add the integration package to the AppHost.
After adding an integration, restart the app with aspire start for the new resource to take effect.
Using resource MCP tools
Some resources expose MCP tools (e.g. WithPostgresMcp() adds SQL query tools). Discover and call them via CLI:
aspire mcp tools # list available tools
aspire mcp tools --format Json # includes input schemas
aspire mcp call <resource> <tool> --input '{"key":"value"}' # invoke a tool
Important rules
- Always start the app first (
aspire start) before making changes to verify the starting state. - To restart, just run
aspire startagain — it automatically stops the previous instance. NEVER useaspire stopthenaspire run. NEVER useaspire runat all. - Use
--isolatedwhen working in a worktree. - Avoid persistent containers early in development to prevent state management issues.
- Never install the Aspire workload — it is obsolete.
- Prefer
aspire.devandlearn.microsoft.com/microsoft/aspirefor official documentation.
Playwright CLI
If configured, use Playwright CLI for functional testing of resources. Get endpoints via aspire describe. Run playwright-cli --help for available commands.
04 同仓库更多 Skills
Aspire 入门指南
getting-started-with-aspire
当开发者询问如何开始使用 Aspire 时使用本技能——包括安装 Aspire CLI、创建新的 Aspire 应用、在本地运行,或在 aspire.dev 上查找权威文档、集成目录或 API 参考。适用于“如何安装 aspire?”“如何创建新的 aspire 应用?”“如何运行我的 aspire 应用?”“aspire 的文档在哪里?”等问题。不适用于:操作现有的 Aspire AppHost(使用 github.com/microsoft/aspire/tree/main/.agents/skills/aspire 上的官方 `aspire` 技能)、编写 AppHost 代码,或向现有应用添加集成。
Aspire 新特性发布说明编写
whatsnew
这是一个带步骤参数的技能,将编写 Aspire “What's new in N.N” 发布说明页面(src/frontend/src/content/docs/whats-new/aspire-N-N.mdx)规范为一套可重复的生命周期流程。以 `/whatsnew {modality}` 形式调用,其中 modality 为以下之一:draft/scaffold(init,初始化)、research(研究)、critique(评审)、validate(验证)、polish(润色)、review(审查)。适用于:为某个版本启动/搭建新的“新特性”页面,将版本变更研究整理成资料档案并撰写草稿正文,评审草稿,对差异进行事实核查/验证,润色并执行数据导入,或对 PR 做最终签核。不适用于:通用文档页面(使用 doc-writer)、审查任意文档 PR(使用 doc-pr-reviewer),或产品仓库的改动。编排的技能包括:doc-writer、doc-pr-reviewer、doc-tester、twoslash-validator、update-integrations、update-samples、container-images。
Aspire 示例数据同步
update-samples
通过从 microsoft/aspire-samples GitHub 仓库获取示例元数据来更新示例数据文件。在添加新示例、刷新示例数据,或确保 samples.json 与上游仓库保持同步时使用。
集成文档与 API 参考同步
update-integrations
通过将 NuGet 包名与其文档 URL 同步,并生成每个包的 API schema,来更新集成文档链接和 API 参考数据。在添加新集成、刷新包数据、确保 integration-docs.json 与 aspire-integrations.json 保持同步,或重新生成 API 参考 JSON 文件时使用。
Twoslash 示例校验与修复
twoslash-validator
为 aspire.dev 校验并修复双斜杠(twoslash)TypeScript 示例。在添加或编辑 `twoslash` 代码块、TypeScript AppHost 示例、生成的 TypeScript API 数据,或处理 `bun run test:unit:twoslash-blocks` 的失败时使用。
Playwright 浏览器自动化测试
playwright-cli
自动化浏览器交互,用于 Web 测试、表单填写、截图和数据提取。当用户需要浏览网站、与网页交互、填写表单、截取截图、测试 Web 应用或从网页提取信息时使用。