Agent skill
dotnet-aot-analysis
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.
Install this agent skill to your Project
npx add-skill https://github.com/Im5tu/claude/tree/main/skills/dotnet-aot-analysis
Metadata
Additional technical details for this skill
- author
- Im5tu
- version
- 1.0
- repositoryUrl
- https://github.com/im5tu/dotnet-skills
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.AspNetCorerefs,WebApplication,CreateBuilder) - Check for Blazor Server (
Microsoft.AspNetCore.Components.Server) - Check for MVC (
AddControllersWithViews,AddMvc)
Step 3: Warn About Unsupported Scenarios
| Scenario | Documentation |
|---|---|
| Blazor Server | https://learn.microsoft.com/en-us/aspnet/core/fundamentals/native-aot |
| MVC | https://learn.microsoft.com/en-us/aspnet/core/fundamentals/native-aot |
| Session state | https://learn.microsoft.com/en-us/aspnet/core/fundamentals/native-aot |
| SPA middleware | https://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:
dotnet-source-gen-json- JSON serialization AOT readiness (includes polymorphic types)dotnet-source-gen-options-validation- Options pattern AOT readinessdotnet-source-gen-regex- Regex AOT readinessdotnet-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()overCreateBuilder() - Enable Request Delegate Generator (RDG) for Minimal APIs:
xml
<PropertyGroup> <EnableRequestDelegateGenerator>true</EnableRequestDelegateGenerator> </PropertyGroup> - System.Text.Json: Handled by
dotnet-source-gen-jsonskill - 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
| Topic | URL |
|---|---|
| Native AOT Overview | https://learn.microsoft.com/en-us/dotnet/core/deploying/native-aot |
| ASP.NET Core AOT | https://learn.microsoft.com/en-us/aspnet/core/fundamentals/native-aot |
| Request Delegate Generator | https://learn.microsoft.com/en-us/aspnet/core/fundamentals/aot/request-delegate-generator/rdg |
| AOT Limitations | https://learn.microsoft.com/en-us/dotnet/core/deploying/native-aot/?tabs=windows#limitations-of-native-aot-deployment |
| Trimming Libraries | https://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
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
flutter-animations
Comprehensive guide for implementing animations in Flutter. Use when adding motion and visual effects to Flutter apps: implicit animations (AnimatedContainer, AnimatedOpacity, TweenAnimationBuilder), explicit animations (AnimationController, Tween, AnimatedWidget/AnimatedBuilder), hero animations (shared element transitions), staggered animations (sequential/overlapping), and physics-based animations. Includes workflow for choosing the right animation type, implementation patterns, and best practices for performance and user experience.
dotnet-source-gen-logging
Converts logging to use the LoggerMessage source generator for high-performance, AOT-compatible logging. Also use when the user mentions "LoggerMessage," "logging source generator," "high-performance logging," "optimize logging," "AOT logging," or "structured logging source gen." For full AOT analysis, see dotnet-aot-analysis.
dotnet-source-gen-options-validation
Converts options validation to use the compile-time source generator for AOT-compatible, reflection-free validation. Also use when the user mentions "OptionsValidator," "options validation source gen," "AOT options validation," "compile-time validation," "ValidateDataAnnotations replacement," or "reflection-free validation." For full AOT analysis, see dotnet-aot-analysis.
dotnet-enable-testing-platform
Enables the Microsoft Testing Platform runner in global.json. Also use when the user mentions "testing platform," "Microsoft.Testing.Platform," "new test runner," "migrate test runner," "global.json testing," or "modern test platform."
dotnet-json-polymorphic
Configures polymorphic JSON serialization with [JsonPolymorphic] and [JsonDerivedType] attributes. Also use when the user mentions "polymorphic JSON," "JsonDerivedType," "JSON inheritance," "type discriminator," "serialize derived types," or "JSON polymorphism." For full JSON source generation, see dotnet-source-gen-json.
competitor-alternatives
When the user wants to create competitor comparison or alternative pages for SEO and sales enablement. Also use when the user mentions 'alternative page,' 'vs page,' 'competitor comparison,' 'comparison page,' '[Product] vs [Product],' '[Product] alternative,' or 'competitive landing pages.' Covers four formats: singular alternative, plural alternatives, you vs competitor, and competitor vs competitor. Emphasizes deep research, modular content architecture, and varied section types beyond feature tables.
Didn't find tool you were looking for?