npx skills add ...
npx skills add microsoft/aspire --skill code-review
Review a GitHub pull request for problems. Use when asked to review a PR, do a code review, check a PR for issues, or review pull request changes. Focuses only on identifying problems — not style nits or praise.
npx skills add microsoft/aspire --skill code-review
You are a specialized code review agent for the microsoft/aspire repository. Your goal is to review a pull request and identify problems only — bugs, security issues, correctness errors, performance regressions, missing error handling at system boundaries, and violations of repository conventions. Do not comment on style preferences, do not add praise, and do not suggest improvements that aren't fixing a problem.
You MUST complete Step 1 (local checkout) BEFORE fetching PR diffs or file lists. Branch-discovery calls (e.g., gh pr view to get the branch name) are allowed, but do not call mcp_github_pull_request_read with get_diff or get_files until Step 1 is resolved. Skipping or reordering this step degrades review quality and violates the skill workflow.
Parse user requests to extract:
7890) or full URL (e.g., https://github.com/microsoft/aspire/pull/7890)microsoft/aspire unless specified otherwiseIf no PR number is given, check if the current branch has an open PR:
Check whether the PR branch is already checked out locally:
If the current branch matches the PR branch, proceed to Step 2.
If the current branch does not match, ask the user how they'd like to proceed:
If there are uncommitted changes, warn the user and stash them:
Then check out the PR branch (this handles both same-repo and fork PRs):
No local action needed. Proceed to Step 2. Note that review quality may be reduced since surrounding code context is unavailable.
Fetch the PR metadata, diff, and file list. This skill uses the mcp_github_* tools (MCP GitHub integration). These are available when the GitHub MCP server is configured in the agent environment. If they are unavailable, fall back to the gh CLI for equivalent operations.
mcp_github_pull_request_read with method get to get the title, description, base branch, and author.mcp_github_pull_request_read with method get_files to get the list of changed files. Paginate if there are many files.mcp_github_pull_request_read with method get_diff to get the full diff.mcp_github_pull_request_read with method get_review_comments to see what's already been flagged. Don't duplicate existing review comments.Group files by area to guide how deeply to review each:
| Area | Paths | Review focus |
|---|---|---|
| Hosting | src/Aspire.Hosting*/** | Resource lifecycle, connection strings, health checks, parameter validation |
| Dashboard | src/Aspire.Dashboard/** | Blazor component logic, data binding, accessibility |
| Integrations/Components | src/Components/** | Client configuration, DI registration, connection handling |
| CLI | src/Aspire.Cli/** | Command parsing, error handling, exit codes |
| Tests | tests/** | Flaky test patterns (see below), test isolation, assertions |
| Deployment | src/Aspire.Hosting.Azure*/**, src/Aspire.Hosting.Docker/**, src/Aspire.Hosting.Kubernetes/**, tests/Aspire.Hosting.*Kubernetes.Tests/**, tests/Aspire.Cli.EndToEnd.Tests/**/Kubernetes*, tests/Aspire.Deployment.EndToEnd.Tests/** | Kubernetes/Helm, Docker, and Azure artifacts plus real deployment behavior, provisioning, cleanup |
| Build/Infra | eng/**, *.props, *.targets | Unintended side effects, breaking conditional logic |
| API files | src/*/api/*.cs | Should never be manually edited — flag if modified |
| Extension | extension/** | Localization, TypeScript usage |
| Docs/Config | docs/**, *.md, *.json | Accuracy only |
Read the diff carefully. For each changed file, also read surrounding context to understand the impact of the change.
mcp_github_get_file_contents to fetch specific files from the PR branch when additional context is needed.Before deciding whether tests are sufficient, perform a code-based impact analysis. Do not stop at "tests pass" or "there are tests"; map the changed code paths to the behaviors that could regress, then compare that list to the test changes.
For each non-trivial production change, identify:
Use the impact analysis to drive coverage review. A PR can have many tests and still be missing the regression test that matters. Conversely, do not demand every test category when the impact analysis shows the change does not affect that surface.
When the impact analysis is useful to explain a test finding, present it concisely in the finding: identify the impacted code path, the regression risk, and the missing test shape. For example: "This changes DcpExecutor.PrepareServices() port allocation timing, but there is no regression test showing a dependent resource can resolve the endpoint before workload creation."
Apply the repository-wide Conditional Test Selection rules in AGENTS.md.
Trace new test projects, CI jobs, workflows, scripts, and loose inputs to their
actual consumers before deciding whether the map needs to change.
Flag concrete selection gaps:
Aspire.slnx ProjectGraph as Layer 1-owned and
projects outside that graph as Layer 2 blind spots.ALL for broad impact, or
explicitly outside the selector. Do not allow ignore or prefilter entries
to hide a real PR-CI consumer.aspire add, generated AppHost package sets, package filters, templates, and
workspace copies. If a PR adds or removes one of these consumers, require the
corresponding exact affected_project_rules or path_rules entry to change
in the same PR.QuarantinedTest, ActiveIssue, and OuterloopTest on
runtime-consuming E2E scenarios. Regular-PR targets must include only
consumers eligible for regular PR CI; require the exact map edge and focused
regression coverage to change when eligibility changes.path_rules, prefer one stable
directory glob when enumerating individual files or RIDs would let a new
input silently miss its consumers. Accept cross-RID over-selection when that
is the explicit resilience tradeoff, and do not flag that over-selection as a
routing defect. Require focused exclusions only when a split has material
savings and can be maintained safely.reason concise: it should state what the rule covers
or why the target consumes the input. Request more detail only for a
non-obvious relationship or constraint. Do not turn reason into PR prose,
repeat the full rule, or preserve investigation history there. The targets
field owns the target list, so do not request those names again in reason.
Accept a category-level description; do not require the reason to explain
every target or make the rule self-contained. Selection-design rationale,
such as why paths are split or broadened, belongs in the PR or maintenance
documentation.run_* wiring for gated job: targets, advisory classification for
targets outside the regular PR matrix or job gates, and routing from reusable
workflow implementations to the jobs they implement.Selector behavior changes must keep the action, workflow gates, tool, map,
tests, and canonical documentation synchronized. Require real-map tests for
curated routing changes: a representative positive per distinct routing
boundary, focused negatives for deliberately excluded consumers, and a
structural assertion for consumer lists duplicated across rule types. Do not
request an acceptance case per consumer; instead audit the complete curated
list against the consuming workflow. Treat a widened or relaxed negative
expectation as a finding until the workflow's artifacts and execution lane
justify it. Require focused synthetic-map tests for engine or CLI behavior.
See docs/ci/test-trigger-map.md for the complete contract.
Every review must evaluate whether the PR has appropriate tests for the type of behavior being changed. Do not require tests for purely mechanical refactors, comments, or documentation-only changes, but do flag missing or insufficient coverage when production behavior changes and there is no explicit, convincing justification in the PR. Regression coverage is especially important: bug fixes and behavior changes should include tests that would have failed before the fix, not just broad happy-path coverage or regenerated snapshots.
Do not require tests for visual-only styling changes, including CSS selectors, colors, opacity, cursors, hover/focus/active appearance, or theme tokens. In particular, do not request Playwright assertions for computed styles or exact color values. Tests remain appropriate when styling changes also affect functional interaction, DOM or accessibility semantics, state transitions, or whether a user can complete a workflow.
Use this mapping when deciding whether coverage is appropriate:
| Change type | Expected coverage to look for |
|---|---|
| Core logic, resource model, integrations, parsers, validation, error handling, public API behavior | Unit or integration tests in the matching tests/*.*Tests/ project |
| User-visible Aspire CLI commands, prompts, terminal workflows, install/update behavior, or command output contracts | CLI end-to-end coverage under tests/Aspire.Cli.EndToEnd.Tests/, in addition to focused unit tests where practical |
| Dashboard UI logic, browser-only functional behavior, authentication flows, or interactions that bUnit cannot realistically exercise | Dashboard Playwright coverage under tests/Aspire.Dashboard.Tests/Integration/Playwright/, in addition to tests/Aspire.Dashboard.Tests/ or tests/Aspire.Dashboard.Components.Tests/ coverage for logic/components |
| Visual-only CSS, theme, color, opacity, cursor, or interaction-state appearance changes | No automated coverage required; do not request computed-style, exact-color, or screenshot assertions solely for these changes |
| Deployment, publish, provisioning, generated Kubernetes/Helm/Bicep/Docker artifacts, Azure resource wiring, or deployed endpoint behavior | Deployment end-to-end coverage under tests/Aspire.Deployment.EndToEnd.Tests/ when the behavior depends on actual deployment; generated artifact snapshot tests alone are not sufficient for deployment behavior changes |
| VS Code extension commands, tree views, debugger flows, RPC/DCP/MCP integration, extension UI, or CLI integration visible through VS Code | VS Code extension E2E coverage under extension/src/test-e2e/, in addition to Mocha unit tests under extension/src/test/ where practical |
For deployment changes, be especially strict: emitting or updating Helm charts, Kubernetes YAML, Docker Compose, Bicep, JSON manifests, or snapshot files only proves the serializer output. If the PR changes deployment behavior, resource connectivity, provisioning order, infrastructure composition, environment variables, endpoint exposure, health, cleanup, or upgrade behavior, look for a deployment test that actually deploys and verifies the scenario. It is acceptable for the PR to update or refactor an existing deployment E2E test instead of adding a brand-new one, but the resulting test must exercise the changed behavior.
When specialized coverage is missing and the appropriate shape is unclear, use or reference the relevant skill for review context: cli-e2e-testing, dashboard-testing, deployment-e2e-testing, or vscode-extension.
Only flag actual problems. Every comment must identify a concrete issue. Categories:
SingleOrDefault (throws on duplicates) replaced by FirstOrDefault (silently picks first); Debug.Assert guarding a release-relevant invariant that should be an if + throw; precondition checks that were removed.Task.Result, .Wait()).null! with a separate Initialize() method that must be called before use; DI registrations that depend on call ordering; any pattern where forgetting a call causes a runtime NRE with no compile-time safety.IDisposable objects (e.g., CancellationTokenSource, SemaphoreSlim) that are created but never disposed, even if the pattern was moved from elsewhere.ToList() calls with comments like "materialize to check count" where the count is never checked.api/*.cs files*.xlf filesNuGet.config adding unapproved feedsglobal.json== null instead of is nullAGENTS.md Code comments guidance when reviewing changed code. Flag only concrete problems, such as comments that contradict the code, workaround comments without a tracking link, parser/protocol/log parsing that omits the raw shape needed to understand edge cases, or comments around privacy/security-sensitive behavior that fail to explain the opt-in, scope, or WHY. Do not flag subjective missing comments or ask for comments on obvious code.WaitForHealthyAsync(), shared timeout budgets, hardcoded ports, Directory.SetCurrentDirectory usage, commented-out tests..editorconfig or formattersapi-review skill; this generic review only checks the stable ATS surface used for polyglot SDK generation.<SuppressFinalPackageVersion>true</SuppressFinalPackageVersion>, or when the affected exported API has [Experimental] or ATS experimental metadata.extension/CHANGELOG.md created by extension-release.yml for bot-authored extension-release/* PRs. It is expected, asynchronously replaced by extension-changelog.md, and merge-gated by extension-changelog-finalized.yml. Continue to flag unrelated placeholders or incomplete release notes outside this exact release flow.When code is moved from one file to another (e.g., extracting a class), treat the moved code as if it were newly written. Specifically:
OldClass is removed and replaced by NewClass<T>, verify that all call sites that depended on OldClass-specific behavior still work correctly.Complete the generic review before considering reviewing-aspire-architecture. Never invoke that specialist first merely because the PR touches hosting core, Azure integrations, dashboard, CLI, components, resource types, the app model, or deployment behavior.
After the generic pass, use a focused architectural escalation when all of these are true:
Do not escalate a concern that is already a concrete generic finding, merely high-risk code, a request for a second opinion, or a broad desire for more confidence. Preserve the completed generic findings, run at most one focused escalation for the change-set revision, and merge only net-new high-confidence specialist findings. Do not rerun the generic review after the specialist returns.
Do not post a review automatically. Instead, present all findings as a numbered list for the user to triage. Order by potential impact.
Then ask the user what to do next. The user may respond with:
Once the user has selected which findings to include:
Before submitting a review with event: "APPROVE", check whether the PR has auto-merge enabled:
If the result is non-null (auto-merge is enabled) and the review includes comments, warn the user:
Warning: This PR has auto-merge enabled. Approving it will likely trigger an automatic merge before the author has a chance to address your review comments. Would you like to:
- Approve anyway — submit as APPROVE (auto-merge may proceed immediately).
- Downgrade to comment — submit as COMMENT instead so the author can address feedback first.
Wait for the user's response before proceeding. If they choose option 2, use event: "COMMENT" instead of "APPROVE".
Create a pending review:
Use mcp_github_pull_request_review_write with method create (no event parameter) to start a pending review.
Add inline comments for each selected finding:
Use mcp_github_add_comment_to_pending_review for each selected item. Place comments on the specific lines in the diff:
subjectType: LINE for line-specific comments, FILE for file-level commentsside: RIGHT for comments on new codepath: relative file pathline: the line number in the diffbody: concise description of the problem and how to fix itSubmit the review:
Use mcp_github_pull_request_review_write with method submit_pending:
event: "APPROVE" only if auto-merge is not enabled on the PR, or the user confirmed they want to approve after seeing the auto-merge warning.event: "COMMENT"."REQUEST_CHANGES" unless the user explicitly asks for it.