|
| 1 | +--- |
| 2 | +name: aspire |
| 3 | +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." |
| 4 | +--- |
| 5 | + |
| 6 | +# Aspire Skill |
| 7 | + |
| 8 | +This repository uses Aspire to orchestrate its distributed application. Resources are defined in the AppHost project (`apphost.cs` or `apphost.ts`). |
| 9 | + |
| 10 | +## CLI command reference |
| 11 | + |
| 12 | +| Task | Command | |
| 13 | +|---|---| |
| 14 | +| Start the app | `aspire start` | |
| 15 | +| Start isolated (worktrees) | `aspire start --isolated` | |
| 16 | +| Restart the app | `aspire start` (stops previous automatically) | |
| 17 | +| Wait for resource healthy | `aspire wait <resource>` | |
| 18 | +| Stop the app | `aspire stop` | |
| 19 | +| List resources | `aspire describe` or `aspire resources` | |
| 20 | +| Run resource command | `aspire resource <resource> <command>` | |
| 21 | +| Start/stop/restart resource | `aspire resource <resource> start|stop|restart` | |
| 22 | +| Rebuild a .NET project resource | `aspire resource <resource> rebuild` | |
| 23 | +| View console logs | `aspire logs [resource]` | |
| 24 | +| View structured logs | `aspire otel logs [resource]` | |
| 25 | +| View traces | `aspire otel traces [resource]` | |
| 26 | +| Logs for a trace | `aspire otel logs --trace-id <id>` | |
| 27 | +| Add an integration | `aspire add` | |
| 28 | +| List running AppHosts | `aspire ps` | |
| 29 | +| Update AppHost packages | `aspire update` | |
| 30 | +| Search docs | `aspire docs search <query>` | |
| 31 | +| Get doc page | `aspire docs get <slug>` | |
| 32 | +| List doc pages | `aspire docs list` | |
| 33 | +| Environment diagnostics | `aspire doctor` | |
| 34 | +| List resource MCP tools | `aspire mcp tools` | |
| 35 | +| Call resource MCP tool | `aspire mcp call <resource> <tool> --input <json>` | |
| 36 | + |
| 37 | +Most commands support `--format Json` for machine-readable output. Use `--apphost <path>` to target a specific AppHost. |
| 38 | + |
| 39 | +## Key workflows |
| 40 | + |
| 41 | +### Running in agent environments |
| 42 | + |
| 43 | +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: |
| 44 | + |
| 45 | +```bash |
| 46 | +aspire start --isolated |
| 47 | +``` |
| 48 | + |
| 49 | +Use `aspire wait <resource>` to block until a resource is healthy before interacting with it: |
| 50 | + |
| 51 | +```bash |
| 52 | +aspire start --isolated |
| 53 | +aspire wait myapi |
| 54 | +``` |
| 55 | + |
| 56 | +### Applying code changes |
| 57 | + |
| 58 | +Choose the right action based on what changed: |
| 59 | + |
| 60 | +| What changed | Action | Why | |
| 61 | +|---|---|---| |
| 62 | +| AppHost project (`apphost.cs`/`apphost.ts`) | `aspire start` | Resource graph changed; full restart required | |
| 63 | +| Compiled .NET project resource | `aspire resource <name> rebuild` | Rebuilds and restarts only that resource | |
| 64 | +| Interpreted resource (JavaScript, Python) | Typically nothing — most run with file watchers | Restart the resource if no watch mode is configured | |
| 65 | + |
| 66 | +**Never restart the entire AppHost just because a single resource changed.** Use `aspire resource <name> rebuild` for .NET project resources — it coordinates stop, build, and restart for just that resource. Use `aspire describe --format Json` to check which commands a resource supports. |
| 67 | + |
| 68 | +### Debugging issues |
| 69 | + |
| 70 | +Before making code changes, inspect the app state: |
| 71 | + |
| 72 | +1. `aspire describe` — check resource status |
| 73 | +2. `aspire otel logs <resource>` — view structured logs |
| 74 | +3. `aspire logs <resource>` — view console output |
| 75 | +4. `aspire otel traces <resource>` — view distributed traces |
| 76 | + |
| 77 | +### Adding integrations |
| 78 | + |
| 79 | +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. |
| 80 | + |
| 81 | +After adding an integration, restart the app with `aspire start` for the new resource to take effect. |
| 82 | + |
| 83 | +### Using resource MCP tools |
| 84 | + |
| 85 | +Some resources expose MCP tools (e.g. `WithPostgresMcp()` adds SQL query tools). Discover and call them via CLI: |
| 86 | + |
| 87 | +```bash |
| 88 | +aspire mcp tools # list available tools |
| 89 | +aspire mcp tools --format Json # includes input schemas |
| 90 | +aspire mcp call <resource> <tool> --input '{"key":"value"}' # invoke a tool |
| 91 | +``` |
| 92 | + |
| 93 | +## Important rules |
| 94 | + |
| 95 | +- **Always start the app first** (`aspire start`) before making changes to verify the starting state. |
| 96 | +- **To restart, just run `aspire start` again** — it automatically stops the previous instance. NEVER use `aspire stop` then `aspire run`. NEVER use `aspire run` at all. |
| 97 | +- **Only restart the AppHost when AppHost code changes.** For .NET project resources, use `aspire resource <name> rebuild` instead. |
| 98 | +- Use `--isolated` when working in a worktree. |
| 99 | +- **Avoid persistent containers** early in development to prevent state management issues. |
| 100 | +- **Never install the Aspire workload** — it is obsolete. |
| 101 | +- **For Aspire API reference and documentation, prefer `aspire docs search <query>` and `aspire docs get <slug>`** over searching NuGet package caches or XML doc files. The CLI provides up-to-date content from aspire.dev. |
| 102 | +- Prefer `aspire.dev` and `learn.microsoft.com/microsoft/aspire` for official documentation. |
| 103 | + |
| 104 | +## Playwright CLI |
| 105 | + |
| 106 | +If configured, use Playwright CLI for functional testing of resources. Get endpoints via `aspire describe`. Run `playwright-cli --help` for available commands. |
0 commit comments