aot-trimming

aot-trimming is a skill for Claude Code from Aaronontheweb/dotnet-skills. It costs 181 tokens per session (2,689 once invoked), scanned A, original, MIT.

Guidance for making .NET code safe to trim and compatible with Native AOT, a way to compile an application ahead of time without the usual just-in-time compiler. It explains the settings, warnings, and code annotations involved.

In plain words
What is it for?
Use it when enabling trimmed or Native AOT builds, resolving ILLink and AOT warnings, replacing reflection-heavy code, or reviewing APIs and pull requests for compatibility.
Why use it?
Trimming can remove code that runtime reflection needs, while Native AOT restricts some dynamic features; the guidance helps identify and fix those compatibility problems.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the dotnet-skills plugin — 37 skills, 6 agents shipped together

Good fit Use it when enabling trimmed or Native AOT builds, resolving ILLink and AOT warnings, replacing reflection-heavy code, or reviewing APIs and pull requests for compatibility.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/aaronontheweb/dotnet-skills/aot-trimming
About the project

.NET Skills is an AI coding plugin that provides skills and specialized guidance for professional .NET development, covering areas such as C#, Akka.NET, Aspire, Entity Framework Core, testing, and performance. .NET developers use it with coding assistants to apply production-oriented patterns while building and maintaining applications. The catalogue contains the plugin’s skills, agents, and instructions.

Aaronontheweb/dotnet-skills · 1,150 stars · on GitHub

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add Aaronontheweb/dotnet-skills --skill aot-trimming
Clone the repo
git clone --depth 1 https://github.com/Aaronontheweb/dotnet-skills

Made for: Claude Code.

Or install dotnet-skills, the plugin that ships this one along with the rest of its 37 skills, 6 agents.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for aot-trimming

README.md
[![agentmods](https://agentmods.dev/badge/skills/aaronontheweb/dotnet-skills/aot-trimming/github.svg)](https://agentmods.dev/skills/aaronontheweb/dotnet-skills/aot-trimming)
Your own site
<a href="https://agentmods.dev/skills/aaronontheweb/dotnet-skills/aot-trimming"><img src="https://agentmods.dev/badge/skills/aaronontheweb/dotnet-skills/aot-trimming/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for aot-trimming

Your own site · 80×15
<a href="https://agentmods.dev/skills/aaronontheweb/dotnet-skills/aot-trimming"><img src="https://agentmods.dev/badge/skills/aaronontheweb/dotnet-skills/aot-trimming.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 181 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,689 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00181 $0.02689
Opus 5 $0.00090 $0.01345
Sonnet 5 $0.00036 $0.00538
Haiku 4.5 $0.00018 $0.00269

Measured today against content hash 3fe49e8120a9, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

aot-trimming scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured today.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/aot-trimming/SKILL.md · 159 lines

How it starts

The opening of the file, as written. The whole thing — 159 lines — stays where its author put it; the contents beside it link to each section on GitHub.

.NET Trimming and Native AOT

When to Use

  • Adding trimming (PublishTrimmed) or Native AOT (PublishAot) support to a library or application
  • Resolving IL2xxx (trimming) and IL3xxx (AOT/single-file) warnings
  • Making reflection-heavy code trimming-safe
  • Replacing runtime reflection, assembly scanning, or Reflection.Emit with compile-time alternatives
  • Reviewing a codebase or PR for trimming/AOT compatibility, including generated interceptors and analyzer suppressors
  • Designing public APIs that must carry trimming annotations

Core Goals

  • Produce code that survives the linker's reachability analysis and runs under Native AOT (no JIT).
  • Express what the compiler cannot see — which members reflection needs — using the trimming attributes.
  • Keep trimming-safe and trimming-unsafe code separated so unsafe paths are explicit and contained.

Core Model

Trimming vs Native AOT

  • Trimming (PublishTrimmed) runs ILLink reachability analysis: only statically reachable code is kept. Reflection the analyzer cannot see is trimmed away and produces warnings.
  • Native AOT (PublishAot) makes trimming mandatory and removes the JIT. Reflection.Emit is unsupported, constructing unknown generic instantiations at runtime is not guaranteed, Expression.Compile() may fall back to interpretation, and reflection works only over members the linker preserved.
  • Both run the same static analysis:
    • IL2xxx — trimming warnings: RequiresUnreferencedCode propagation + DynamicallyAccessedMembers dataflow.
    • IL3xxx — AOT and single-file warnings: RequiresDynamicCode / RequiresAssemblyFiles.

A library can be trimmable but not AOT-compatible (it uses Reflection.Emit, which trimming tolerates but AOT does not).

The two problems to solve

  1. Unseen reflection (trimming): the linker removes a member or type you load by name, or reach through typeof(T) in a generic method.
  2. Dynamic code generation (AOT): the JIT is gone, so Reflection.Emit is unsupported and constructing unknown generic instantiations is not guaranteed.

Read the full file on GitHub · 159 lines

Files

What ships with it

2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. today First seen · 159 lines · 181 tokens per session scan A 3fe49e8120a9

Subscribe to this mod's changes

aot-trimming is a skill published in the GitHub repository Aaronontheweb/dotnet-skills (1,150 stars, last pushed today), licensed MIT. It adds 181 tokens to every session and 2,689 once invoked, about $0.0009 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-10.

Related

Other skills, from other repositories

generate-code-cs

Generate the code from typespec for C#. Parameter: C# SDK repository root location .

Azure/azure-sdk-for-net · 26 tokens

author-test

Generate a test given sample. Parameters: C# SDK repository root; Package name: one of Azure.AI.Projects, Azure.AI.Projects.Agents or Azure.AI.Extensions.OpenAI; the sample to use as a starting point for the test.

Azure/azure-sdk-for-net · 68 tokens

wpf

Build and modernize WPF applications on .NET with correct XAML, data binding, commands, threading, styling, and Windows desktop migration decisions. USE FOR: working on WPF UI, MVVM, binding, commands, or desktop modernization; migrating WPF from .NET Framework to .NET; integrating newer Windows capabilities into a…

managedcode/dotnet-skills · 122 tokens

mcp

Build or consume Model Context Protocol (MCP) servers and clients in .NET using the official MCP C# SDK, including stdio, Streamable HTTP, tools, prompts, resources, and capability negotiation. USE FOR: .NET MCP servers or clients; stdio versus HTTP transport choices; tools, resources, prompts, completions, and…

managedcode/dotnet-skills · 123 tokens

migrate-xunit-to-mstest

Convert .NET tests from xUnit.net v2/v3 to MSTest v4 while preserving VSTest or MTP. Use for replacing xunit packages, Fact/Theory/InlineData/MemberData, assertions, IClassFixture/ICollectionFixture, ITestOutputHelper, TestContext cancellation, traits/Owner, skips, timeouts, and xUnit parallelization. Also use when a…

managedcode/dotnet-skills · 141 tokens

migrate-xunit-to-xunit-v3

Migrate .NET test projects from xUnit.net v2 to xunit.v3 and fix v3 breaks. Use for package/CPM conversion, OutputType=Exe, preserving the VSTest or MTP runner (including projects currently using YTest.MTP.XUnit2), incompatible TFMs, async void tests, string-to-Type attributes, custom Fact/Theory/BeforeAfterTest…

managedcode/dotnet-skills · 149 tokens