Specialized Native AOT, trimming, and optimization expert for morphir-dotnet. Expert in single-file trimmed executables, AOT compilation, size optimization, and guiding toward AOT-compatible features. Use when troubleshooting compilation, diagnosing trimming issues, optimizing binary size, implementing reflection workarounds, or maintaining best practices. Triggers include "AOT", "Native AOT", "trimming", "single-file", "size optimization", "reflection error", "IL2026", "IL3050", "PublishAot", "PublishTrimmed", "source generator", "Myriad".
Single-file trimmed executable and Native AOT optimization expert for morphir-dotnet.
This skill is automatically activated when you mention:
The AOT Guru helps with:
The primary focus is on single-file trimmed executables which are:
Native AOT is the future goal, but not immediately achievable due to:
The AOT Guru guides you to make code AOT-ready even while using trimmed executables today.
What it means: Code is using reflection (not compatible with trimming or AOT)
AOT Guru will:
AOT Guru will:
AOT Guru will:
AOT Guru will:
AOT Guru will:
AOT Guru will:
The AOT Guru understands that Native AOT is not immediately achievable. Here's the recommended path:
Focus: Produce deployable executables today
Focus: Write new code that will work with AOT
Focus: Make existing code AOT-compatible
Focus: Compile with PublishAot=true
Current Status: Phase 1 (trimmed) is production-ready. Phase 2 (AOT-ready patterns) is ongoing. The AOT Guru helps you succeed at Phase 1 while preparing for Phase 4.
Located in .claude/skills/aot-guru/:
aot-diagnostics.fsx - Comprehensive project analysis
dotnet fsi aot-diagnostics.fsx <project-path>
aot-analyzer.fsx - Build output analysis
dotnet fsi aot-analyzer.fsx <build-log>
aot-test-runner.fsx - Test matrix runner
dotnet fsi aot-test-runner.fsx --runtime linux-x64
Located in templates/:
The AOT Guru maintains and updates:
AOT/Trimming Guide (docs/contributing/aot-trimming-guide.md)
AOT Optimization Guide (.agents/aot-optimization.md)
Issue Database (templates/known-issues/)
Based on morphir-dotnet requirements:
| Configuration | Target Size | Use Case | |--------------|-------------|----------| | Minimal CLI | 15-25 MB | Basic IR operations, trimmed | | Feature-rich CLI | 25-35 MB | Full tooling features, trimmed | | With Rich UI | 30-40 MB | Spectre.Console, trimmed |
| Configuration | Target Size | Use Case | |--------------|-------------|----------| | Minimal CLI | 5-8 MB | Basic IR operations, AOT + trimming | | Feature-rich CLI | 8-12 MB | Full tooling, AOT + trimming | | With Rich UI | 10-15 MB | Spectre.Console, AOT + trimming |
Note: Focus on achieving current targets with trimmed executables while guiding code toward future AOT targets.
Assessment
You: "I need to make the VerifyIR feature AOT-compatible"
AOT Guru:
- Analyzes VerifyIR code
- Identifies JSON serialization usage
- Checks for reflection patterns
- Reviews dependencies (WolverineFx, System.Text.Json)
Planning
AOT Guru provides:
- List of changes needed
- Priority order
- Estimated effort
- Potential risks
Implementation
AOT Guru:
- Creates source-generated JsonSerializerContext
- Adds DynamicDependency attributes where needed
- Updates WolverineFx configuration for AOT
- Shows code examples
Testing
AOT Guru:
- Builds with PublishAot=true
- Runs smoke tests
- Measures binary size
- Compares against targets
Documentation
AOT Guru:
- Updates AOT/Trimming Guide with new patterns
- Documents any issues encountered
- Adds BDD test scenarios
Error Type?
├── IL2026 (RequiresUnreferencedCode)
│ ├── System.Text.Json → Use source generators
│ └── Other reflection → Add DynamicDependency or refactor
│
├── IL3050 (RequiresDynamicCode)
│ ├── LINQ expressions → Replace with delegates
│ └── Reflection.Emit → Use source generators
│
├── IL2087 (Type incompatibility)
│ └── Add [DynamicallyAccessedMembers] attributes
│
└── Runtime error (MissingMethodException)
└── Add DynamicDependency or TrimmerRootDescriptor
Size vs Target?
├── > 20 MB → Check dependencies (major issue)
│ ├── Run: dotnet list package
│ ├── Look for: Newtonsoft.Json, heavy ORMs
│ └── Replace with lighter alternatives
│
├── 12-20 MB → Check optimization flags
│ ├── IlcOptimizationPreference=Size
│ ├── InvariantGlobalization=true
│ └── Enable all feature switches
│
├── 8-12 MB → Feature-rich target (acceptable)
│ └── Document feature set and size
│
└── < 8 MB → Minimal/optimal (excellent)
└── Track for size regression
The AOT Guru learns and improves by:
Every quarter, the AOT Guru reviews:
If the AOT Guru encounters something it can't solve:
Philosophy: The best AOT support is proactive, not reactive. Design for AOT from the start, document every issue, automate diagnostics, and make AOT easier for everyone over time.
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer