Skip to content

Add rebuild guidance to Aspire skill for per-resource code changes#15598

Open
davidfowl wants to merge 6 commits intorelease/13.2from
davidfowl/skill-issues
Open

Add rebuild guidance to Aspire skill for per-resource code changes#15598
davidfowl wants to merge 6 commits intorelease/13.2from
davidfowl/skill-issues

Conversation

@davidfowl
Copy link
Contributor

@davidfowl davidfowl commented Mar 26, 2026

Description

Improves the Aspire skill content to teach agents better workflows for applying code changes and finding documentation, based on real user feedback.

Changes

1. "Applying code changes" decision table

Agents were restarting the entire AppHost when only a single project changed. Added a decision tree:

What changed Action
AppHost project aspire start (full restart)
.NET project resource aspire resource <name> rebuild
Interpreted resource (JS, Python) Typically nothing — file watchers handle it

2. Documentation lookup guidance

Users reported Copilot digging through ~/.nuget/packages XML doc files instead of using the built-in aspire docs search command. Added a rule using the "prefer X over Y" pattern (medium freedom):

Prefer aspire docs search and aspire docs get over searching NuGet package caches or XML doc files.

We chose "prefer" over "Do NOT" following Claude skill best practices — the NuGet approach technically works, it's just a poor experience. A hard block ("never") would be appropriate only for operations that are truly dangerous or broken.

3. Command reference

Added aspire resource <resource> rebuild to the CLI command table, scoped to .NET project resources. Added aspire describe --format Json hint for agents to discover available commands per resource.

Design choices

  • Decision table over prose — agents pattern-match well on tables; conditional workflow pattern from Claude skill best practices
  • "Prefer" over "Do NOT" — medium-freedom degree; acknowledges alternatives exist but strongly nudges the right path
  • Scoped rebuild to .NETrebuild is only available on ProjectResource (verified via KnownResourceCommands.cs and ProjectResourceBuilderExtensions.cs)

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No — skill content change only
  • Did you add public API?
    • No
  • Does the change make any security assumptions or guarantees?
    • No
  • Does the change require an update in our Aspire docs?
    • No

Update the skill content to teach agents when to restart the AppHost vs
rebuild a single resource vs do nothing:

- AppHost code changed → aspire start (full restart)
- Compiled resource changed (C#, Go, etc.) → aspire resource <name> rebuild
- Interpreted resource (JS, Python) → no action (file watchers handle it)

Add 'aspire resource <resource> rebuild' to the CLI command reference table
and reinforce the rule in Important rules section.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 26, 2026 05:05
@github-actions
Copy link
Contributor

github-actions bot commented Mar 26, 2026

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 15598

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 15598"

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the Aspire agent skill content to guide when to restart the AppHost versus rebuilding a single resource, aiming to prevent unnecessary full-stack restarts for per-resource code changes.

Changes:

  • Adds aspire resource <resource> rebuild to the skill’s CLI command reference table.
  • Adds an “Applying code changes” decision table (AppHost vs compiled resource vs interpreted resource).
  • Reinforces the guidance in the “Important rules” section.
Comments suppressed due to low confidence (2)

src/Aspire.Cli/Agents/CommonAgentApplicators.cs:210

  • The guidance implies aspire resource <name> rebuild applies to any “compiled resource (C#, Go, Java, etc.)”, but the rebuild command is only added for ProjectResource (a .NET project) and is explicitly described as rebuilding the project (it runs dotnet build). Consider narrowing this row to “.NET project resource (.csproj)” or phrasing it as “If the resource exposes a rebuild command in aspire describe, use it; otherwise restart the resource.”
        | AppHost project (`apphost.cs`/`apphost.ts`) | `aspire start` | Resource graph changed; full restart required |
        | Compiled resource (C#, Go, Java, etc.) | `aspire resource <name> rebuild` | Rebuilds and restarts only that resource |
        | Interpreted resource (JavaScript, Python) | Nothing — file watchers handle it | Hot reload picks up changes automatically |

src/Aspire.Cli/Agents/CommonAgentApplicators.cs:243

  • This rule says to use aspire resource <name> rebuild for “individual compiled resources”, but rebuild is not a general-purpose command—it’s only present for certain resource types (e.g., .NET project resources) and won’t exist for many compiled services (containers, non-.NET, etc.). Consider rewording to “For individual .NET project resources, use aspire resource <name> rebuild when available; otherwise use the resource’s restart command.”
        - **Only restart the AppHost when AppHost code changes.** For individual compiled resources, use `aspire resource <name> rebuild` instead.

davidfowl and others added 5 commits March 25, 2026 22:23
Acknowledge that not all JS/Python resources run in watch mode — suggest
restarting the resource if no file watcher is configured.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Agents can check which commands a resource supports before attempting
rebuild, since it is only available on .NET project resources.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Users report Copilot digging through NuGet package caches for XML doc
files instead of using the built-in aspire docs search/get commands.
Add an explicit rule telling agents to never search local package
folders for Aspire documentation.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Use medium-freedom 'prefer X over Y' pattern instead of 'Do NOT'
for documentation lookup guidance.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@davidfowl davidfowl requested review from JamesNK and mitchdenny March 26, 2026 05:37
@github-actions
Copy link
Contributor

🎬 CLI E2E Test Recordings — 51 recordings uploaded (commit abed4c4)

View recordings
Test Recording
AddPackageInteractiveWhileAppHostRunningDetached ▶️ View Recording
AddPackageWhileAppHostRunningDetached ▶️ View Recording
AgentCommands_AllHelpOutputs_AreCorrect ▶️ View Recording
AgentInitCommand_DefaultSelection_InstallsSkillOnly ▶️ View Recording
AgentInitCommand_MigratesDeprecatedConfig ▶️ View Recording
AspireAddPackageVersionToDirectoryPackagesProps ▶️ View Recording
AspireUpdateRemovesAppHostPackageVersionFromDirectoryPackagesProps ▶️ View Recording
Banner_DisplayedOnFirstRun ▶️ View Recording
Banner_DisplayedWithExplicitFlag ▶️ View Recording
CertificatesClean_RemovesCertificates ▶️ View Recording
CertificatesTrust_WithNoCert_CreatesAndTrustsCertificate ▶️ View Recording
CertificatesTrust_WithUntrustedCert_TrustsCertificate ▶️ View Recording
ConfigSetGet_CreatesNestedJsonFormat ▶️ View Recording
CreateAndRunAspireStarterProject ▶️ View Recording
CreateAndRunAspireStarterProjectWithBundle ▶️ View Recording
CreateAndRunEmptyAppHostProject ▶️ View Recording
CreateAndRunJsReactProject ▶️ View Recording
CreateAndRunPythonReactProject ▶️ View Recording
CreateAndRunTypeScriptEmptyAppHostProject ▶️ View Recording
CreateAndRunTypeScriptStarterProject ▶️ View Recording
CreateStartAndStopAspireProject ▶️ View Recording
CreateTypeScriptAppHostWithViteApp ▶️ View Recording
DescribeCommandResolvesReplicaNames ▶️ View Recording
DescribeCommandShowsRunningResources ▶️ View Recording
DetachFormatJsonProducesValidJson ▶️ View Recording
DoctorCommand_DetectsDeprecatedAgentConfig ▶️ View Recording
DoctorCommand_WithSslCertDir_ShowsTrusted ▶️ View Recording
DoctorCommand_WithoutSslCertDir_ShowsPartiallyTrusted ▶️ View Recording
GlobalMigration_HandlesCommentsAndTrailingCommas ▶️ View Recording
GlobalMigration_HandlesMalformedLegacyJson ▶️ View Recording
GlobalMigration_PreservesAllValueTypes ▶️ View Recording
GlobalMigration_SkipsWhenNewConfigExists ▶️ View Recording
GlobalSettings_MigratedFromLegacyFormat ▶️ View Recording
InvalidAppHostPathWithComments_IsHealedOnRun ▶️ View Recording
LegacySettingsMigration_AdjustsRelativeAppHostPath ▶️ View Recording
LogsCommandShowsResourceLogs ▶️ View Recording
PsCommandListsRunningAppHost ▶️ View Recording
PsFormatJsonOutputsOnlyJsonToStdout ▶️ View Recording
PublishWithDockerComposeServiceCallbackSucceeds ▶️ View Recording
RestoreGeneratesSdkFiles ▶️ View Recording
RunFromParentDirectory_UsesExistingConfigNearAppHost ▶️ View Recording
RunWithMissingAwaitShowsHelpfulError ▶️ View Recording
SecretCrudOnDotNetAppHost ▶️ View Recording
SecretCrudOnTypeScriptAppHost ▶️ View Recording
StagingChannel_ConfigureAndVerifySettings_ThenSwitchChannels ▶️ View Recording
StopAllAppHostsFromAppHostDirectory ▶️ View Recording
StopAllAppHostsFromUnrelatedDirectory ▶️ View Recording
StopNonInteractiveMultipleAppHostsShowsError ▶️ View Recording
StopNonInteractiveSingleAppHost ▶️ View Recording
StopWithNoRunningAppHostExitsSuccessfully ▶️ View Recording
TypeScriptAppHostWithProjectReferenceIntegration ▶️ View Recording

📹 Recordings uploaded automatically from CI run #23579274001

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants