[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7D2NZPDPV8RVX74X7B78SVT":3,"skill-same:01M7D2NZPDPV8RVX74X7B78SVT":74},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":14,"repositoryHtmlUrl":27,"repositoryHomepageUrl":6,"ownerHtmlUrl":28,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":29,"install":30,"resources":43},"01M7D2NZPDPV8RVX74X7B78SVT","analyzing-dotnet-performance",null,"Scans .NET code for ~50 performance anti-patterns across async, memory, strings, collections, LINQ, regex, serialization, and I\u002FO with tiered severity classification. Use when analyzing .NET code for optimization opportunities, reviewing hot paths, or auditing allocation-heavy patterns.","itsmejay18\u002FAI-Skills-for-My-Development-Stack","itsmejay18","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F167779943?v=4","01M7CZRFC6DDZA5V2CX8WDSZED","Jay Jemino Ababon ","01M7CZRFCVRNW1SFHSQXEJ3CQN",0,"MIT","https:\u002F\u002Fgithub.com\u002Fitsmejay18\u002FAI-Skills-for-My-Development-Stack\u002Fblob\u002Fmain\u002F20-Performance-Optimization\u002Fanalyzing-dotnet-performance\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: analyzing-dotnet-performance\ndescription: >-\n  Scans .NET code for ~50 performance anti-patterns across async, memory,\n  strings, collections, LINQ, regex, serialization, and I\u002FO with tiered\n  severity classification. Use when analyzing .NET code for optimization\n  opportunities, reviewing hot paths, or auditing allocation-heavy patterns.\nlicense: MIT\n---\n\n# .NET Performance Patterns\n\nScan C#\u002F.NET code for performance anti-patterns and produce prioritized findings with concrete fixes. Patterns sourced from the official .NET performance blog series, distilled to customer-actionable guidance.\n\n## When to Use\n\n- Reviewing C#\u002F.NET code for performance optimization opportunities\n- Auditing hot paths for allocation-heavy or inefficient patterns\n- Systematic scan of a codebase for known anti-patterns before release\n- Second-opinion analysis after manual performance review\n\n## When Not to Use\n\n- **Algorithmic complexity analysis** — this skill targets API usage patterns, not algorithm design\n- **Code not on a hot path** with no performance requirements — avoid premature optimization\n\n## Inputs\n\n| Input | Required | Description |\n|-------|----------|-------------|\n| Source code | Yes | C# files, code blocks, or repository paths to scan |\n| Hot-path context | Recommended | Which code paths are performance-critical |\n| Target framework | Recommended | .NET version (some patterns require .NET 8+) |\n| Scan depth | Optional | `critical-only`, `standard` (default), or `comprehensive` |\n\n## Workflow\n\n### Step 1: Load Critical Reference\n\nResolve bundled paths from the directory that contains this `SKILL.md`, not from the user's workspace. Load this reference file first:\n\n- `references\u002Fcritical-patterns.md`\n\nIf a direct read fails, list this skill's `references\u002F` directory once and retry only when the listing shows the expected file. Do not use workspace file or text search to locate the skill installation.\n\n### Step 2: Detect Code Signals and Select Topic Recipes\n\nScan the code for signals that indicate which pattern categories to check. Use the `## Detection` section from the critical reference when available and the inline recipes in Step 3 for initial signal detection.\n\nAfter detecting signals, load only the topic-specific references selected by scan depth:\n\n- `critical-only`: No additional references (use only `critical-patterns.md`)\n- `standard` (default): Load references matching detected signals from this list:\n  - `references\u002Fasync-patterns.md` — async\u002FTask\u002FValueTask signals\n  - `references\u002Fmemory-and-strings.md` — Span\u002FMemory\u002Fstring allocation signals\n  - `references\u002Fregex-patterns.md` — Regex signals\n  - `references\u002Fcollections-and-linq.md` — Dictionary\u002FList\u002FLINQ signals\n  - `references\u002Fio-and-serialization.md` — JsonSerializer\u002FHttpClient\u002FStream signals\n  - `references\u002Fstructural-patterns.md` — always loaded (unsealed classes checked regardless)\n- `comprehensive`: Load all six topic-specific references above\n\nFor coverage reporting, the selected references are `references\u002Fcritical-patterns.md` plus only the topic-specific references selected above. If any selected reference remains unavailable after retry, use the inline recipes in Step 3 for the missing coverage. Include `Reference coverage: reduced; unavailable: \u003Cpaths>; used inline recipes for missing references.` in the final report, with `\u003Cpaths>` replaced by the missing relative paths of the selected references only.\n\nUse the `## Detection` sections from loaded reference files and the inline recipes in Step 3 for categories whose reference files are unavailable.\n\n| Signal in Code | Topic |\n|----------------|-------|\n| `async`, `await`, `Task`, `ValueTask` | Async patterns |\n| `Span\u003C`, `Memory\u003C`, `stackalloc`, `ArrayPool`, `string.Substring`, `.Replace(`, `.ToLower()`, `+=` in loops, `params` | Memory & strings |\n| `Regex`, `[GeneratedRegex]`, `Regex.Match`, `RegexOptions.Compiled` | Regex patterns |\n| `Dictionary\u003C`, `List\u003C`, `.ToList()`, `.Where(`, `.Select(`, LINQ methods, `static readonly Dictionary\u003C` | Collections & LINQ |\n| `JsonSerializer`, `HttpClient`, `Stream`, `FileStream` | I\u002FO & serialization |\n\nAlways check structural patterns (unsealed classes) regardless of signals.\n\n**Scan depth controls scope:**\n- `critical-only`: Only critical patterns (deadlocks, >10x regressions)\n- `standard` (default): Critical + detected topic patterns\n- `comprehensive`: All pattern categories\n\n### Step 3: Scan and Report\n\n**For files under 500 lines, read the entire file first** — you'll spot most patterns faster than running individual grep recipes. Use grep to confirm counts and catch patterns you might miss visually.\n\nFor each relevant pattern category, run the detection recipes below. Report exact counts, not estimates.\n\n**Core scan recipes** (run these when reference files aren't available):\n```\n# Strings & memory\ngrep -n '\\.IndexOf(\\\"' FILE                    # Missing StringComparison\ngrep -n '\\.Substring(' FILE                    # Substring allocations\ngrep -En '\\.(StartsWith|EndsWith|Contains)\\s*\\(' FILE  # Missing StringComparison\ngrep -n '\\.ToLower()\\|\\.ToUpper()' FILE        # Culture-sensitive + allocation\ngrep -n '\\.Replace(' FILE                      # Chained Replace allocations\ngrep -n 'params ' FILE                         # params array allocation\n\n# Collections & LINQ\ngrep -n '\\.Select\\|\\.Where\\|\\.OrderBy\\|\\.GroupBy' FILE  # LINQ on hot path\ngrep -n '\\.All\\|\\.Any' FILE                    # LINQ on string\u002Fchar\ngrep -n 'new Dictionary\u003C\\|new List\u003C' FILE      # Per-call allocation\ngrep -n 'static readonly Dictionary\u003C' FILE     # FrozenDictionary candidate\n\n# Regex\ngrep -n 'RegexOptions.Compiled' FILE           # Compiled regex budget\ngrep -n 'new Regex(' FILE                      # Per-call regex\ngrep -n 'GeneratedRegex' FILE                  # Positive: source-gen regex\n\n# Structural\ngrep -n 'public class \\|internal class ' FILE  # Unsealed classes\ngrep -n 'sealed class' FILE                    # Already sealed\ngrep -n ': IEquatable' FILE                    # Positive: struct equality\n```\n\n**Rules:**\n- Run every relevant recipe for the detected pattern categories\n- **Emit a scan execution checklist** before classifying findings — list each recipe and the hit count\n- A result of **0 hits** is valid and valuable (confirms good practice)\n- If reference files were loaded, also run their `## Detection` recipes\n\n**Verify-the-Inverse Rule:** For absence patterns, always count both sides and report the ratio (e.g., \"N of M classes are sealed\"). The ratio determines severity — 0\u002F185 is systematic, 12\u002F15 is a consistency fix.\n\n### Step 3b: Cross-File Consistency Check\n\nIf an optimized pattern is found in one file, check whether sibling files (same directory, same interface, same base class) use the un-optimized equivalent. Flag as 🟡 Moderate with the optimized file as evidence.\n\n### Step 3c: Compound Allocation Check\n\nAfter running scan recipes, look for these multi-allocation patterns that single-line recipes miss:\n\n1. **Branched `.Replace()` chains:** Methods that call `.Replace()` across multiple `if\u002Felse` branches — report total allocation count across all branches, not just per-line.\n2. **Cross-method chaining:** When a public method delegates to another method that itself allocates intermediates (e.g., A calls B which does 3 regex replaces, then A calls C), report the total chain cost as one finding.\n3. **Compound `+=` with embedded allocating calls:** Lines like `result += $\"...{Foo().ToLower()}\"` are 2+ allocations (interpolation + ToLower + concatenation) — flag the compound cost, not just the `.ToLower()`.\n4. **`string.Format` specificity:** Distinguish resource-loaded format strings (not fixable) from compile-time literal format strings (fixable with interpolation). Enumerate the actionable sites.\n\n### Step 4: Classify and Prioritize Findings\n\nAssign each finding a severity:\n\n| Severity | Criteria | Action |\n|----------|----------|--------|\n| 🔴 **Critical** | Deadlocks, crashes, security vulnerabilities, >10x regression | Must fix |\n| 🟡 **Moderate** | 2-10x improvement opportunity, best practice for hot paths | Should fix on hot paths |\n| ℹ️ **Info** | Pattern applies but code may not be on a hot path | Consider if profiling shows impact |\n\n**Prioritization rules:**\n1. If the user identified hot-path code, elevate all findings in that code to their maximum severity\n2. If hot-path context is unknown, report 🔴 Critical findings unconditionally; report 🟡 Moderate findings with a note: _\"Impactful if this code is on a hot path\"_\n3. Never suggest micro-optimizations on code that is clearly not performance-sensitive\n\n**Scale-based severity escalation:**\nWhen the same pattern appears across many instances, escalate severity:\n- 1-10 instances of the same anti-pattern → report at the pattern's base severity\n- 11-50 instances → escalate ℹ️ Info patterns to 🟡 Moderate\n- 50+ instances → escalate to 🟡 Moderate with elevated priority; flag as a codebase-wide systematic issue\n\nAlways report exact counts (from scan recipes), not estimates or agent summaries.\n\n### Step 5: Generate Findings\n\n**Keep findings compact.** Each finding is one short block — not an essay. Group by severity (🔴 → 🟡 → ℹ️), not by file.\n\nFormat per finding:\n\n```\n#### ID. Title (N instances)\n**Impact:** one-line impact statement\n**Files:** file1.cs:L1, file2.cs:L2, ... (list locations, don't build tables)\n**Fix:** one-line description of the change (e.g., \"Add `StringComparison.Ordinal` parameter\")\n**Caveat:** only if non-obvious (version requirement, correctness risk)\n```\n\n**Rules for compact output:**\n- **No ❌\u002F✅ code blocks** for trivial fixes (adding a keyword, parameter, or type change). A one-line fix description suffices.\n- **Only include code blocks** for non-obvious transformations (e.g., replacing a LINQ chain with a foreach loop, or hoisting a closure).\n- **File locations as inline comma-separated list**, not a table. Use `File.cs:L42` format.\n- **No explanatory prose** beyond the Impact line — the severity icon already conveys urgency.\n- **Merge related findings** that share the same fix (e.g., all `.ToLower()` calls go in one finding, not split by file).\n- **Positive findings** in a bullet list, not a table. One line per pattern: `✅ Pattern — evidence`.\n\nEnd with a summary table and disclaimer:\n\n```markdown\n| Severity | Count | Top Issue |\n|----------|-------|-----------|\n| 🔴 Critical | N | ... |\n| 🟡 Moderate | N | ... |\n| ℹ️ Info | N | ... |\n\n> ⚠️ **Disclaimer:** These results are generated by an AI assistant and are non-deterministic. Findings may include false positives, miss real issues, or suggest changes that are incorrect for your specific context. Always verify recommendations with benchmarks and human review before applying changes to production code.\n```\n\n## Validation\n\nBefore delivering results, verify:\n\n- [ ] All critical patterns were checked (from reference files or inline recipes)\n- [ ] Topic-specific recipes run only when matching signals detected\n- [ ] Each finding includes a concrete code fix\n- [ ] Scan execution checklist is complete (all recipes run)\n- [ ] Summary table included at end\n\n## Common Pitfalls\n\n| Pitfall | Correct Approach |\n|---------|-----------------|\n| Flagging every `Dictionary` as needing `FrozenDictionary` | Only flag if the dictionary is never mutated after construction |\n| Suggesting `Span\u003CT>` in async methods | Use `Memory\u003CT>` in async code; `Span\u003CT>` only in sync hot paths |\n| Reporting LINQ outside hot paths | Only flag LINQ in identified hot paths or tight loops; LINQ is acceptable in code that runs infrequently. Since .NET 7, LINQ Min\u002FMax\u002FSum\u002FAverage are vectorized — blanket bans on LINQ are misguided |\n| Suggesting `ConfigureAwait(false)` in app code | Only applicable in library code; not primarily a performance concern |\n| Recommending `ValueTask` everywhere | Only for hot paths with frequent synchronous completion |\n| Flagging `new HttpClient()` in DI services | Check if `IHttpClientFactory` is already in use |\n| Suggesting `[GeneratedRegex]` for dynamic patterns | Only flag when the pattern string is a compile-time literal |\n| Suggesting `CollectionsMarshal.AsSpan` broadly | Only for ultra-hot paths with benchmarked evidence; adds complexity and fragility |\n| Suggesting `unsafe` code for micro-optimizations | Avoid `unsafe` except where absolutely necessary — do not recommend it for micro-optimizations that don't matter. Safe alternatives like `Span\u003CT>`, `stackalloc` in safe context, and `ArrayPool` cover the vast majority of performance needs |\n","# .NET Performance Patterns\n\nScan C#\u002F.NET code for performance anti-patterns and produce prioritized findings with concrete fixes. Patterns sourced from the official .NET performance blog series, distilled to customer-actionable guidance.\n\n## When to Use\n\n- Reviewing C#\u002F.NET code for performance optimization opportunities\n- Auditing hot paths for allocation-heavy or inefficient patterns\n- Systematic scan of a codebase for known anti-patterns before release\n- Second-opinion analysis after manual performance review\n\n## When Not to Use\n\n- **Algorithmic complexity analysis** — this skill targets API usage patterns, not algorithm design\n- **Code not on a hot path** with no performance requirements — avoid premature optimization\n\n## Inputs\n\n| Input | Required | Description |\n|-------|----------|-------------|\n| Source code | Yes | C# files, code blocks, or repository paths to scan |\n| Hot-path context | Recommended | Which code paths are performance-critical |\n| Target framework | Recommended | .NET version (some patterns require .NET 8+) |\n| Scan depth | Optional | `critical-only`, `standard` (default), or `comprehensive` |\n\n## Workflow\n\n### Step 1: Load Critical Reference\n\nResolve bundled paths from the directory that contains this `SKILL.md`, not from the user's workspace. Load this reference file first:\n\n- `references\u002Fcritical-patterns.md`\n\nIf a direct read fails, list this skill's `references\u002F` directory once and retry only when the listing shows the expected file. Do not use workspace file or text search to locate the skill installation.\n\n### Step 2: Detect Code Signals and Select Topic Recipes\n\nScan the code for signals that indicate which pattern categories to check. Use the `## Detection` section from the critical reference when available and the inline recipes in Step 3 for initial signal detection.\n\nAfter detecting signals, load only the topic-specific references selected by scan depth:\n\n- `critical-only`: No additional references (use only `critical-patterns.md`)\n- `standard` (default): Load references matching detected signals from this list:\n  - `references\u002Fasync-patterns.md` — async\u002FTask\u002FValueTask signals\n  - `references\u002Fmemory-and-strings.md` — Span\u002FMemory\u002Fstring allocation signals\n  - `references\u002Fregex-patterns.md` — Regex signals\n  - `references\u002Fcollections-and-linq.md` — Dictionary\u002FList\u002FLINQ signals\n  - `references\u002Fio-and-serialization.md` — JsonSerializer\u002FHttpClient\u002FStream signals\n  - `references\u002Fstructural-patterns.md` — always loaded (unsealed classes checked regardless)\n- `comprehensive`: Load all six topic-specific references above\n\nFor coverage reporting, the selected references are `references\u002Fcritical-patterns.md` plus only the topic-specific references selected above. If any selected reference remains unavailable after retry, use the inline recipes in Step 3 for the missing coverage. Include `Reference coverage: reduced; unavailable: \u003Cpaths>; used inline recipes for missing references.` in the final report, with `\u003Cpaths>` replaced by the missing relative paths of the selected references only.\n\nUse the `## Detection` sections from loaded reference files and the inline recipes in Step 3 for categories whose reference files are unavailable.\n\n| Signal in Code | Topic |\n|----------------|-------|\n| `async`, `await`, `Task`, `ValueTask` | Async patterns |\n| `Span\u003C`, `Memory\u003C`, `stackalloc`, `ArrayPool`, `string.Substring`, `.Replace(`, `.ToLower()`, `+=` in loops, `params` | Memory & strings |\n| `Regex`, `[GeneratedRegex]`, `Regex.Match`, `RegexOptions.Compiled` | Regex patterns |\n| `Dictionary\u003C`, `List\u003C`, `.ToList()`, `.Where(`, `.Select(`, LINQ methods, `static readonly Dictionary\u003C` | Collections & LINQ |\n| `JsonSerializer`, `HttpClient`, `Stream`, `FileStream` | I\u002FO & serialization |\n\nAlways check structural patterns (unsealed classes) regardless of signals.\n\n**Scan depth controls scope:**\n- `critical-only`: Only critical patterns (deadlocks, >10x regressions)\n- `standard` (default): Critical + detected topic patterns\n- `comprehensive`: All pattern categories\n\n### Step 3: Scan and Report\n\n**For files under 500 lines, read the entire file first** — you'll spot most patterns faster than running individual grep recipes. Use grep to confirm counts and catch patterns you might miss visually.\n\nFor each relevant pattern category, run the detection recipes below. Report exact counts, not estimates.\n\n**Core scan recipes** (run these when reference files aren't available):\n```\n# Strings & memory\ngrep -n '\\.IndexOf(\\\"' FILE                    # Missing StringComparison\ngrep -n '\\.Substring(' FILE                    # Substring allocations\ngrep -En '\\.(StartsWith|EndsWith|Contains)\\s*\\(' FILE  # Missing StringComparison\ngrep -n '\\.ToLower()\\|\\.ToUpper()' FILE        # Culture-sensitive + allocation\ngrep -n '\\.Replace(' FILE                      # Chained Replace allocations\ngrep -n 'params ' FILE                         # params array allocation\n\n# Collections & LINQ\ngrep -n '\\.Select\\|\\.Where\\|\\.OrderBy\\|\\.GroupBy' FILE  # LINQ on hot path\ngrep -n '\\.All\\|\\.Any' FILE                    # LINQ on string\u002Fchar\ngrep -n 'new Dictionary\u003C\\|new List\u003C' FILE      # Per-call allocation\ngrep -n 'static readonly Dictionary\u003C' FILE     # FrozenDictionary candidate\n\n# Regex\ngrep -n 'RegexOptions.Compiled' FILE           # Compiled regex budget\ngrep -n 'new Regex(' FILE                      # Per-call regex\ngrep -n 'GeneratedRegex' FILE                  # Positive: source-gen regex\n\n# Structural\ngrep -n 'public class \\|internal class ' FILE  # Unsealed classes\ngrep -n 'sealed class' FILE                    # Already sealed\ngrep -n ': IEquatable' FILE                    # Positive: struct equality\n```\n\n**Rules:**\n- Run every relevant recipe for the detected pattern categories\n- **Emit a scan execution checklist** before classifying findings — list each recipe and the hit count\n- A result of **0 hits** is valid and valuable (confirms good practice)\n- If reference files were loaded, also run their `## Detection` recipes\n\n**Verify-the-Inverse Rule:** For absence patterns, always count both sides and report the ratio (e.g., \"N of M classes are sealed\"). The ratio determines severity — 0\u002F185 is systematic, 12\u002F15 is a consistency fix.\n\n### Step 3b: Cross-File Consistency Check\n\nIf an optimized pattern is found in one file, check whether sibling files (same directory, same interface, same base class) use the un-optimized equivalent. Flag as 🟡 Moderate with the optimized file as evidence.\n\n### Step 3c: Compound Allocation Check\n\nAfter running scan recipes, look for these multi-allocation patterns that single-line recipes miss:\n\n1. **Branched `.Replace()` chains:** Methods that call `.Replace()` across multiple `if\u002Felse` branches — report total allocation count across all branches, not just per-line.\n2. **Cross-method chaining:** When a public method delegates to another method that itself allocates intermediates (e.g., A calls B which does 3 regex replaces, then A calls C), report the total chain cost as one finding.\n3. **Compound `+=` with embedded allocating calls:** Lines like `result += $\"...{Foo().ToLower()}\"` are 2+ allocations (interpolation + ToLower + concatenation) — flag the compound cost, not just the `.ToLower()`.\n4. **`string.Format` specificity:** Distinguish resource-loaded format strings (not fixable) from compile-time literal format strings (fixable with interpolation). Enumerate the actionable sites.\n\n### Step 4: Classify and Prioritize Findings\n\nAssign each finding a severity:\n\n| Severity | Criteria | Action |\n|----------|----------|--------|\n| 🔴 **Critical** | Deadlocks, crashes, security vulnerabilities, >10x regression | Must fix |\n| 🟡 **Moderate** | 2-10x improvement opportunity, best practice for hot paths | Should fix on hot paths |\n| ℹ️ **Info** | Pattern applies but code may not be on a hot path | Consider if profiling shows impact |\n\n**Prioritization rules:**\n1. If the user identified hot-path code, elevate all findings in that code to their maximum severity\n2. If hot-path context is unknown, report 🔴 Critical findings unconditionally; report 🟡 Moderate findings with a note: _\"Impactful if this code is on a hot path\"_\n3. Never suggest micro-optimizations on code that is clearly not performance-sensitive\n\n**Scale-based severity escalation:**\nWhen the same pattern appears across many instances, escalate severity:\n- 1-10 instances of the same anti-pattern → report at the pattern's base severity\n- 11-50 instances → escalate ℹ️ Info patterns to 🟡 Moderate\n- 50+ instances → escalate to 🟡 Moderate with elevated priority; flag as a codebase-wide systematic issue\n\nAlways report exact counts (from scan recipes), not estimates or agent summaries.\n\n### Step 5: Generate Findings\n\n**Keep findings compact.** Each finding is one short block — not an essay. Group by severity (🔴 → 🟡 → ℹ️), not by file.\n\nFormat per finding:\n\n```\n#### ID. Title (N instances)\n**Impact:** one-line impact statement\n**Files:** file1.cs:L1, file2.cs:L2, ... (list locations, don't build tables)\n**Fix:** one-line description of the change (e.g., \"Add `StringComparison.Ordinal` parameter\")\n**Caveat:** only if non-obvious (version requirement, correctness risk)\n```\n\n**Rules for compact output:**\n- **No ❌\u002F✅ code blocks** for trivial fixes (adding a keyword, parameter, or type change). A one-line fix description suffices.\n- **Only include code blocks** for non-obvious transformations (e.g., replacing a LINQ chain with a foreach loop, or hoisting a closure).\n- **File locations as inline comma-separated list**, not a table. Use `File.cs:L42` format.\n- **No explanatory prose** beyond the Impact line — the severity icon already conveys urgency.\n- **Merge related findings** that share the same fix (e.g., all `.ToLower()` calls go in one finding, not split by file).\n- **Positive findings** in a bullet list, not a table. One line per pattern: `✅ Pattern — evidence`.\n\nEnd with a summary table and disclaimer:\n\n```markdown\n| Severity | Count | Top Issue |\n|----------|-------|-----------|\n| 🔴 Critical | N | ... |\n| 🟡 Moderate | N | ... |\n| ℹ️ Info | N | ... |\n\n> ⚠️ **Disclaimer:** These results are generated by an AI assistant and are non-deterministic. Findings may include false positives, miss real issues, or suggest changes that are incorrect for your specific context. Always verify recommendations with benchmarks and human review before applying changes to production code.\n```\n\n## Validation\n\nBefore delivering results, verify:\n\n- [ ] All critical patterns were checked (from reference files or inline recipes)\n- [ ] Topic-specific recipes run only when matching signals detected\n- [ ] Each finding includes a concrete code fix\n- [ ] Scan execution checklist is complete (all recipes run)\n- [ ] Summary table included at end\n\n## Common Pitfalls\n\n| Pitfall | Correct Approach |\n|---------|-----------------|\n| Flagging every `Dictionary` as needing `FrozenDictionary` | Only flag if the dictionary is never mutated after construction |\n| Suggesting `Span\u003CT>` in async methods | Use `Memory\u003CT>` in async code; `Span\u003CT>` only in sync hot paths |\n| Reporting LINQ outside hot paths | Only flag LINQ in identified hot paths or tight loops; LINQ is acceptable in code that runs infrequently. Since .NET 7, LINQ Min\u002FMax\u002FSum\u002FAverage are vectorized — blanket bans on LINQ are misguided |\n| Suggesting `ConfigureAwait(false)` in app code | Only applicable in library code; not primarily a performance concern |\n| Recommending `ValueTask` everywhere | Only for hot paths with frequent synchronous completion |\n| Flagging `new HttpClient()` in DI services | Check if `IHttpClientFactory` is already in use |\n| Suggesting `[GeneratedRegex]` for dynamic patterns | Only flag when the pattern string is a compile-time literal |\n| Suggesting `CollectionsMarshal.AsSpan` broadly | Only for ultra-hot paths with benchmarked evidence; adds complexity and fragility |\n| Suggesting `unsafe` code for micro-optimizations | Avoid `unsafe` except where absolutely necessary — do not recommend it for micro-optimizations that don't matter. Safe alternatives like `Span\u003CT>`, `stackalloc` in safe context, and `ArrayPool` cover the vast majority of performance needs |\n",{"name":5,"license":15,"description":7},"main","30954af1dcd1a74b63f05deb2e2c41e5ecae4a82","20-Performance-Optimization\u002Fanalyzing-dotnet-performance","https:\u002F\u002Fgithub.com\u002Fitsmejay18\u002FAI-Skills-for-My-Development-Stack","https:\u002F\u002Fgithub.com\u002Fitsmejay18","2026-09-18 16:06:36",{"source":8,"skillName":5,"commands":31,"prompt":41,"zipAvailable":42},[32,35,38],{"tool":33,"command":34},"npx","npx skills add itsmejay18\u002FAI-Skills-for-My-Development-Stack --skill analyzing-dotnet-performance",{"tool":36,"command":37},"bunx","bunx skills add itsmejay18\u002FAI-Skills-for-My-Development-Stack --skill analyzing-dotnet-performance",{"tool":39,"command":40},"pnpm","pnpm dlx skills add itsmejay18\u002FAI-Skills-for-My-Development-Stack --skill analyzing-dotnet-performance","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fitsmejay18\u002FAI-Skills-for-My-Development-Stack\u002Fblob\u002Fmain\u002F20-Performance-Optimization\u002Fanalyzing-dotnet-performance\u002FSKILL.md",true,[44,50,54,58,62,66,70],{"path":45,"resourceType":46,"resourceTypeDesc":47,"sizeBytes":48,"sourceHtmlUrl":49},"references\u002Fasync-patterns.md","REFERENCE","参考文档",2976,"https:\u002F\u002Fgithub.com\u002Fitsmejay18\u002FAI-Skills-for-My-Development-Stack\u002Fblob\u002Fmain\u002F20-Performance-Optimization\u002Fanalyzing-dotnet-performance\u002Freferences\u002Fasync-patterns.md",{"path":51,"resourceType":46,"resourceTypeDesc":47,"sizeBytes":52,"sourceHtmlUrl":53},"references\u002Fcollections-and-linq.md",7744,"https:\u002F\u002Fgithub.com\u002Fitsmejay18\u002FAI-Skills-for-My-Development-Stack\u002Fblob\u002Fmain\u002F20-Performance-Optimization\u002Fanalyzing-dotnet-performance\u002Freferences\u002Fcollections-and-linq.md",{"path":55,"resourceType":46,"resourceTypeDesc":47,"sizeBytes":56,"sourceHtmlUrl":57},"references\u002Fcritical-patterns.md",6787,"https:\u002F\u002Fgithub.com\u002Fitsmejay18\u002FAI-Skills-for-My-Development-Stack\u002Fblob\u002Fmain\u002F20-Performance-Optimization\u002Fanalyzing-dotnet-performance\u002Freferences\u002Fcritical-patterns.md",{"path":59,"resourceType":46,"resourceTypeDesc":47,"sizeBytes":60,"sourceHtmlUrl":61},"references\u002Fio-and-serialization.md",3676,"https:\u002F\u002Fgithub.com\u002Fitsmejay18\u002FAI-Skills-for-My-Development-Stack\u002Fblob\u002Fmain\u002F20-Performance-Optimization\u002Fanalyzing-dotnet-performance\u002Freferences\u002Fio-and-serialization.md",{"path":63,"resourceType":46,"resourceTypeDesc":47,"sizeBytes":64,"sourceHtmlUrl":65},"references\u002Fmemory-and-strings.md",5857,"https:\u002F\u002Fgithub.com\u002Fitsmejay18\u002FAI-Skills-for-My-Development-Stack\u002Fblob\u002Fmain\u002F20-Performance-Optimization\u002Fanalyzing-dotnet-performance\u002Freferences\u002Fmemory-and-strings.md",{"path":67,"resourceType":46,"resourceTypeDesc":47,"sizeBytes":68,"sourceHtmlUrl":69},"references\u002Fregex-patterns.md",3324,"https:\u002F\u002Fgithub.com\u002Fitsmejay18\u002FAI-Skills-for-My-Development-Stack\u002Fblob\u002Fmain\u002F20-Performance-Optimization\u002Fanalyzing-dotnet-performance\u002Freferences\u002Fregex-patterns.md",{"path":71,"resourceType":46,"resourceTypeDesc":47,"sizeBytes":72,"sourceHtmlUrl":73},"references\u002Fstructural-patterns.md",1683,"https:\u002F\u002Fgithub.com\u002Fitsmejay18\u002FAI-Skills-for-My-Development-Stack\u002Fblob\u002Fmain\u002F20-Performance-Optimization\u002Fanalyzing-dotnet-performance\u002Freferences\u002Fstructural-patterns.md",[75,82,89,96,103,110],{"skillNo":76,"name":77,"nameZh":6,"description":78,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":19},"01M7D2RKBHPZ3E1RNN5DWHT550","vectorization","Design, implement, optimize, and review SIMD code in .NET. USE FOR: vectorizing scalar loops with TensorPrimitives, Vector64\u002F128\u002F256\u002F512, or platform hardware intrinsics; reviewing existing SIMD code, including Vector\u003CT>, for contract equivalence, tail handling, memory safety, portability, fallbacks, and measured performance. DO NOT USE FOR: performance work unrelated to SIMD or vectorization.","https:\u002F\u002Fgithub.com\u002Fitsmejay18\u002FAI-Skills-for-My-Development-Stack\u002Fblob\u002Fmain\u002F20-Performance-Optimization\u002Fvectorization\u002FSKILL.md",[],[],{"skillNo":83,"name":84,"nameZh":6,"description":85,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":86,"categories":87,"keywords":88,"publishedAt":19},"01M7D2RDJ7RN3QK8GJR0QTER1D","resolve-project-references","Guide for interpreting ResolveProjectReferences time in MSBuild performance summaries. Activate when ResolveProjectReferences appears as the most expensive target and developers are trying to optimize it directly. Explains that the reported time includes wait time for dependent project builds and is misleading. Guides users to focus on task self-time instead. Do not activate for general build performance -- use build-perf-diagnostics instead.","https:\u002F\u002Fgithub.com\u002Fitsmejay18\u002FAI-Skills-for-My-Development-Stack\u002Fblob\u002Fmain\u002F20-Performance-Optimization\u002Fresolve-project-references\u002FSKILL.md",[],[],{"skillNo":90,"name":91,"nameZh":6,"description":92,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":93,"categories":94,"keywords":95,"publishedAt":19},"01M7D2R1H2GTNZYHG9YRX3JDQW","optimizing-ef-core-queries","Optimize and improve the performance of slow Entity Framework Core (EF Core) queries: make them generate less SQL, make fewer database round-trips, and return results faster. Use whenever an EF Core or DbContext query or data-access path is slow or should be made faster — whether or not EF Core owns the database schema. For EF Core, not Dapper or raw ADO.NET.","https:\u002F\u002Fgithub.com\u002Fitsmejay18\u002FAI-Skills-for-My-Development-Stack\u002Fblob\u002Fmain\u002F20-Performance-Optimization\u002Foptimizing-ef-core-queries\u002FSKILL.md",[],[],{"skillNo":97,"name":98,"nameZh":6,"description":99,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":100,"categories":101,"keywords":102,"publishedAt":19},"01M7D2QREG04W1YT0NEBHEW5C9","microbenchmarking","Activate this skill when BenchmarkDotNet (BDN) is involved in the task — creating, running, configuring, or reviewing BDN benchmarks. Also activate when microbenchmarking .NET code would be useful and BenchmarkDotNet is the likely tool. Consider activating when answering a .NET performance question requires measurement and BenchmarkDotNet may be needed. Covers microbenchmark design, BDN configuration and project setup, how to run BDN microbenchmarks efficiently and effectively, and using BDN for side-by-side performance comparisons. Do NOT use for profiling\u002Ftracing .NET code (dotnet-trace, PerfView), production telemetry, or load\u002Fstress testing (Crank, k6).","https:\u002F\u002Fgithub.com\u002Fitsmejay18\u002FAI-Skills-for-My-Development-Stack\u002Fblob\u002Fmain\u002F20-Performance-Optimization\u002Fmicrobenchmarking\u002FSKILL.md",[],[],{"skillNo":104,"name":105,"nameZh":6,"description":106,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":107,"categories":108,"keywords":109,"publishedAt":19},"01M7D2QGE175XWPZVACVH2868Z","incremental-build","Guide for optimizing MSBuild incremental builds. USE FOR: builds slower than expected on subsequent runs, 'nothing changed but it rebuilds anyway', diagnosing why targets re-execute unnecessarily, fixing broken no-op builds. Covers 8 common causes: missing Inputs\u002FOutputs on custom targets, volatile properties in output paths (timestamps\u002FGUIDs), file writes outside tracked Outputs, missing FileWrites registration, glob changes, Visual Studio Fast Up-to-Date Check (FUTDC) issues. Key diagnostic: look for 'Building target completely' vs 'Skipping target' in binlog. DO NOT USE FOR: first-time build slowness (use build-perf-baseline), parallelism issues (use build-parallelism), evaluation-phase slowness (use eval-performance), non-MSBuild build systems.","https:\u002F\u002Fgithub.com\u002Fitsmejay18\u002FAI-Skills-for-My-Development-Stack\u002Fblob\u002Fmain\u002F20-Performance-Optimization\u002Fincremental-build\u002FSKILL.md",[],[],{"skillNo":111,"name":112,"nameZh":6,"description":113,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":114,"categories":115,"keywords":116,"publishedAt":19},"01M7D2Q1DQTC6K49R73WQTTPSB","eval-performance","Guide for diagnosing and improving MSBuild project evaluation performance. USE FOR: builds slow before any compilation starts, high evaluation time in binlog analysis, expensive glob patterns walking large directories (node_modules, .git, bin\u002Fobj), deep import chains (>20 levels), preprocessed output >10K lines indicating heavy evaluation, property functions with file I\u002FO ($([System.IO.File]::ReadAllText(...))), multiple evaluations per project. Covers the 5 MSBuild evaluation phases, glob optimization via DefaultItemExcludes, import chain analysis with \u002Fpp preprocessing. DO NOT USE FOR: compilation-time slowness (use build-perf-diagnostics), incremental build issues (use incremental-build), non-MSBuild build systems.","https:\u002F\u002Fgithub.com\u002Fitsmejay18\u002FAI-Skills-for-My-Development-Stack\u002Fblob\u002Fmain\u002F20-Performance-Optimization\u002Feval-performance\u002FSKILL.md",[],[]]