[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7D04223X2DG6EWZYC3BNVFN":3,"skill-same:01M7D04223X2DG6EWZYC3BNVFN":45},{"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":25,"commitSha":26,"skillDirectory":27,"forksCount":14,"repositoryHtmlUrl":28,"repositoryHomepageUrl":6,"ownerHtmlUrl":29,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":30,"install":31,"resources":44},"01M7D04223X2DG6EWZYC3BNVFN","crap-score",null,"Calculates CRAP (Change Risk Anti-Patterns) for a named .NET method, class, or file. USE FOR: explicit CRAP calculation or coverage-and-complexity risk within that named target, including which tests to prioritize. DO NOT USE FOR: project-wide coverage\u002FCRAP, plateaus, or project-wide blockers\u002Fpriorities (coverage-analysis); behavioral\u002Fpseudo-mutation gaps (test-gap-analysis); writing tests; test runs without CRAP context.","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\u002F02-CSharp-WPF-Desktop-Development\u002Fcrap-score\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: crap-score\ndescription: >\n  Calculates CRAP (Change Risk Anti-Patterns) for a named .NET method, class, or\n  file. USE FOR: explicit CRAP calculation or coverage-and-complexity risk\n  within that named target, including which tests to prioritize. DO NOT USE\n  FOR: project-wide coverage\u002FCRAP, plateaus, or project-wide blockers\u002Fpriorities\n  (coverage-analysis); behavioral\u002Fpseudo-mutation gaps (test-gap-analysis);\n  writing tests; test runs without CRAP context.\nlicense: MIT\n---\n\n# CRAP Score Analysis\n\nCalculate CRAP (Change Risk Anti-Patterns) scores for .NET methods to identify code that is both complex and undertested.\n\n## Background\n\nThe CRAP score combines **cyclomatic complexity** and **code coverage** into a single metric:\n\n$$\\text{CRAP}(m) = \\text{comp}(m)^2 \\times (1 - \\text{cov}(m))^3 + \\text{comp}(m)$$\n\nWhere:\n\n- $\\text{comp}(m)$ = cyclomatic complexity of method $m$\n- $\\text{cov}(m)$ = code coverage ratio (0.0 to 1.0) of method $m$\n\n| CRAP Score | Risk Level | Interpretation |\n|------------|------------|----------------|\n| \u003C 5        | Low        | Simple and well-tested |\n| 5 to \u003C 15  | Moderate   | Acceptable for most code |\n| 15 to 30   | High       | Needs more tests or simplification |\n| > 30       | Critical   | Refactor and add coverage urgently |\n\nA method with 100% coverage has CRAP = complexity (the minimum). A method with 0% coverage has CRAP = complexity^2 + complexity.\n\n## When to Use\n\n- User wants to assess which methods are risky due to low coverage and high complexity\n- User asks for CRAP score of specific methods, classes, or files\n- User wants to prioritize what to test next within a named method, class, or file based on coverage-and-complexity risk\n- User wants to evaluate test quality beyond simple coverage percentages\n\n## When Not to Use\n\n- User just wants to run tests (use `run-tests` skill)\n- User wants to write new tests (use `code-testing-agent`)\n- User only wants a coverage percentage without complexity analysis\n- User wants project-wide coverage\u002FCRAP analysis or priorities (use `coverage-analysis`)\n\n## Inputs\n\n| Input | Required | Description |\n|-------|----------|-------------|\n| Target scope | Yes | Method name, class name, or file path to analyze |\n| Test project path | No | Path to the test project. Defaults to discovering test projects in the solution. |\n| Source project path | No | Path to the source project under analysis |\n\n## Workflow\n\n### Step 1: Collect code coverage data\n\nIf no coverage data exists yet, classify the test project first. For SDK-style\nprojects, run `dotnet test` with coverage collection. For classic non-SDK\nprojects (`ToolsVersion`, explicit compile items, or `packages.config`), use only\na repository-provided coverage command that emits Cobertura. If none exists,\nask for Cobertura XML and stop; do not migrate the project or inject an SDK-style\ncoverage package. CRAP scores always require real coverage data.\n\nCheck the test project's `.csproj` for the coverage package, then run the appropriate command:\n\n| Coverage Package | Command | Output Location |\n|---|---|---|\n| `coverlet.collector` | `dotnet test --collect:\"XPlat Code Coverage\" --results-directory .\u002FTestResults` | Typically under `TestResults\u002F\u003Cguid>\u002Fcoverage.cobertura.xml`. Search recursively under the results directory (for example, `TestResults\u002F**\u002Fcoverage.cobertura.xml`) or use any explicit coverage path the user provides. |\n| `Microsoft.Testing.Extensions.CodeCoverage` (.NET 9) | `dotnet test -- --coverage --coverage-output-format cobertura --coverage-output .\u002FTestResults` | `--coverage-output` path |\n| `Microsoft.Testing.Extensions.CodeCoverage` (.NET 10+) | `dotnet test --coverage --coverage-output-format cobertura --coverage-output .\u002FTestResults` | `--coverage-output` path |\n\n#### Never estimate coverage\n\n**Guessed coverage produces wrong CRAP scores, which is worse than no answer.**\nFor a classic project with no repository coverage command or existing report,\nstop here and request Cobertura; do not use any collection fallback below.\n\nFor SDK-style projects, if the first command yields no Cobertura XML, work down\nthis collection list before giving up:\n\n1. For SDK-style projects only, add a provider if none is referenced:\n   `dotnet add \u003Ctest.csproj> package coverlet.collector`, then re-run. Never use\n   this fallback for `packages.config` or classic non-SDK projects.\n2. Use the standalone collector, which works even when the test host or a shared assembly blocks the in-proc collector:\n   `dotnet tool install --global dotnet-coverage` then\n   `dotnet-coverage collect -f cobertura -o coverage.cobertura.xml \"dotnet test \u003Ctest.csproj>\"`.\n\nFor any project type, if a real binary `.coverage` report already exists, convert\nor summarize that existing data with ReportGenerator:\n\n3. Convert the existing report:\n   `dotnet tool install --global dotnet-reportgenerator-globaltool` then\n   `reportgenerator -reports:\u003Cfile> -targetdir:cov -reporttypes:Cobertura`.\n4. Tests fail but still run? Coverage is collected from the tests that executed — continue with that data and note the failures.\n\nIf every path fails, **report that coverage could not be collected, show the commands you tried and their errors, and stop.** Report complexity on its own if useful, but never publish a CRAP number derived from an assumed coverage percentage.\n\nBefore using a report, verify that it parses, contains at least one class and\nmethod, and contains the requested target. An empty report or a report that\nomits the target is failed collection or filtering, not 0% coverage. Regenerate\ncoverage when possible; otherwise stop without publishing a CRAP score.\n\nIf the user supplies an existing report, state that it was not regenerated.\nDo not describe its data as current unless its provenance is established by\nrunning the repository's coverage command in this analysis.\n\n### Step 2: Compute cyclomatic complexity\n\nPrefer a machine-produced per-method complexity from a repository-provided code\nmetrics report or from the Cobertura method's `complexity` attribute when that\nreport maps to the current source. Microsoft.CodeAnalysis.Metrics can generate\nmethod-level `CyclomaticComplexity` data through `msbuild \u002Ft:Metrics`, but do\nnot add the package or modify the project without user approval.\n\nIf no machine-produced metric exists, analyze the current target source and\nlabel the result as a manual complexity count. Count the following decision\npoints (each adds 1 to the base complexity of 1):\n\n| Construct | Example |\n|-----------|---------|\n| `if` | `if (x > 0)` |\n| `else if` | `else if (y \u003C 0)` |\n| `case` (each) | `case 1:` |\n| `for` | `for (int i = 0; ...)` |\n| `foreach` | `foreach (var item in list)` |\n| `while` | `while (running)` |\n| `do...while` | `do { } while (cond)` |\n| `catch` (each) | `catch (Exception ex)` |\n| `&&` | `if (a && b)` |\n| `\\|\\|` (OR) | `if (a \\|\\| b)` |\n| `??` | `value ?? fallback` |\n| `?.` | `obj?.Method()` |\n| `? :` (ternary) | `x > 0 ? a : b` |\n| Pattern match arm | `x is > 0 and \u003C 10` |\n\nBase complexity is 1 for every method. Each decision point adds 1.\n\nWhen counting manually, read the source file, report the construct-by-construct\nbreakdown, and do not use a source comment as evidence. If the report's\ncomplexity attribute disagrees with the current-source count, report the\nconflict and do not present either resulting CRAP score as authoritative.\n\n### Step 3: Extract per-method coverage from Cobertura XML\n\nParse the Cobertura XML to find each method's `line-rate` attribute under the target `\u003Cclass>` element. If `line-rate` is not available at method level, compute it from the `\u003Clines>` elements:\n\n$$\\text{cov}(m) = \\frac{\\text{lines with hits} > 0}{\\text{total lines}}$$\n\nMethod names in Cobertura may differ from source (async methods, lambdas). Match by line ranges when names don't align.\n\nWhen both `line-rate` and `\u003Clines>` exist, recompute the hit ratio and compare\nthem. Allow only normal report rounding (one percentage point); if they differ\nmore, the report contradicts itself. Regenerate it or report the conflict and\nstop without calculating CRAP. Never silently choose whichever value produces\nthe expected score.\n\n### Step 4: Calculate CRAP scores\n\nFor each method in scope, apply the formula:\n\n$$\\text{CRAP}(m) = \\text{comp}(m)^2 \\times (1 - \\text{cov}(m))^3 + \\text{comp}(m)$$\n\nUse a calculator or script for the arithmetic and show the substituted\ncomplexity and coverage. Do not calculate the formula mentally.\n\n### Step 5: Present results\n\nPresent a sorted table (highest CRAP first):\n\n```text\n| Method                          | Complexity | Coverage | CRAP Score | Risk     |\n|---------------------------------|------------|----------|------------|----------|\n| OrderService.ProcessOrder       | 10         | 45%      | 26.6       | High     |\n| OrderService.ValidateItems      | 8          | 90%      | 8.1        | Moderate |\n| OrderService.CalculateTotal     | 3          | 100%     | 3.0        | Low      |\n```\n\nInclude:\n\n- **Summary**: total methods analyzed, how many in each risk category\n- **Top offenders**: methods with CRAP > 30, with specific recommendations\n- **Quick wins**: methods with high complexity but where small coverage improvements would drop the score significantly\n\n### Step 6: Provide actionable recommendations\n\nFor high-CRAP methods, suggest one or both:\n\n1. **Add tests** -- identify uncovered branches and suggest specific test cases\n2. **Reduce complexity** -- suggest extract-method refactoring for deeply nested logic\n\nCalculate the **coverage needed** to bring a method below a CRAP threshold of 15:\n\n$$\\text{cov}_{\\text{needed}} = 1 - \\left(\\frac{15 - \\text{comp}}{\\text{comp}^2}\\right)^{1\u002F3}$$\n\nThis formula only applies when comp \u003C 15. When comp >= 15, the minimum possible CRAP score (at 100% coverage) is comp itself, which already meets or exceeds the threshold. In that case, **coverage alone cannot bring the CRAP score below the threshold** -- the method must be refactored to reduce its cyclomatic complexity first.\n\nReport this as: \"To bring `ProcessOrder` (complexity 10) below CRAP 15, increase coverage from 45% to more than 63.2% (at least 64% when reporting whole percentages).\" For methods where complexity alone exceeds the threshold, report: \"`ComplexMethod` (complexity 18) cannot reach CRAP \u003C 15 through testing alone -- reduce complexity by extracting sub-methods.\"\n\n## Validation\n\n- Verify that coverage data was collected successfully (Cobertura XML exists and contains data)\n- Confirm the target method is present; absence is not evidence of 0% coverage\n- Confirm every coverage figure came from that XML — no estimated, assumed, or source-comment-derived values\n- Cross-check method `line-rate` against its line-hit ratio when both exist\n- Cross-check that method names in coverage data match the source code\n- Confirm CRAP scores with calculator or script output\n- Ensure a 100%-covered method's CRAP equals its complexity exactly\n\n## Common Pitfalls\n\n- **Estimating coverage when collection fails**: never do it — the resulting CRAP scores are wrong in the direction that matters. Work through the fallbacks in Step 1, then report the blocker instead.\n- **Treating an empty report or missing method as 0% coverage**: this is failed collection, filtering, or method mapping; do not manufacture a score.\n- **Trusting contradictory Cobertura fields**: compare `line-rate` with the line-hit ratio and stop if they disagree beyond rounding.\n- **Trusting a stale complexity comment in the source**: compute cyclomatic complexity from the current code; a `\u002F\u002F complexity: 7` comment left by a previous author is not evidence.\n- **Mental CRAP arithmetic**: use a calculator or script and show the substituted inputs.\n- **Giving up on a shared-assembly or test-host collector error**: `dotnet-coverage collect` runs out of process and usually succeeds where the in-proc collector fails.\n- **Stale coverage data**: regenerate when the user asks for current results or the source\u002Fbinaries changed; otherwise disclose that a supplied report was not regenerated.\n- **Method name mismatches**: Cobertura XML may use mangled\u002Fcompiler-generated names for async methods, lambdas, or local functions. Match by line ranges when names don't align.\n- **Generated code**: Exclude auto-generated files (e.g., `*.Designer.cs`, `*.g.cs`) from analysis unless explicitly requested.\n","# CRAP Score Analysis\n\nCalculate CRAP (Change Risk Anti-Patterns) scores for .NET methods to identify code that is both complex and undertested.\n\n## Background\n\nThe CRAP score combines **cyclomatic complexity** and **code coverage** into a single metric:\n\n$$\\text{CRAP}(m) = \\text{comp}(m)^2 \\times (1 - \\text{cov}(m))^3 + \\text{comp}(m)$$\n\nWhere:\n\n- $\\text{comp}(m)$ = cyclomatic complexity of method $m$\n- $\\text{cov}(m)$ = code coverage ratio (0.0 to 1.0) of method $m$\n\n| CRAP Score | Risk Level | Interpretation |\n|------------|------------|----------------|\n| \u003C 5        | Low        | Simple and well-tested |\n| 5 to \u003C 15  | Moderate   | Acceptable for most code |\n| 15 to 30   | High       | Needs more tests or simplification |\n| > 30       | Critical   | Refactor and add coverage urgently |\n\nA method with 100% coverage has CRAP = complexity (the minimum). A method with 0% coverage has CRAP = complexity^2 + complexity.\n\n## When to Use\n\n- User wants to assess which methods are risky due to low coverage and high complexity\n- User asks for CRAP score of specific methods, classes, or files\n- User wants to prioritize what to test next within a named method, class, or file based on coverage-and-complexity risk\n- User wants to evaluate test quality beyond simple coverage percentages\n\n## When Not to Use\n\n- User just wants to run tests (use `run-tests` skill)\n- User wants to write new tests (use `code-testing-agent`)\n- User only wants a coverage percentage without complexity analysis\n- User wants project-wide coverage\u002FCRAP analysis or priorities (use `coverage-analysis`)\n\n## Inputs\n\n| Input | Required | Description |\n|-------|----------|-------------|\n| Target scope | Yes | Method name, class name, or file path to analyze |\n| Test project path | No | Path to the test project. Defaults to discovering test projects in the solution. |\n| Source project path | No | Path to the source project under analysis |\n\n## Workflow\n\n### Step 1: Collect code coverage data\n\nIf no coverage data exists yet, classify the test project first. For SDK-style\nprojects, run `dotnet test` with coverage collection. For classic non-SDK\nprojects (`ToolsVersion`, explicit compile items, or `packages.config`), use only\na repository-provided coverage command that emits Cobertura. If none exists,\nask for Cobertura XML and stop; do not migrate the project or inject an SDK-style\ncoverage package. CRAP scores always require real coverage data.\n\nCheck the test project's `.csproj` for the coverage package, then run the appropriate command:\n\n| Coverage Package | Command | Output Location |\n|---|---|---|\n| `coverlet.collector` | `dotnet test --collect:\"XPlat Code Coverage\" --results-directory .\u002FTestResults` | Typically under `TestResults\u002F\u003Cguid>\u002Fcoverage.cobertura.xml`. Search recursively under the results directory (for example, `TestResults\u002F**\u002Fcoverage.cobertura.xml`) or use any explicit coverage path the user provides. |\n| `Microsoft.Testing.Extensions.CodeCoverage` (.NET 9) | `dotnet test -- --coverage --coverage-output-format cobertura --coverage-output .\u002FTestResults` | `--coverage-output` path |\n| `Microsoft.Testing.Extensions.CodeCoverage` (.NET 10+) | `dotnet test --coverage --coverage-output-format cobertura --coverage-output .\u002FTestResults` | `--coverage-output` path |\n\n#### Never estimate coverage\n\n**Guessed coverage produces wrong CRAP scores, which is worse than no answer.**\nFor a classic project with no repository coverage command or existing report,\nstop here and request Cobertura; do not use any collection fallback below.\n\nFor SDK-style projects, if the first command yields no Cobertura XML, work down\nthis collection list before giving up:\n\n1. For SDK-style projects only, add a provider if none is referenced:\n   `dotnet add \u003Ctest.csproj> package coverlet.collector`, then re-run. Never use\n   this fallback for `packages.config` or classic non-SDK projects.\n2. Use the standalone collector, which works even when the test host or a shared assembly blocks the in-proc collector:\n   `dotnet tool install --global dotnet-coverage` then\n   `dotnet-coverage collect -f cobertura -o coverage.cobertura.xml \"dotnet test \u003Ctest.csproj>\"`.\n\nFor any project type, if a real binary `.coverage` report already exists, convert\nor summarize that existing data with ReportGenerator:\n\n3. Convert the existing report:\n   `dotnet tool install --global dotnet-reportgenerator-globaltool` then\n   `reportgenerator -reports:\u003Cfile> -targetdir:cov -reporttypes:Cobertura`.\n4. Tests fail but still run? Coverage is collected from the tests that executed — continue with that data and note the failures.\n\nIf every path fails, **report that coverage could not be collected, show the commands you tried and their errors, and stop.** Report complexity on its own if useful, but never publish a CRAP number derived from an assumed coverage percentage.\n\nBefore using a report, verify that it parses, contains at least one class and\nmethod, and contains the requested target. An empty report or a report that\nomits the target is failed collection or filtering, not 0% coverage. Regenerate\ncoverage when possible; otherwise stop without publishing a CRAP score.\n\nIf the user supplies an existing report, state that it was not regenerated.\nDo not describe its data as current unless its provenance is established by\nrunning the repository's coverage command in this analysis.\n\n### Step 2: Compute cyclomatic complexity\n\nPrefer a machine-produced per-method complexity from a repository-provided code\nmetrics report or from the Cobertura method's `complexity` attribute when that\nreport maps to the current source. Microsoft.CodeAnalysis.Metrics can generate\nmethod-level `CyclomaticComplexity` data through `msbuild \u002Ft:Metrics`, but do\nnot add the package or modify the project without user approval.\n\nIf no machine-produced metric exists, analyze the current target source and\nlabel the result as a manual complexity count. Count the following decision\npoints (each adds 1 to the base complexity of 1):\n\n| Construct | Example |\n|-----------|---------|\n| `if` | `if (x > 0)` |\n| `else if` | `else if (y \u003C 0)` |\n| `case` (each) | `case 1:` |\n| `for` | `for (int i = 0; ...)` |\n| `foreach` | `foreach (var item in list)` |\n| `while` | `while (running)` |\n| `do...while` | `do { } while (cond)` |\n| `catch` (each) | `catch (Exception ex)` |\n| `&&` | `if (a && b)` |\n| `\\|\\|` (OR) | `if (a \\|\\| b)` |\n| `??` | `value ?? fallback` |\n| `?.` | `obj?.Method()` |\n| `? :` (ternary) | `x > 0 ? a : b` |\n| Pattern match arm | `x is > 0 and \u003C 10` |\n\nBase complexity is 1 for every method. Each decision point adds 1.\n\nWhen counting manually, read the source file, report the construct-by-construct\nbreakdown, and do not use a source comment as evidence. If the report's\ncomplexity attribute disagrees with the current-source count, report the\nconflict and do not present either resulting CRAP score as authoritative.\n\n### Step 3: Extract per-method coverage from Cobertura XML\n\nParse the Cobertura XML to find each method's `line-rate` attribute under the target `\u003Cclass>` element. If `line-rate` is not available at method level, compute it from the `\u003Clines>` elements:\n\n$$\\text{cov}(m) = \\frac{\\text{lines with hits} > 0}{\\text{total lines}}$$\n\nMethod names in Cobertura may differ from source (async methods, lambdas). Match by line ranges when names don't align.\n\nWhen both `line-rate` and `\u003Clines>` exist, recompute the hit ratio and compare\nthem. Allow only normal report rounding (one percentage point); if they differ\nmore, the report contradicts itself. Regenerate it or report the conflict and\nstop without calculating CRAP. Never silently choose whichever value produces\nthe expected score.\n\n### Step 4: Calculate CRAP scores\n\nFor each method in scope, apply the formula:\n\n$$\\text{CRAP}(m) = \\text{comp}(m)^2 \\times (1 - \\text{cov}(m))^3 + \\text{comp}(m)$$\n\nUse a calculator or script for the arithmetic and show the substituted\ncomplexity and coverage. Do not calculate the formula mentally.\n\n### Step 5: Present results\n\nPresent a sorted table (highest CRAP first):\n\n```text\n| Method                          | Complexity | Coverage | CRAP Score | Risk     |\n|---------------------------------|------------|----------|------------|----------|\n| OrderService.ProcessOrder       | 10         | 45%      | 26.6       | High     |\n| OrderService.ValidateItems      | 8          | 90%      | 8.1        | Moderate |\n| OrderService.CalculateTotal     | 3          | 100%     | 3.0        | Low      |\n```\n\nInclude:\n\n- **Summary**: total methods analyzed, how many in each risk category\n- **Top offenders**: methods with CRAP > 30, with specific recommendations\n- **Quick wins**: methods with high complexity but where small coverage improvements would drop the score significantly\n\n### Step 6: Provide actionable recommendations\n\nFor high-CRAP methods, suggest one or both:\n\n1. **Add tests** -- identify uncovered branches and suggest specific test cases\n2. **Reduce complexity** -- suggest extract-method refactoring for deeply nested logic\n\nCalculate the **coverage needed** to bring a method below a CRAP threshold of 15:\n\n$$\\text{cov}_{\\text{needed}} = 1 - \\left(\\frac{15 - \\text{comp}}{\\text{comp}^2}\\right)^{1\u002F3}$$\n\nThis formula only applies when comp \u003C 15. When comp >= 15, the minimum possible CRAP score (at 100% coverage) is comp itself, which already meets or exceeds the threshold. In that case, **coverage alone cannot bring the CRAP score below the threshold** -- the method must be refactored to reduce its cyclomatic complexity first.\n\nReport this as: \"To bring `ProcessOrder` (complexity 10) below CRAP 15, increase coverage from 45% to more than 63.2% (at least 64% when reporting whole percentages).\" For methods where complexity alone exceeds the threshold, report: \"`ComplexMethod` (complexity 18) cannot reach CRAP \u003C 15 through testing alone -- reduce complexity by extracting sub-methods.\"\n\n## Validation\n\n- Verify that coverage data was collected successfully (Cobertura XML exists and contains data)\n- Confirm the target method is present; absence is not evidence of 0% coverage\n- Confirm every coverage figure came from that XML — no estimated, assumed, or source-comment-derived values\n- Cross-check method `line-rate` against its line-hit ratio when both exist\n- Cross-check that method names in coverage data match the source code\n- Confirm CRAP scores with calculator or script output\n- Ensure a 100%-covered method's CRAP equals its complexity exactly\n\n## Common Pitfalls\n\n- **Estimating coverage when collection fails**: never do it — the resulting CRAP scores are wrong in the direction that matters. Work through the fallbacks in Step 1, then report the blocker instead.\n- **Treating an empty report or missing method as 0% coverage**: this is failed collection, filtering, or method mapping; do not manufacture a score.\n- **Trusting contradictory Cobertura fields**: compare `line-rate` with the line-hit ratio and stop if they disagree beyond rounding.\n- **Trusting a stale complexity comment in the source**: compute cyclomatic complexity from the current code; a `\u002F\u002F complexity: 7` comment left by a previous author is not evidence.\n- **Mental CRAP arithmetic**: use a calculator or script and show the substituted inputs.\n- **Giving up on a shared-assembly or test-host collector error**: `dotnet-coverage collect` runs out of process and usually succeeds where the in-proc collector fails.\n- **Stale coverage data**: regenerate when the user asks for current results or the source\u002Fbinaries changed; otherwise disclose that a supplied report was not regenerated.\n- **Method name mismatches**: Cobertura XML may use mangled\u002Fcompiler-generated names for async methods, lambdas, or local functions. Match by line ranges when names don't align.\n- **Generated code**: Exclude auto-generated files (e.g., `*.Designer.cs`, `*.g.cs`) from analysis unless explicitly requested.\n",{"name":5,"license":15,"description":24},"Calculates CRAP (Change Risk Anti-Patterns) for a named .NET method, class, or file. USE FOR: explicit CRAP calculation or coverage-and-complexity risk within that named target, including which tests to prioritize. DO NOT USE FOR: project-wide coverage\u002FCRAP, plateaus, or project-wide blockers\u002Fpriorities (coverage-analysis); behavioral\u002Fpseudo-mutation gaps (test-gap-analysis); writing tests; test runs without CRAP context.\n","main","30954af1dcd1a74b63f05deb2e2c41e5ecae4a82","02-CSharp-WPF-Desktop-Development\u002Fcrap-score","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":32,"prompt":42,"zipAvailable":43},[33,36,39],{"tool":34,"command":35},"npx","npx skills add itsmejay18\u002FAI-Skills-for-My-Development-Stack --skill crap-score",{"tool":37,"command":38},"bunx","bunx skills add itsmejay18\u002FAI-Skills-for-My-Development-Stack --skill crap-score",{"tool":40,"command":41},"pnpm","pnpm dlx skills add itsmejay18\u002FAI-Skills-for-My-Development-Stack --skill crap-score","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fitsmejay18\u002FAI-Skills-for-My-Development-Stack\u002Fblob\u002Fmain\u002F02-CSharp-WPF-Desktop-Development\u002Fcrap-score\u002FSKILL.md",true,[],[46,53,60,67,74,81],{"skillNo":47,"name":48,"nameZh":6,"description":49,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":50,"categories":51,"keywords":52,"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":54,"name":55,"nameZh":6,"description":56,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":57,"categories":58,"keywords":59,"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":61,"name":62,"nameZh":6,"description":63,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":64,"categories":65,"keywords":66,"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":68,"name":69,"nameZh":6,"description":70,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":71,"categories":72,"keywords":73,"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":75,"name":76,"nameZh":6,"description":77,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":78,"categories":79,"keywords":80,"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":82,"name":83,"nameZh":6,"description":84,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":85,"categories":86,"keywords":87,"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",[],[]]