[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6BXV725CT0TCRQ3JW522TGS":3,"skill-same:01M6BXV725CT0TCRQ3JW522TGS":104},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":8,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":10,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":16,"sourceHtmlUrl":17,"categories":18,"keywords":29,"publishedAt":36,"linkOnly":37,"markdownContent":38,"markdownBody":39,"frontMatter":40,"refName":41,"commitSha":42,"skillDirectory":43,"forksCount":14,"repositoryHtmlUrl":44,"repositoryHomepageUrl":45,"ownerHtmlUrl":46,"ownerBlogUrl":47,"ownerDescription":48,"updatedAt":49,"install":50,"resources":63},"01M6BXV725CT0TCRQ3JW522TGS","dotnet-aot-compat",".NET Native AOT 兼容改造","Makes .NET projects compatible with Native AOT and trimming by resolving IL trim and AOT analyzer warnings. Use when making a project AOT-compatible, fixing trimming warnings, resolving IL2026, IL2067, IL2070, IL2072, or IL3050, adding DynamicallyAccessedMembers annotations, or enabling IsAotCompatible. Not for publishing native AOT binaries, optimizing binary size, replacing reflection-heavy libraries, or .NET Framework projects.","通过解决 IL 裁剪和 AOT 分析器警告，使 .NET 项目兼容 Native AOT 和裁剪。当进行项目 AOT 兼容改造、修复裁剪警告、解决 IL2026、IL2067、IL2070、IL2072 或 IL3050、添加 DynamicallyAccessedMembers 注解，或启用 IsAotCompatible 时使用。不适用于发布原生 AOT 二进制文件、优化二进制体积、替换重度依赖反射的库，或 .NET Framework 项目。","Cratis\u002FSpecifications","Cratis","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F16456213?v=4","01M6BXRH290K4C8RS4PTKK3HXQ","01M6BXRH6YXJMJ3140T8TVBSB4",1,"MIT","https:\u002F\u002Fgithub.com\u002FCratis\u002FSpecifications\u002Fblob\u002Fmain\u002F.cratis\u002Fai\u002Fskills\u002Fdotnet-aot-compat\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FCratis\u002FSpecifications\u002Fblob\u002Fmain\u002F.cratis\u002Fai\u002Fskills\u002Fdotnet-aot-compat\u002FSKILL.md",[19,24],{"categoryNo":20,"categoryName":21,"taxonomyType":22,"taxonomyTypeDesc":23},"01M8BQ6TQZN6R52WBJ9H8NRMQM","软件开发工程师","PROFESSION","适用职业",{"categoryNo":25,"categoryName":26,"taxonomyType":27,"taxonomyTypeDesc":28},"01M8BT7QVANT4709358VEJK53E","代码实现","SCENARIO","使用场景",[30,31,32,33,34,35],"dotnet","dotnet aot compat","libraries","framework","projects","annotations","2026-11-10 10:12:30",false,"---\nname: dotnet-aot-compat\ndescription: 'Makes .NET projects compatible with Native AOT and trimming by resolving IL trim and AOT analyzer warnings. Use when making a project AOT-compatible, fixing trimming warnings, resolving IL2026, IL2067, IL2070, IL2072, or IL3050, adding DynamicallyAccessedMembers annotations, or enabling IsAotCompatible. Not for publishing native AOT binaries, optimizing binary size, replacing reflection-heavy libraries, or .NET Framework projects.'\nlicense: MIT\n---\n\u003C!-- cratis-ai-managed: skills\u002Fdotnet-aot-compat\u002FSKILL.md -->\n\n\u003C!-- Modified by Cratis from dotnet's original (MIT): frontmatter, applicability, navigation and the changes listed in NOTICE. Upstream: https:\u002F\u002Fgithub.com\u002Fdotnet\u002Fskills (plugins\u002Fdotnet-upgrade\u002Fskills\u002Fdotnet-aot-compat\u002FSKILL.md; see NOTICE) -->\n\n# dotnet-aot-compat\n\nCratis rules in `.cratis\u002Fai\u002Frules\u002F` (including `csharp.md`, `specs.csharp.md`, and `orleans.md`) and the `cratis-*` skills win where they differ. Arc host trimming\u002FNativeAOT setup belongs to **cratis-arc-hosting**.\n\nMake .NET projects compatible with Native AOT and trimming by systematically resolving all IL trim\u002FAOT analyzer warnings.\n\n## When to Use This Skill\n\n- **\"Make this project AOT-compatible\"**\n- **\"Fix trimming warnings\"** or **\"fix IL warnings\"**\n- **\"Resolve IL2070 \u002F IL2067 \u002F IL2072 \u002F IL2026 \u002F IL3050 warnings\"**\n- **\"Add DynamicallyAccessedMembers annotations\"**\n- **\"Enable IsAotCompatible in my .csproj\"**\n- **\"My project has trim analyzer warnings after upgrading to net8.0\"**\n- **\"Annotate reflection code for the trimmer\"**\n\n## When Not to Use This Skill\n\nDo not use this skill when the project exclusively targets .NET Framework (net4x), which does not support the trim\u002FAOT analyzers.\n\n## Prerequisites\n\nAn existing .NET project targeting net8.0 or later (or multi-targeting with at least one net8.0+ TFM) and the corresponding .NET SDK installed.\n\n## Background: What AOT Compatibility Means\n\nNative AOT and the IL trimmer perform static analysis to determine what code is reachable. Reflection can break this analysis because the trimmer can't see what types\u002Fmembers are accessed at runtime. The `IsAotCompatible` property enables analyzers that flag these issues as build warnings (ILXXXX codes).\n\n## Critical Rules\n\n### ❌ Never suppress warnings incorrectly\n\n- **NEVER** use `#pragma warning disable` for IL warnings. It hides warnings from the Roslyn analyzer at build time, but the IL linker and AOT compiler still see the issue. The code will fail at trim\u002Fpublish time.\n- **NEVER** use `[UnconditionalSuppressMessage]`. It tells both the analyzer AND the linker to ignore the warning, meaning the trimmer cannot verify safety. Raising an error at build time is always preferable to hiding the issue and having it silently break at runtime.\n\n### ? Preferred approaches\n\n- **Prefer** `[DynamicallyAccessedMembers]` annotations to flow type information through the call chain.\n- **Prefer** refactoring to eliminate patterns that break annotation flow (e.g., boxing `Type` through `object[]`).\n- **Use** `[RequiresUnreferencedCode]` \u002F `[RequiresDynamicCode]` \u002F `[RequiresAssemblyFiles]` to mark methods as fundamentally incompatible with trimming, propagating the requirement to callers. This surfaces the issue clearly rather than hiding it — callers must explicitly acknowledge the incompatibility.\n\n### Annotation flow is key\n\nThe trimmer tracks `[DynamicallyAccessedMembers]` annotations through assignments, parameter passing, and return values. If this flow is broken (e.g., by boxing a `Type` into `object`, storing in an untyped collection, or casting through interfaces), the trimmer loses track and warns. The fix is to preserve the flow, not suppress the warning.\n\n## Step-by-Step Procedure\n\n> **Do not explore the codebase up-front.** The build warnings tell you exactly which files and lines need changes. Follow a tight loop: **build → pick a warning → open that file at that line → apply the fix recipe → rebuild**. Reading or analyzing source files beyond what a specific warning points you to is wasted effort and leads to timeouts. Let the compiler guide you.\n>\n> ❌ Do NOT run `find`, `ls`, or `grep` to understand the project structure before building. Do NOT read README, docs, or architecture files. Your first action should be Step 1 (enable AOT analysis), then build.\n\n### Step 1: Enable AOT analysis in the .csproj\n\nAdd `IsAotCompatible`. If the project doesn't exclusively target net8.0+, add a TFM condition (AOT analysis requires net8.0+):\n\n```xml\n\u003CPropertyGroup>\n  \u003CIsAotCompatible Condition=\"$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0'))\">true\u003C\u002FIsAotCompatible>\n\u003C\u002FPropertyGroup>\n```\n\nThis automatically sets `EnableTrimAnalyzer=true` and `EnableAotAnalyzer=true` for compatible TFMs. For multi-targeting projects (e.g., `netstandard2.0;net8.0`), the condition ensures no `NETSDK1210` warnings on older TFMs.\n\n### Step 2: Build and collect warnings\n\n```bash\ndotnet build \u003Cproject.csproj> -f \u003Cnet8.0-or-later-tfm> --no-incremental 2>&1 | grep 'IL[0-9]\\{4\\}'\n```\n\nSort and deduplicate. Common warning codes:\n- **IL2070**: Reflection call on a `Type` parameter missing `[DynamicallyAccessedMembers]`\n- **IL2067**: Passing an unannotated `Type` to a method expecting `[DynamicallyAccessedMembers]`\n- **IL2072**: Return value or extracted value missing annotation (often from unboxing)\n- **IL2057**: `Type.GetType(string)` with a non-constant argument\n- **IL2026**: Calling a method marked `[RequiresUnreferencedCode]`\n- **IL2050**: P\u002Finvoke method with COM marshalling parameters\n- **IL2075**: Return value flows into reflection without annotation\n- **IL2091**: Generic argument missing `[DynamicallyAccessedMembers]` required by constraint\n- **IL3000**: `Assembly.Location` returns empty string in single-file\u002FAOT apps\n- **IL3050**: Calling a method marked `[RequiresDynamicCode]`\n\n### Step 3: Triage warnings by code (do NOT read every file)\n\nGroup the warnings from Step 2 by warning code and count them. **Do not open individual files yet.** Identify the top 1-2 patterns by count — these drive your fix strategy:\n\n| Pattern | Typical fix |\n|---------|-------------|\n| Many IL2026 + IL3050 from `JsonSerializer` | **Go to Strategy C immediately** — create a `JsonSerializerContext`, then batch-update all call sites |\n| IL2070\u002FIL2087 on `Type` parameters | Add `[DynamicallyAccessedMembers]` to the innermost method, then cascade outward |\n| IL2067 passing unannotated `Type` | Annotate the parameter at the source |\n\n**In most real projects, IL2026\u002FIL3050 from JsonSerializer dominate.** Start with Strategy C unless the warning breakdown clearly shows otherwise. After the batch JSON fix, handle remaining warnings with Strategies A–B. Only use Strategy D as a last resort.\n\n### Step 4: Fix warnings iteratively (innermost first)\n\nWork from the **innermost** reflection call outward. Each fix may cascade new warnings to callers.\n\n**Stay warning-driven.** For each warning, open only the file and line the compiler reported, identify the pattern, apply the matching fix recipe below, and move on. Do not scan the codebase for similar patterns or try to understand the full architecture — fix what the compiler tells you, rebuild, and let new warnings guide the next change. Fix a small batch of warnings (5-10), then rebuild immediately to check progress.\n\n**Use sub-agents when available.** If you can launch sub-agents (e.g., via a `task` tool), dispatch **multiple sub-agents in parallel** to edit different files simultaneously. Keep the main loop focused on building, parsing warnings, and dispatching — delegate actual file edits to sub-agents. For batch JSON updates, give each sub-agent 5-10 files to update in one prompt. **After 2 build-fix cycles, dispatch all remaining file edits to sub-agents in parallel — do not continue fixing files sequentially.** Example:\n\n> Update these files to use source-generated JSON: `src\u002FModels\u002FResource.Serialization.cs`, `src\u002FModels\u002FIdentity.Serialization.cs`, `src\u002FModels\u002FPlan.Serialization.cs`. In each file, replace `JsonSerializer.Serialize(writer, value)` with `JsonSerializer.Serialize(writer, value, MyProjectJsonContext.Default.TypeName)` and `JsonSerializer.Deserialize\u003CT>(ref reader)` with `JsonSerializer.Deserialize(ref reader, MyProjectJsonContext.Default.TypeName)`. Only edit the JsonSerializer call sites.\n\n#### Strategy A: Add `[DynamicallyAccessedMembers]` (preferred)\n\nWhen a method uses reflection on a `Type` parameter, annotate the parameter to tell the trimmer what members are needed:\n\n```csharp\nusing System.Diagnostics.CodeAnalysis;\n\n\u002F\u002F Before (warns IL2070):\nvoid Process(Type t) {\n    var method = t.GetMethod(\"Foo\");  \u002F\u002F trimmer can't verify\n}\n\n\u002F\u002F After (clean):\nvoid Process([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] Type t) {\n    var method = t.GetMethod(\"Foo\");  \u002F\u002F trimmer preserves public methods\n}\n```\n\nWhen you annotate a parameter, **all callers** must now pass properly annotated types. This cascades outward — follow each caller and annotate or refactor as needed. **The caller's annotation must include at least the same member types as the callee's.** If the callee requires `PublicConstructors | NonPublicConstructors`, the caller must specify the same or a superset — using only `NonPublicConstructors` will produce IL2091.\n\n#### Strategy B: Refactor to preserve annotation flow\n\nWhen annotation flow is broken by boxing (storing `Type` in `object`, `object[]`, or untyped collections), **refactor** to pass the `Type` directly:\n\n```csharp\n\u002F\u002F BROKEN: Type boxed into object[], annotation lost\nvoid Process(object[] args) {\n    Type t = (Type)args[0];  \u002F\u002F IL2072: annotation lost through boxing\n    Evaluate(t, ...);\n}\n\n\u002F\u002F FIXED: Pass Type as a separate, annotated parameter\nvoid Process(\n    object[] args,\n    [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] Type calleeType,\n    ...) {\n    Evaluate(calleeType, ...);  \u002F\u002F annotation flows cleanly\n}\n```\n\nCommon patterns that break flow and how to fix them:\n- **`object[]` parameter bags**: Extract the `Type` into a dedicated annotated parameter\n- **Dictionary\u002FList storage**: Use a typed field with annotation instead\n- **Interface indirection**: Add annotation to the interface method's parameter\n- **Property with boxing getter**: Annotate the property's return type\n\n#### Strategy C: Source-generated JSON serialization (batch fix)\n\nWhen most warnings are IL2026\u002FIL3050 from `JsonSerializer.Serialize`\u002F`Deserialize`, this is a single mechanical fix applied in bulk:\n\n1. **Collect affected types** — grep for all `JsonSerializer.Serialize` and `JsonSerializer.Deserialize` call sites. Extract the type being serialized (the `\u003CT>` in `Deserialize\u003CT>`, or the runtime type of the object in `Serialize`).\n\n2. **Create one `JsonSerializerContext`** with `[JsonSerializable]` for every type found. **Skip types from external packages** (e.g., `ResponseError` from `Azure.Core`) — they won't source-generate for types you don't own. Handle external types separately via Gotcha #1 below.\n\n```csharp\n[JsonSerializable(typeof(ManagedServiceIdentity))]\n[JsonSerializable(typeof(SystemData))]\n\u002F\u002F ... one attribute per type YOU OWN\n\u002F\u002F Do NOT add types from external packages (e.g., ResponseError)\ninternal partial class MyProjectJsonContext : JsonSerializerContext { }\n```\n\n3. **Batch-update all call sites** — do not read each file individually. Apply the pattern mechanically:\n   - `JsonSerializer.Serialize(obj)` → `JsonSerializer.Serialize(obj, MyProjectJsonContext.Default.TypeName)`\n   - `JsonSerializer.Deserialize\u003CT>(json)` → `JsonSerializer.Deserialize(json, MyProjectJsonContext.Default.TypeName)`\n\n   Find and update all call sites in one pass:\n   ```bash\n   # Find all files with JsonSerializer calls\n   grep -rl 'JsonSerializer\\.\\(Serialize\\|Deserialize\\)' src\u002F --include='*.cs'\n   ```\n   Then use sequential `edit` calls to apply the same transformation to every matching file. **Do not use `sed` for C# code** — generics like `Deserialize\u003CT>()` have angle brackets and nested parentheses that sed will mangle.\n\n4. **Build once** to verify. Remaining warnings will be non-serialization issues — handle those with Strategies A–B or D.\n\n#### Strategy D: `[RequiresUnreferencedCode]` (last resort)\n\nWhen a method fundamentally requires arbitrary reflection that cannot be statically described:\n\n```csharp\n[RequiresUnreferencedCode(\"Loads plugins by name using Assembly.Load\")]\npublic void LoadPlugin(string assemblyName) {\n    var asm = Assembly.Load(assemblyName);\n    \u002F\u002F ...\n}\n```\n\nThis propagates to callers — they must also be annotated with `[RequiresUnreferencedCode]`. Use sparingly; it marks the entire call chain as trim-incompatible.\n\n### Step 5: Rebuild and repeat\n\nAfter each small batch of fixes (5-10 warnings), rebuild with `--no-incremental` and check for new warnings. **Do not attempt to fix all warnings before rebuilding** — frequent rebuilds catch mistakes early and reveal cascading warnings. Fixes cascade — annotating an inner method may surface warnings in its callers. Repeat until `0 Warning(s)`.\n\n### Step 6: Validate all TFMs\n\nBuild all target frameworks to ensure:\n- **0 IL warnings** on net8.0+ TFMs\n- **No NETSDK1210 warnings** (the `IsAotCompatible` condition handles this)\n- **Clean builds** on older TFMs (netstandard2.0, net472, etc.)\n\n```bash\ndotnet build \u003Cproject.csproj>  # builds all TFMs\n```\n\n## Stop Signals\n\n- **Do not analyze more than 2-3 representative files per warning pattern.** After identifying the fix for a pattern, apply it to all matching files without reading each one first.\n- **Start fixing after one build.** Do not do a second analysis pass — begin implementing fixes for the most common warning pattern immediately after Step 3 triage.\n- Stop after achieving **0 IL warnings** for net8.0+ TFMs. Don't optimize or refactor already-clean annotations.\n- If a warning requires **architectural refactoring** beyond annotation flow fixes (e.g., replacing an entire serialization layer), document it and stop — don't rewrite large subsystems.\n- Limit to **3 build-fix iterations** per warning. If annotation flow doesn't resolve it after 3 attempts, escalate to `[RequiresUnreferencedCode]`.\n- Don't chase warnings in **third-party dependencies** you can't modify. Note them and move on.\n- If the user asked a scoped question (e.g., \"fix warnings in this file\"), don't expand to the entire project.\n\n## Polyfills for Older TFMs\n\nFor multi-targeting projects that include netstandard2.0 or net472, you need polyfills for `DynamicallyAccessedMembersAttribute` and related types. See [references\u002Fpolyfills.md](references\u002Fpolyfills.md).\n\n## Common Gotchas\n\n1. **External types without AOT-safe serialization**: When a type comes from a dependency you can't modify (e.g., `ResponseError` from `Azure.Core`) and it lacks a source-generated serializer, `Options.GetConverter\u003CT>()` is reflection-based and will produce IL warnings. First check if the type implements `IJsonModel\u003CT>` (common in Azure SDK) — if so, bypass `JsonSerializer` entirely:\n\n```csharp\n\u002F\u002F Before (IL2026 — JsonSerializer uses reflection):\nJsonSerializer.Serialize(writer, errorValue);\n\n\u002F\u002F After (AOT-safe — uses IJsonModel directly):\n((IJsonModel\u003CResponseError>)errorValue).Write(writer, ModelReaderWriterOptions.Json);\n\n\u002F\u002F For deserialization:\nvar error = ((IJsonModel\u003CResponseError>)new ResponseError()).Create(ref reader, ModelReaderWriterOptions.Json);\n```\n\nDo **not** add the external type to your `JsonSerializerContext` — it won't source-generate for types you don't own. If the type doesn't implement `IJsonModel\u003CT>`, write a custom `JsonConverter\u003CT>` with manual `Utf8JsonReader`\u002F`Utf8JsonWriter` logic and register it via `[JsonSourceGenerationOptions]` on your context.\n\n2. **Serialization libraries**: Most reflection-based serializers (e.g., `Newtonsoft.Json`, `XmlSerializer`) are not AOT-compatible. Migrate to a source-generation-based serializer such as `System.Text.Json` with a `JsonSerializerContext`. If migration is not feasible, mark the serialization call site with `[RequiresUnreferencedCode]`.\n\n3. **Shared projects \u002F projitems**: When source is shared between multiple projects via `\u003CImport>`, annotations added to shared code affect ALL consuming projects. Verify that all consumers still build cleanly.\n\n## References\n\n[Limitations](https:\u002F\u002Flearn.microsoft.com\u002Fen-us\u002Fdotnet\u002Fcore\u002Fdeploying\u002Fnative-aot\u002F?tabs=windows%2Cnet8#limitations-of-native-aot-deployment)\n[Conceptual: Understanding trimming](https:\u002F\u002Flearn.microsoft.com\u002Fen-us\u002Fdotnet\u002Fcore\u002Fdeploying\u002Ftrimming\u002Ftrimming-concepts)\n[How-to: trim compat](https:\u002F\u002Flearn.microsoft.com\u002Fen-us\u002Fdotnet\u002Fcore\u002Fdeploying\u002Ftrimming\u002Ffixing-warnings)\n\n## Checklist\n\n- [ ] Added `\u003CIsAotCompatible>` with TFM condition to .csproj\n- [ ] Built with AOT analyzers enabled (net8.0+ TFM)\n- [ ] Fixed all IL warnings via annotations or refactoring\n- [ ] No `#pragma warning disable` or `[UnconditionalSuppressMessage]` used for any IL warning\n- [ ] Polyfills present for older TFMs if needed\n- [ ] All target frameworks build with 0 warnings\n- [ ] Verified shared\u002Flinked source doesn't break sibling projects\n","\u003C!-- cratis-ai-managed: skills\u002Fdotnet-aot-compat\u002FSKILL.md -->\n\n\u003C!-- Modified by Cratis from dotnet's original (MIT): frontmatter, applicability, navigation and the changes listed in NOTICE. Upstream: https:\u002F\u002Fgithub.com\u002Fdotnet\u002Fskills (plugins\u002Fdotnet-upgrade\u002Fskills\u002Fdotnet-aot-compat\u002FSKILL.md; see NOTICE) -->\n\n# dotnet-aot-compat\n\nCratis rules in `.cratis\u002Fai\u002Frules\u002F` (including `csharp.md`, `specs.csharp.md`, and `orleans.md`) and the `cratis-*` skills win where they differ. Arc host trimming\u002FNativeAOT setup belongs to **cratis-arc-hosting**.\n\nMake .NET projects compatible with Native AOT and trimming by systematically resolving all IL trim\u002FAOT analyzer warnings.\n\n## When to Use This Skill\n\n- **\"Make this project AOT-compatible\"**\n- **\"Fix trimming warnings\"** or **\"fix IL warnings\"**\n- **\"Resolve IL2070 \u002F IL2067 \u002F IL2072 \u002F IL2026 \u002F IL3050 warnings\"**\n- **\"Add DynamicallyAccessedMembers annotations\"**\n- **\"Enable IsAotCompatible in my .csproj\"**\n- **\"My project has trim analyzer warnings after upgrading to net8.0\"**\n- **\"Annotate reflection code for the trimmer\"**\n\n## When Not to Use This Skill\n\nDo not use this skill when the project exclusively targets .NET Framework (net4x), which does not support the trim\u002FAOT analyzers.\n\n## Prerequisites\n\nAn existing .NET project targeting net8.0 or later (or multi-targeting with at least one net8.0+ TFM) and the corresponding .NET SDK installed.\n\n## Background: What AOT Compatibility Means\n\nNative AOT and the IL trimmer perform static analysis to determine what code is reachable. Reflection can break this analysis because the trimmer can't see what types\u002Fmembers are accessed at runtime. The `IsAotCompatible` property enables analyzers that flag these issues as build warnings (ILXXXX codes).\n\n## Critical Rules\n\n### ❌ Never suppress warnings incorrectly\n\n- **NEVER** use `#pragma warning disable` for IL warnings. It hides warnings from the Roslyn analyzer at build time, but the IL linker and AOT compiler still see the issue. The code will fail at trim\u002Fpublish time.\n- **NEVER** use `[UnconditionalSuppressMessage]`. It tells both the analyzer AND the linker to ignore the warning, meaning the trimmer cannot verify safety. Raising an error at build time is always preferable to hiding the issue and having it silently break at runtime.\n\n### ? Preferred approaches\n\n- **Prefer** `[DynamicallyAccessedMembers]` annotations to flow type information through the call chain.\n- **Prefer** refactoring to eliminate patterns that break annotation flow (e.g., boxing `Type` through `object[]`).\n- **Use** `[RequiresUnreferencedCode]` \u002F `[RequiresDynamicCode]` \u002F `[RequiresAssemblyFiles]` to mark methods as fundamentally incompatible with trimming, propagating the requirement to callers. This surfaces the issue clearly rather than hiding it — callers must explicitly acknowledge the incompatibility.\n\n### Annotation flow is key\n\nThe trimmer tracks `[DynamicallyAccessedMembers]` annotations through assignments, parameter passing, and return values. If this flow is broken (e.g., by boxing a `Type` into `object`, storing in an untyped collection, or casting through interfaces), the trimmer loses track and warns. The fix is to preserve the flow, not suppress the warning.\n\n## Step-by-Step Procedure\n\n> **Do not explore the codebase up-front.** The build warnings tell you exactly which files and lines need changes. Follow a tight loop: **build → pick a warning → open that file at that line → apply the fix recipe → rebuild**. Reading or analyzing source files beyond what a specific warning points you to is wasted effort and leads to timeouts. Let the compiler guide you.\n>\n> ❌ Do NOT run `find`, `ls`, or `grep` to understand the project structure before building. Do NOT read README, docs, or architecture files. Your first action should be Step 1 (enable AOT analysis), then build.\n\n### Step 1: Enable AOT analysis in the .csproj\n\nAdd `IsAotCompatible`. If the project doesn't exclusively target net8.0+, add a TFM condition (AOT analysis requires net8.0+):\n\n```xml\n\u003CPropertyGroup>\n  \u003CIsAotCompatible Condition=\"$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0'))\">true\u003C\u002FIsAotCompatible>\n\u003C\u002FPropertyGroup>\n```\n\nThis automatically sets `EnableTrimAnalyzer=true` and `EnableAotAnalyzer=true` for compatible TFMs. For multi-targeting projects (e.g., `netstandard2.0;net8.0`), the condition ensures no `NETSDK1210` warnings on older TFMs.\n\n### Step 2: Build and collect warnings\n\n```bash\ndotnet build \u003Cproject.csproj> -f \u003Cnet8.0-or-later-tfm> --no-incremental 2>&1 | grep 'IL[0-9]\\{4\\}'\n```\n\nSort and deduplicate. Common warning codes:\n- **IL2070**: Reflection call on a `Type` parameter missing `[DynamicallyAccessedMembers]`\n- **IL2067**: Passing an unannotated `Type` to a method expecting `[DynamicallyAccessedMembers]`\n- **IL2072**: Return value or extracted value missing annotation (often from unboxing)\n- **IL2057**: `Type.GetType(string)` with a non-constant argument\n- **IL2026**: Calling a method marked `[RequiresUnreferencedCode]`\n- **IL2050**: P\u002Finvoke method with COM marshalling parameters\n- **IL2075**: Return value flows into reflection without annotation\n- **IL2091**: Generic argument missing `[DynamicallyAccessedMembers]` required by constraint\n- **IL3000**: `Assembly.Location` returns empty string in single-file\u002FAOT apps\n- **IL3050**: Calling a method marked `[RequiresDynamicCode]`\n\n### Step 3: Triage warnings by code (do NOT read every file)\n\nGroup the warnings from Step 2 by warning code and count them. **Do not open individual files yet.** Identify the top 1-2 patterns by count — these drive your fix strategy:\n\n| Pattern | Typical fix |\n|---------|-------------|\n| Many IL2026 + IL3050 from `JsonSerializer` | **Go to Strategy C immediately** — create a `JsonSerializerContext`, then batch-update all call sites |\n| IL2070\u002FIL2087 on `Type` parameters | Add `[DynamicallyAccessedMembers]` to the innermost method, then cascade outward |\n| IL2067 passing unannotated `Type` | Annotate the parameter at the source |\n\n**In most real projects, IL2026\u002FIL3050 from JsonSerializer dominate.** Start with Strategy C unless the warning breakdown clearly shows otherwise. After the batch JSON fix, handle remaining warnings with Strategies A–B. Only use Strategy D as a last resort.\n\n### Step 4: Fix warnings iteratively (innermost first)\n\nWork from the **innermost** reflection call outward. Each fix may cascade new warnings to callers.\n\n**Stay warning-driven.** For each warning, open only the file and line the compiler reported, identify the pattern, apply the matching fix recipe below, and move on. Do not scan the codebase for similar patterns or try to understand the full architecture — fix what the compiler tells you, rebuild, and let new warnings guide the next change. Fix a small batch of warnings (5-10), then rebuild immediately to check progress.\n\n**Use sub-agents when available.** If you can launch sub-agents (e.g., via a `task` tool), dispatch **multiple sub-agents in parallel** to edit different files simultaneously. Keep the main loop focused on building, parsing warnings, and dispatching — delegate actual file edits to sub-agents. For batch JSON updates, give each sub-agent 5-10 files to update in one prompt. **After 2 build-fix cycles, dispatch all remaining file edits to sub-agents in parallel — do not continue fixing files sequentially.** Example:\n\n> Update these files to use source-generated JSON: `src\u002FModels\u002FResource.Serialization.cs`, `src\u002FModels\u002FIdentity.Serialization.cs`, `src\u002FModels\u002FPlan.Serialization.cs`. In each file, replace `JsonSerializer.Serialize(writer, value)` with `JsonSerializer.Serialize(writer, value, MyProjectJsonContext.Default.TypeName)` and `JsonSerializer.Deserialize\u003CT>(ref reader)` with `JsonSerializer.Deserialize(ref reader, MyProjectJsonContext.Default.TypeName)`. Only edit the JsonSerializer call sites.\n\n#### Strategy A: Add `[DynamicallyAccessedMembers]` (preferred)\n\nWhen a method uses reflection on a `Type` parameter, annotate the parameter to tell the trimmer what members are needed:\n\n```csharp\nusing System.Diagnostics.CodeAnalysis;\n\n\u002F\u002F Before (warns IL2070):\nvoid Process(Type t) {\n    var method = t.GetMethod(\"Foo\");  \u002F\u002F trimmer can't verify\n}\n\n\u002F\u002F After (clean):\nvoid Process([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] Type t) {\n    var method = t.GetMethod(\"Foo\");  \u002F\u002F trimmer preserves public methods\n}\n```\n\nWhen you annotate a parameter, **all callers** must now pass properly annotated types. This cascades outward — follow each caller and annotate or refactor as needed. **The caller's annotation must include at least the same member types as the callee's.** If the callee requires `PublicConstructors | NonPublicConstructors`, the caller must specify the same or a superset — using only `NonPublicConstructors` will produce IL2091.\n\n#### Strategy B: Refactor to preserve annotation flow\n\nWhen annotation flow is broken by boxing (storing `Type` in `object`, `object[]`, or untyped collections), **refactor** to pass the `Type` directly:\n\n```csharp\n\u002F\u002F BROKEN: Type boxed into object[], annotation lost\nvoid Process(object[] args) {\n    Type t = (Type)args[0];  \u002F\u002F IL2072: annotation lost through boxing\n    Evaluate(t, ...);\n}\n\n\u002F\u002F FIXED: Pass Type as a separate, annotated parameter\nvoid Process(\n    object[] args,\n    [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] Type calleeType,\n    ...) {\n    Evaluate(calleeType, ...);  \u002F\u002F annotation flows cleanly\n}\n```\n\nCommon patterns that break flow and how to fix them:\n- **`object[]` parameter bags**: Extract the `Type` into a dedicated annotated parameter\n- **Dictionary\u002FList storage**: Use a typed field with annotation instead\n- **Interface indirection**: Add annotation to the interface method's parameter\n- **Property with boxing getter**: Annotate the property's return type\n\n#### Strategy C: Source-generated JSON serialization (batch fix)\n\nWhen most warnings are IL2026\u002FIL3050 from `JsonSerializer.Serialize`\u002F`Deserialize`, this is a single mechanical fix applied in bulk:\n\n1. **Collect affected types** — grep for all `JsonSerializer.Serialize` and `JsonSerializer.Deserialize` call sites. Extract the type being serialized (the `\u003CT>` in `Deserialize\u003CT>`, or the runtime type of the object in `Serialize`).\n\n2. **Create one `JsonSerializerContext`** with `[JsonSerializable]` for every type found. **Skip types from external packages** (e.g., `ResponseError` from `Azure.Core`) — they won't source-generate for types you don't own. Handle external types separately via Gotcha #1 below.\n\n```csharp\n[JsonSerializable(typeof(ManagedServiceIdentity))]\n[JsonSerializable(typeof(SystemData))]\n\u002F\u002F ... one attribute per type YOU OWN\n\u002F\u002F Do NOT add types from external packages (e.g., ResponseError)\ninternal partial class MyProjectJsonContext : JsonSerializerContext { }\n```\n\n3. **Batch-update all call sites** — do not read each file individually. Apply the pattern mechanically:\n   - `JsonSerializer.Serialize(obj)` → `JsonSerializer.Serialize(obj, MyProjectJsonContext.Default.TypeName)`\n   - `JsonSerializer.Deserialize\u003CT>(json)` → `JsonSerializer.Deserialize(json, MyProjectJsonContext.Default.TypeName)`\n\n   Find and update all call sites in one pass:\n   ```bash\n   # Find all files with JsonSerializer calls\n   grep -rl 'JsonSerializer\\.\\(Serialize\\|Deserialize\\)' src\u002F --include='*.cs'\n   ```\n   Then use sequential `edit` calls to apply the same transformation to every matching file. **Do not use `sed` for C# code** — generics like `Deserialize\u003CT>()` have angle brackets and nested parentheses that sed will mangle.\n\n4. **Build once** to verify. Remaining warnings will be non-serialization issues — handle those with Strategies A–B or D.\n\n#### Strategy D: `[RequiresUnreferencedCode]` (last resort)\n\nWhen a method fundamentally requires arbitrary reflection that cannot be statically described:\n\n```csharp\n[RequiresUnreferencedCode(\"Loads plugins by name using Assembly.Load\")]\npublic void LoadPlugin(string assemblyName) {\n    var asm = Assembly.Load(assemblyName);\n    \u002F\u002F ...\n}\n```\n\nThis propagates to callers — they must also be annotated with `[RequiresUnreferencedCode]`. Use sparingly; it marks the entire call chain as trim-incompatible.\n\n### Step 5: Rebuild and repeat\n\nAfter each small batch of fixes (5-10 warnings), rebuild with `--no-incremental` and check for new warnings. **Do not attempt to fix all warnings before rebuilding** — frequent rebuilds catch mistakes early and reveal cascading warnings. Fixes cascade — annotating an inner method may surface warnings in its callers. Repeat until `0 Warning(s)`.\n\n### Step 6: Validate all TFMs\n\nBuild all target frameworks to ensure:\n- **0 IL warnings** on net8.0+ TFMs\n- **No NETSDK1210 warnings** (the `IsAotCompatible` condition handles this)\n- **Clean builds** on older TFMs (netstandard2.0, net472, etc.)\n\n```bash\ndotnet build \u003Cproject.csproj>  # builds all TFMs\n```\n\n## Stop Signals\n\n- **Do not analyze more than 2-3 representative files per warning pattern.** After identifying the fix for a pattern, apply it to all matching files without reading each one first.\n- **Start fixing after one build.** Do not do a second analysis pass — begin implementing fixes for the most common warning pattern immediately after Step 3 triage.\n- Stop after achieving **0 IL warnings** for net8.0+ TFMs. Don't optimize or refactor already-clean annotations.\n- If a warning requires **architectural refactoring** beyond annotation flow fixes (e.g., replacing an entire serialization layer), document it and stop — don't rewrite large subsystems.\n- Limit to **3 build-fix iterations** per warning. If annotation flow doesn't resolve it after 3 attempts, escalate to `[RequiresUnreferencedCode]`.\n- Don't chase warnings in **third-party dependencies** you can't modify. Note them and move on.\n- If the user asked a scoped question (e.g., \"fix warnings in this file\"), don't expand to the entire project.\n\n## Polyfills for Older TFMs\n\nFor multi-targeting projects that include netstandard2.0 or net472, you need polyfills for `DynamicallyAccessedMembersAttribute` and related types. See [references\u002Fpolyfills.md](references\u002Fpolyfills.md).\n\n## Common Gotchas\n\n1. **External types without AOT-safe serialization**: When a type comes from a dependency you can't modify (e.g., `ResponseError` from `Azure.Core`) and it lacks a source-generated serializer, `Options.GetConverter\u003CT>()` is reflection-based and will produce IL warnings. First check if the type implements `IJsonModel\u003CT>` (common in Azure SDK) — if so, bypass `JsonSerializer` entirely:\n\n```csharp\n\u002F\u002F Before (IL2026 — JsonSerializer uses reflection):\nJsonSerializer.Serialize(writer, errorValue);\n\n\u002F\u002F After (AOT-safe — uses IJsonModel directly):\n((IJsonModel\u003CResponseError>)errorValue).Write(writer, ModelReaderWriterOptions.Json);\n\n\u002F\u002F For deserialization:\nvar error = ((IJsonModel\u003CResponseError>)new ResponseError()).Create(ref reader, ModelReaderWriterOptions.Json);\n```\n\nDo **not** add the external type to your `JsonSerializerContext` — it won't source-generate for types you don't own. If the type doesn't implement `IJsonModel\u003CT>`, write a custom `JsonConverter\u003CT>` with manual `Utf8JsonReader`\u002F`Utf8JsonWriter` logic and register it via `[JsonSourceGenerationOptions]` on your context.\n\n2. **Serialization libraries**: Most reflection-based serializers (e.g., `Newtonsoft.Json`, `XmlSerializer`) are not AOT-compatible. Migrate to a source-generation-based serializer such as `System.Text.Json` with a `JsonSerializerContext`. If migration is not feasible, mark the serialization call site with `[RequiresUnreferencedCode]`.\n\n3. **Shared projects \u002F projitems**: When source is shared between multiple projects via `\u003CImport>`, annotations added to shared code affect ALL consuming projects. Verify that all consumers still build cleanly.\n\n## References\n\n[Limitations](https:\u002F\u002Flearn.microsoft.com\u002Fen-us\u002Fdotnet\u002Fcore\u002Fdeploying\u002Fnative-aot\u002F?tabs=windows%2Cnet8#limitations-of-native-aot-deployment)\n[Conceptual: Understanding trimming](https:\u002F\u002Flearn.microsoft.com\u002Fen-us\u002Fdotnet\u002Fcore\u002Fdeploying\u002Ftrimming\u002Ftrimming-concepts)\n[How-to: trim compat](https:\u002F\u002Flearn.microsoft.com\u002Fen-us\u002Fdotnet\u002Fcore\u002Fdeploying\u002Ftrimming\u002Ffixing-warnings)\n\n## Checklist\n\n- [ ] Added `\u003CIsAotCompatible>` with TFM condition to .csproj\n- [ ] Built with AOT analyzers enabled (net8.0+ TFM)\n- [ ] Fixed all IL warnings via annotations or refactoring\n- [ ] No `#pragma warning disable` or `[UnconditionalSuppressMessage]` used for any IL warning\n- [ ] Polyfills present for older TFMs if needed\n- [ ] All target frameworks build with 0 warnings\n- [ ] Verified shared\u002Flinked source doesn't break sibling projects\n",{"name":5,"license":15,"description":7},"main","c392076c8b3fae3b8b31e7d5684d71f9be75e8bb",".cratis\u002Fai\u002Fskills\u002Fdotnet-aot-compat","https:\u002F\u002Fgithub.com\u002FCratis\u002FSpecifications","https:\u002F\u002Fwww.cratis.io\u002Fspecifications\u002F","https:\u002F\u002Fgithub.com\u002FCratis","https:\u002F\u002Fwww.cratis.io","Open-source (MIT) event sourcing and CQRS for .NET and beyond: Chronicle, Arc, Components and Screenplay.","2026-11-14 15:53:54",{"source":9,"skillName":5,"commands":51,"prompt":61,"zipAvailable":62},[52,55,58],{"tool":53,"command":54},"npx","npx skills add Cratis\u002FSpecifications --skill dotnet-aot-compat",{"tool":56,"command":57},"bunx","bunx skills add Cratis\u002FSpecifications --skill dotnet-aot-compat",{"tool":59,"command":60},"pnpm","pnpm dlx skills add Cratis\u002FSpecifications --skill dotnet-aot-compat","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FCratis\u002FSpecifications\u002Fblob\u002Fmain\u002F.cratis\u002Fai\u002Fskills\u002Fdotnet-aot-compat\u002FSKILL.md",true,[64,70,74,80,86,90,96,100],{"path":65,"resourceType":66,"resourceTypeDesc":67,"sizeBytes":68,"sourceHtmlUrl":69},"assets\u002FREADME.md","ASSET","资产文件",354,"https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Fplugins-community\u002Fplugins\u002Fdatabase\u002Fdatabase-diff-tool\u002Fskills\u002Fcomparing-database-schemas\u002Fassets\u002FREADME.md",{"path":71,"resourceType":71,"resourceTypeDesc":72,"sizeBytes":73,"sourceHtmlUrl":16},"LICENSE","许可证",1170,{"path":75,"resourceType":76,"resourceTypeDesc":77,"sizeBytes":78,"sourceHtmlUrl":79},"NOTICE","OTHER","其他",1054,"https:\u002F\u002Fgithub.com\u002FCratis\u002FSpecifications\u002Fblob\u002Fmain\u002F.cratis\u002Fai\u002Fskills\u002Fdotnet-aot-compat\u002FNOTICE",{"path":81,"resourceType":82,"resourceTypeDesc":83,"sizeBytes":84,"sourceHtmlUrl":85},"references\u002Fpolyfills.md","REFERENCE","参考文档",1702,"https:\u002F\u002Fgithub.com\u002FCratis\u002FSpecifications\u002Fblob\u002Fmain\u002F.cratis\u002Fai\u002Fskills\u002Fdotnet-aot-compat\u002Freferences\u002Fpolyfills.md",{"path":87,"resourceType":82,"resourceTypeDesc":83,"sizeBytes":88,"sourceHtmlUrl":89},"references\u002FREADME.md",480,"https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Fplugins-community\u002Fplugins\u002Fdatabase\u002Fdatabase-diff-tool\u002Fskills\u002Fcomparing-database-schemas\u002Freferences\u002FREADME.md",{"path":91,"resourceType":92,"resourceTypeDesc":93,"sizeBytes":94,"sourceHtmlUrl":95},"scripts\u002Fgenerate_migration_script.py","SCRIPT","脚本",3664,"https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Fplugins-community\u002Fplugins\u002Fdatabase\u002Fdatabase-diff-tool\u002Fskills\u002Fcomparing-database-schemas\u002Fscripts\u002Fgenerate_migration_script.py",{"path":97,"resourceType":92,"resourceTypeDesc":93,"sizeBytes":98,"sourceHtmlUrl":99},"scripts\u002FREADME.md",348,"https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Fplugins-community\u002Fplugins\u002Fdatabase\u002Fdatabase-diff-tool\u002Fskills\u002Fcomparing-database-schemas\u002Fscripts\u002FREADME.md",{"path":101,"resourceType":92,"resourceTypeDesc":93,"sizeBytes":102,"sourceHtmlUrl":103},"scripts\u002Frollback_migration.py",2847,"https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Fplugins-community\u002Fplugins\u002Fdatabase\u002Fdatabase-diff-tool\u002Fskills\u002Fcomparing-database-schemas\u002Fscripts\u002Frollback_migration.py",[105,127,149,180,205,222],{"skillNo":106,"name":107,"nameZh":108,"description":109,"descriptionZh":110,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":10,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":111,"sourceHtmlUrl":112,"categories":113,"keywords":118,"publishedAt":36},"01M6BXWPJZ1W4FTAZ7N0B718XQ","vectorization",".NET SIMD 向量化代码","Designs, implements, optimizes, and reviews SIMD code in .NET: vectorizing scalar loops with TensorPrimitives, Vector64, Vector128, Vector256, Vector512, or hardware intrinsics, and reviewing existing SIMD code, including the generic Vector type, for contract equivalence, tail handling, memory safety, portability, fallbacks, and measured performance. Use when a .NET loop or SIMD routine is being written or reviewed. Not for performance work unrelated to SIMD.","设计、实现、优化和审查 .NET 中的 SIMD 代码：使用 TensorPrimitives、Vector64、Vector128、Vector256、Vector512 或硬件内部函数将标量循环向量化，并审查现有 SIMD 代码（包括泛型 Vector 类型）的契约等价性、尾部处理、内存安全性、可移植性、回退方案和实测性能。当正在编写或审查 .NET 循环或 SIMD 例程时使用。不用于与 SIMD 无关的性能工作。","https:\u002F\u002Fgithub.com\u002FCratis\u002FSpecifications\u002Fblob\u002Fmain\u002F.cratis\u002Fai\u002Fskills\u002Fvectorization\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FCratis\u002FSpecifications\u002Fblob\u002Fmain\u002F.cratis\u002Fai\u002Fskills\u002Fvectorization\u002FSKILL.md",[114,115],{"categoryNo":20,"categoryName":21,"taxonomyType":22,"taxonomyTypeDesc":23},{"categoryNo":116,"categoryName":117,"taxonomyType":27,"taxonomyTypeDesc":28},"01M8C796JZ1YCTM2B2X7TKEWZZ","性能剖析与优化",[107,119,120,121,122,123,124,125,126],"loop","Safety","simd","vector","code","performance","memory safety","memory",{"skillNo":128,"name":129,"nameZh":130,"description":131,"descriptionZh":132,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":10,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":133,"sourceHtmlUrl":134,"categories":135,"keywords":140,"publishedAt":36},"01M6BXWKDP8VKEXE9WN5R8R1E0","target-authoring","MSBuild自定义目标编写","Canonical patterns for writing custom MSBuild targets: DependsOnTargets versus BeforeTargets and AfterTargets, the Build-to-CoreBuild three-level pattern, and the XxxDependsOn chain-extension pattern. Use when diagnosing or fixing custom-target anti-patterns: Directory.Build.targets redefining SDK targets, targets that replace CompileDependsOn instead of extending it, Outputs versus Returns misuse that returns stale results, missing Inputs\u002FOutputs causing needless rebuilds, or missing FileWrites registration. Not for incremental build tuning or general anti-pattern review (use the msbuild skill), or non-MSBuild build systems.","编写自定义 MSBuild target 的规范模式：DependsOnTargets 与 BeforeTargets、AfterTargets 的区别，Build-to-CoreBuild 三级模式，以及 XxxDependsOn 链式扩展模式。用于诊断或修复自定义 target 的反模式：Directory.Build.targets 重新定义 SDK target、target 替换而非扩展 CompileDependsOn、Outputs 与 Returns 误用导致返回过期结果、缺少 Inputs\u002FOutputs 导致不必要的重新构建，或缺少 FileWrites 注册。不适用于增量构建调优或一般反模式审查（使用 msbuild 技能），也不适用于非 MSBuild 构建系统。","https:\u002F\u002Fgithub.com\u002FCratis\u002FSpecifications\u002Fblob\u002Fmain\u002F.cratis\u002Fai\u002Fskills\u002Ftarget-authoring\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FCratis\u002FSpecifications\u002Fblob\u002Fmain\u002F.cratis\u002Fai\u002Fskills\u002Ftarget-authoring\u002FSKILL.md",[136,137],{"categoryNo":20,"categoryName":21,"taxonomyType":22,"taxonomyTypeDesc":23},{"categoryNo":138,"categoryName":139,"taxonomyType":27,"taxonomyTypeDesc":28},"01M8BSTR9G4A4GZ0VB2DFN9490","开发环境与工具链管理",[141,142,143,144,145,146,147,148],"target authoring","msbuild","tuning","incremental build","sdk","review","directory","writing",{"skillNo":150,"name":151,"nameZh":152,"description":153,"descriptionZh":154,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":10,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":155,"sourceHtmlUrl":156,"categories":157,"keywords":164,"publishedAt":36},"01M6BXWG0724RVJDEE4SQBEF8P","run-tests",".NET测试命令执行","Chooses and runs the repository-compatible .NET test command: classic, VSTest, bridged MTP, or native MTP syntax for MSTest, xUnit, NUnit, and TUnit. Use before running .NET tests or answering with a test command or flags: run the tests, one test, class, category, trait or target framework, combined filters, --filter-query, --no-build, --diag, TRX, coverage collection, crash or hang dumps, filter errors, or unrecognized options. Not for platform identification alone (use platform-detection), writing or debugging test code, interpreting a coverage report (use coverage-analysis), CI investigation, migration, or a persistent hot-reload loop.","选择并运行与仓库兼容的 .NET 测试命令：针对 MSTest、xUnit、NUnit 和 TUnit 的 classic、VSTest、bridged MTP 或 native MTP 语法。在运行 .NET 测试或需要给出测试命令\u002F标志时使用：运行全部测试、单个测试、测试类、类别、trait 或目标框架、组合筛选器、--filter-query、--no-build、--diag、TRX、覆盖率收集、崩溃或挂起转储、筛选错误或无法识别的选项。不适用于仅做平台识别（使用 platform-detection）、编写或调试测试代码、解读覆盖率报告（使用 coverage-analysis）、CI 调查、迁移或持续的热重载循环。","https:\u002F\u002Fgithub.com\u002FCratis\u002FSpecifications\u002Fblob\u002Fmain\u002F.cratis\u002Fai\u002Fskills\u002Frun-tests\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FCratis\u002FSpecifications\u002Fblob\u002Fmain\u002F.cratis\u002Fai\u002Fskills\u002Frun-tests\u002FSKILL.md",[158,161],{"categoryNo":159,"categoryName":160,"taxonomyType":22,"taxonomyTypeDesc":23},"01M8BQGD5WG86P4AQ5GPSSKBFR","测试工程师",{"categoryNo":162,"categoryName":163,"taxonomyType":27,"taxonomyTypeDesc":28},"01M8BQJH394GT47X57A9Q8G7HX","测试与质量保障",[165,166,167,168,169,170,33,171,123,172,173,174,175,148,176,177,178,119,179],"run tests","run","collection","detection","ci","repository","report","debugging","mtp","mstest","test","analysis","xunit","nunit","investigation",{"skillNo":181,"name":182,"nameZh":183,"description":184,"descriptionZh":185,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":10,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":186,"sourceHtmlUrl":187,"categories":188,"keywords":191,"publishedAt":36},"01M6BXWCTS8TECDKSYFJT9C445","profiling",".NET 性能剖析","Uses the free official .NET diagnostics CLI tools for profiling and runtime investigation in a repository: CPU, GC pressure, allocation growth, exception storms, lock contention, and slow code. Use when a .NET application needs performance or runtime profiling. Not for replacing realistic performance or load tests with ad-hoc tracing, production heap collection without a pause-risk plan, crash dumps (use dump-collect), or benchmark design (use microbenchmarking).","使用免费的官方 .NET 诊断 CLI 工具在代码仓库中进行性能剖析和运行时调查：CPU、GC 压力、分配增长、异常风暴、锁竞争和慢代码。当 .NET 应用程序需要性能或运行时剖析时使用。不适用于用临时跟踪替代真实的性能或负载测试、无暂停风险计划的生产堆内存采集、崩溃转储（使用 dump-collect），或基准测试设计（使用 microbenchmarking）。","https:\u002F\u002Fgithub.com\u002FCratis\u002FSpecifications\u002Fblob\u002Fmain\u002F.cratis\u002Fai\u002Fskills\u002Fprofiling\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FCratis\u002FSpecifications\u002Fblob\u002Fmain\u002F.cratis\u002Fai\u002Fskills\u002Fprofiling\u002FSKILL.md",[189,190],{"categoryNo":20,"categoryName":21,"taxonomyType":22,"taxonomyTypeDesc":23},{"categoryNo":116,"categoryName":117,"taxonomyType":27,"taxonomyTypeDesc":28},[182,167,192,193,179,194,124,195,196,170,197,198,199,123,200,201,202,203,204],"microbenchmarking","plan","Tools","risk","Production","collect","tracing","benchmark","diagnostics","official","first","cli","design",{"skillNo":206,"name":207,"nameZh":208,"description":209,"descriptionZh":210,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":10,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":211,"sourceHtmlUrl":212,"categories":213,"keywords":216,"publishedAt":36},"01M6BXW9N4G1NTMKNVBECTM2GM","platform-detection",".NET 测试平台识别","Identifies a .NET project's test platform, framework, command mode, and SDK-style versus classic project system, resolving global.json, project, packages.config, Directory.Build.props, and Directory.Packages.props precedence for MSTest, xUnit, NUnit, and TUnit. Use when asking \"which test platform or framework?\", \"VSTest or MTP?\", or \"what runner does this project use?\", including bridge settings, UseVSTest opt-outs, and conflicting VSTest\u002FMTP configuration. Not for running or filtering tests, commands, flags, TRX, dumps, or test-command errors (use run-tests), or for hot-reload or migration requests.","识别 .NET 项目的测试平台、框架、命令模式，以及 SDK 样式与经典项目系统，并解析 global.json、项目文件、packages.config、Directory.Build.props 和 Directory.Packages.props 对 MSTest、xUnit、NUnit 和 TUnit 的优先级。当询问“使用哪种测试平台或框架”“VSTest 还是 MTP”或“该项目使用什么测试运行器”时使用，包括桥接设置、UseVSTest 退出选项，以及 VSTest\u002FMTP 配置冲突。不适用于运行或筛选测试、命令、标志、TRX、转储或测试命令错误（使用 run-tests），也不适用于热重载或迁移请求。","https:\u002F\u002Fgithub.com\u002FCratis\u002FSpecifications\u002Fblob\u002Fmain\u002F.cratis\u002Fai\u002Fskills\u002Fplatform-detection\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FCratis\u002FSpecifications\u002Fblob\u002Fmain\u002F.cratis\u002Fai\u002Fskills\u002Fplatform-detection\u002FSKILL.md",[214,215],{"categoryNo":159,"categoryName":160,"taxonomyType":22,"taxonomyTypeDesc":23},{"categoryNo":162,"categoryName":163,"taxonomyType":27,"taxonomyTypeDesc":28},[217,168,173,174,175,145,147,218,177,178,219,220,33,166,221],"platform detection","config","json","system","packages",{"skillNo":223,"name":224,"nameZh":225,"description":226,"descriptionZh":227,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":10,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":228,"sourceHtmlUrl":229,"categories":230,"keywords":237,"publishedAt":36},"01M6BXW4VVFJH0WDPATWMFE9TY","orleans","Orleans 分布式系统设计","Designs Microsoft Orleans systems from each primitive's purpose and failure model: grains, digital twins, state versus databases, transactions, messaging, streams, timers, reminders, Durable Jobs, stateless workers, grain services, startup, and hosting. Use when a task needs an Orleans design decision: inspect version and topology, choose the primitive, implement, and validate. Not for other actor stacks, batch processing, relational-only CRUD, or advice without an Orleans decision.","从每种原语的用途和失效模型出发设计 Microsoft Orleans 系统：grain、数字孪生、状态与数据库、事务、消息传递、流（streams）、计时器（timers）、提醒（reminders）、Durable Jobs（持久作业）、无状态工作进程、grain 服务、启动与托管。当任务需要做出 Orleans 设计决策时使用：检查版本与拓扑、选择原语、实现并验证。不适用于其他 actor 技术栈、批处理、纯关系型 CRUD，或不涉及 Orleans 决策的建议。","https:\u002F\u002Fgithub.com\u002FCratis\u002FSpecifications\u002Fblob\u002Fmain\u002F.cratis\u002Fai\u002Fskills\u002Forleans\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FCratis\u002FSpecifications\u002Fblob\u002Fmain\u002F.cratis\u002Fai\u002Fskills\u002Forleans\u002FSKILL.md",[231,234],{"categoryNo":232,"categoryName":233,"taxonomyType":22,"taxonomyTypeDesc":23},"01M8C4ZVS0ZJKF2T2G58PW5VR2","系统架构师",{"categoryNo":235,"categoryName":236,"taxonomyType":27,"taxonomyTypeDesc":28},"01M8C535MHXGXDSGN98VJTMCSK","系统架构设计模式",[224,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,204],"startup","decision","choose","model","crud","transactions","services","topology","messaging","batch","state","reminders","validate","microsoft","implement"]