askill
dotnet-aot-analysis

dotnet-aot-analysisSafety 90Repository

Analyzes and configures a .NET project or solution for Native AOT compatibility. Orchestrates source generator skills and applies AOT settings. Also use when the user mentions "AOT," "native AOT," "trimming," "publish AOT," "AOT compatibility," or "ahead-of-time compilation." For specific source generators, see dotnet-source-gen-json, dotnet-source-gen-regex, dotnet-source-gen-logging.

0 stars
1.2k downloads
Updated 3/3/2026

Package Files

Loading files...
SKILL.md

Analyze and configure a .NET project or solution for Native AOT compatibility, applying source generators and AOT settings.

When to Use

  • User wants to enable Native AOT
  • User wants to check AOT compatibility
  • User wants to optimize for AOT deployment

Workflow

Step 1: Ask Scope

Ask user: Solution-wide or Specific project(s)?

Step 2: Detect Project Types

For each project:

  • Check for ASP.NET Core (Microsoft.AspNetCore refs, WebApplication, CreateBuilder)
  • Check for Blazor Server (Microsoft.AspNetCore.Components.Server)
  • Check for MVC (AddControllersWithViews, AddMvc)

Step 3: Warn About Unsupported Scenarios

ScenarioDocumentation
Blazor Serverhttps://learn.microsoft.com/en-us/aspnet/core/fundamentals/native-aot
MVChttps://learn.microsoft.com/en-us/aspnet/core/fundamentals/native-aot
Session statehttps://learn.microsoft.com/en-us/aspnet/core/fundamentals/native-aot
SPA middlewarehttps://learn.microsoft.com/en-us/aspnet/core/fundamentals/native-aot

Ask user: Continue with compatible projects or abort?

Step 4: Invoke Sub-Skills

For each compatible project, invoke:

  1. dotnet-source-gen-json - JSON serialization AOT readiness (includes polymorphic types)
  2. dotnet-source-gen-options-validation - Options pattern AOT readiness
  3. dotnet-source-gen-regex - Regex AOT readiness
  4. dotnet-source-gen-logging - Logging AOT readiness

Step 5: Configure AOT Settings

If solution-wide:

Check for src/Directory.Build.props, otherwise use solution root. Add/merge:

<Project>
  <PropertyGroup>
    <!-- Advisory flag for tooling/analyzers; does not make code AOT-compatible -->
    <IsAotCompatible>true</IsAotCompatible>
    <EnableTrimAnalyzer>true</EnableTrimAnalyzer>
    <EnableSingleFileAnalyzer>true</EnableSingleFileAnalyzer>
    <EnableAotAnalyzer>true</EnableAotAnalyzer>
  </PropertyGroup>
</Project>

If project-specific:

Add to each .csproj:

<PropertyGroup>
  <PublishAot>true</PublishAot>
</PropertyGroup>

Step 6: ASP.NET Core Specific

For ASP.NET Core projects:

  • Recommend CreateSlimBuilder() over CreateBuilder()
  • Enable Request Delegate Generator (RDG) for Minimal APIs:
    <PropertyGroup>
      <EnableRequestDelegateGenerator>true</EnableRequestDelegateGenerator>
    </PropertyGroup>
    
  • System.Text.Json: Handled by dotnet-source-gen-json skill
  • Warn about HTTPS/HTTP3 if needed (not included in CreateSlimBuilder)
  • Ask user if they want to see generated code. If so, add <EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>

Step 7: Verify

Run dotnet build and check for AOT warnings.

Key Documentation Links

TopicURL
Native AOT Overviewhttps://learn.microsoft.com/en-us/dotnet/core/deploying/native-aot
ASP.NET Core AOThttps://learn.microsoft.com/en-us/aspnet/core/fundamentals/native-aot
Request Delegate Generatorhttps://learn.microsoft.com/en-us/aspnet/core/fundamentals/aot/request-delegate-generator/rdg
AOT Limitationshttps://learn.microsoft.com/en-us/dotnet/core/deploying/native-aot/?tabs=windows#limitations-of-native-aot-deployment
Trimming Librarieshttps://learn.microsoft.com/en-us/dotnet/core/deploying/trimming/prepare-libraries-for-trimming

Notes

  • Requires .NET 8+
  • ASP.NET Core: Use CreateSlimBuilder() for optimal size
  • Minimal APIs: Enable Request Delegate Generator (RDG) for optimal AOT performance
  • Eliminate runtime reflection from hot paths; use source generators where reflection would otherwise be required
  • System.Text.Json: Register all types in JsonSerializerContext

Install

Download ZIP
Requires askill CLI v1.0+

AI Quality Score

88/100Analyzed 3/15/2026

High-quality technical skill for .NET Native AOT configuration. Well-structured with 7-step workflow, clear decision points, XML configuration examples, documentation links, and warning tables for unsupported scenarios. References sub-skills for source generators. Tags (ci-cd/github-actions) seem mismatched with AOT focus but content is excellent.

90
90
85
85
90

Metadata

Licenseunknown
Version-
Updated3/3/2026
PublisherIm5tu

Tags

ci-cdgithub-actionsobservability