Skip to content

[WIP] Add diagnosing-dotnet-aot skill — Native AOT diagnostics and fixes - #12

Closed
artl93 wants to merge 3 commits into
dotnet:mainfrom
artl93:skill/dotnet-aot-diagnostics
Closed

[WIP] Add diagnosing-dotnet-aot skill — Native AOT diagnostics and fixes#12
artl93 wants to merge 3 commits into
dotnet:mainfrom
artl93:skill/dotnet-aot-diagnostics

Conversation

@artl93

@artl93 artl93 commented Feb 12, 2026

Copy link
Copy Markdown
Member

Summary

Adds a skill for diagnosing and fixing .NET Native AOT and trimming compatibility issues. Resolves #8.

What This Skill Adds Beyond Base LLM Knowledge

Base models already know general AOT concepts. This skill targets 7 specific knowledge gaps where LLMs consistently give wrong answers:

What LLMs Get Wrong Correct Answer (from this skill)
Suggests #pragma warning disable for trim warnings #pragma is not preserved in IL — must use [UnconditionalSuppressMessage]
Flags ALL MakeGenericType as dangerous Safe for reference types (shared canonical code); only value types need pre-generated code
Misses Expression.Compile() perf cliff Falls back to 10-100x slower interpreter in AOT — no warning emitted
Suggests fixing EventSource WriteEvent IL2026 False positive for >3 params with primitive types — safe to suppress
Does not know IsAotCompatible=true cascades Automatically enables IsTrimmable + 3 analyzers
Gives incomplete annotation workflow Must propagate [DynamicallyAccessedMembers] through entire call chain
Inconsistent on EF Core AOT status Experimental: compiled models + precompiled queries required

Structure

skills/diagnosing-dotnet-aot/
├── SKILL.md                              # Main skill (131 lines)
└── references/
    ├── critical-patterns.md              # 13 hard-failure patterns (always loaded)
    ├── serialization-and-config.md       # STJ source gen, config binding, logging
    ├── reflection-and-di.md             # Annotation workflow, DI patterns
    ├── generics-and-types.md            # MakeGenericType safety, Expression.Compile
    ├── library-compatibility.md         # Library AOT status matrix
    └── project-setup.md                 # MSBuild, warning codes, CI patterns

agents/dotnet-aot-optimizer.agent.md      # Agent definition

tests/diagnosing-dotnet-aot/
├── EVALUATION.md                         # 6 test cases with pass/fail criteria
└── assets/                               # Code samples for each test
    ├── pragma-warning-suppress.cs        # Test 1: #pragma vs [UnconditionalSuppressMessage]
    ├── make-generic-type-mixed.cs        # Test 2: ref type vs value type distinction
    ├── expression-compile-hotpath.cs     # Test 3: silent 10-100x perf cliff
    ├── eventsource-false-positive.cs     # Test 4: known IL2026 false positive
    ├── annotation-chain-incomplete.cs    # Test 5: multi-hop annotation propagation
    └── isaotcompatible-cascade.cs        # Test 6: property cascade knowledge

Design Decisions

  • Signal-based progressive loading: SKILL.md detects code signals and loads only relevant reference files (not all 6)
  • Tiered severity: 🔴 Critical (will crash) / 🟡 Warning (IL warning) / ℹ️ Info (suboptimal but functional)
  • All .NET ecosystem: Never recommends rewriting outside .NET
  • Gerund naming: diagnosing-dotnet-aot per Claude agent skills best practices
  • TOC on all reference files: All >100 lines, each has table of contents

Best Practices Applied

Following Claude agent skills best practices:

  • Conciseness: removed explanations Claude already knows
  • Gerund naming convention
  • Third-person description with trigger terms
  • Progressive disclosure (one level deep references)
  • Table of contents on long reference files
  • No time-sensitive language
  • Consistent terminology throughout
  • Evaluation test cases with concrete success criteria

Skill: dotnet-aot-compatibility
- Signal-based progressive disclosure with 6 reference files
- 13 critical AOT failure patterns (Reflection.Emit, dynamic loading, etc.)
- Source generation migration patterns (STJ, config, logging, regex)
- DynamicallyAccessedMembers annotation propagation workflow
- Library compatibility matrix current with .NET 10
- Project setup, warning codes, and CI validation patterns

Agent: dotnet-aot-optimizer
- Triggers on AOT/trimming warnings, PublishAot questions, library compat
- References dotnet-aot-compatibility skill for progressive disclosure
@artl93 artl93 changed the title Add dotnet-aot-compatibility skill and agent [WIP] Add dotnet-aot-compatibility skill and agent Feb 12, 2026
- Rename skill to gerund form: dotnet-aot-compatibility → diagnosing-dotnet-aot
- Add table of contents to all 6 reference files (all >100 lines)
- Remove time-sensitive language (dates, years)
- Trim verbose explanations Claude already knows
- Reduce SKILL.md from 135 to 117 lines
- Reduce agent file from 78 to 52 lines
- Update agent to reference new skill name
- Add 'Why This Skill Exists' table showing 7 specific knowledge gaps
  where base LLMs consistently give wrong answers
- Create tests/ with 6 evaluation test cases, each targeting a
  high-delta behavior: #pragma suppression, MakeGenericType ref/value
  distinction, Expression.Compile silent perf cliff, EventSource false
  positive, annotation chain propagation, IsAotCompatible cascade
- Each test includes: prompt, code asset, success criteria, rationale
@artl93 artl93 changed the title [WIP] Add dotnet-aot-compatibility skill and agent [WIP] Add diagnosing-dotnet-aot skill — Native AOT diagnostics and fixes Feb 14, 2026

@jeffschwMSFT jeffschwMSFT left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this skill needs to be rebased into the new org structure and run through the skill validator

@artl93

artl93 commented Feb 27, 2026

Copy link
Copy Markdown
Member Author

@jeffschwMSFT - I'm closing mine out - this is out of date and needs more attention.

@artl93 artl93 closed this Feb 27, 2026
moesac0970 pushed a commit to moesac0970/skills that referenced this pull request Jul 4, 2026
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.

Skill idea: Trimming & AOT Readiness

2 participants