dotnet-techne-qa-pipel…
Use when the user asks to verify a story or ticket implementation against its spec - per-AC verdicts, code reuse and design conformance, dead code, then…
Use when you need CRAP score and coverage risk analysis to find high-risk code before refactoring or release. Keywords: CRAP score, risk hotspots, cyclomatic complexity, test coverage gaps, coverage threshold.
$ npx -y skills add Metalnib/dotnet-episteme-skills --skill dotnet-techne-crap-analysis --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/dotnet-techne-crap-analysisContext preview
The summary Claude sees to decide when to auto-load this skill.
Use when you need CRAP score and coverage risk analysis to find high-risk code before refactoring or release. Keywords: CRAP score, risk hotspots, cyclomatic complexity, test coverage gaps, coverage threshold.
name: dotnet-techne-crap-analysis
description: "Use when you need CRAP score and coverage risk analysis to find high-risk code before refactoring or release. Keywords: CRAP score, risk hotspots, cyclomatic complexity, test coverage gaps, coverage threshold."
disable-model-invocation: false
user-invocable: true
metadata:
author: Metalnib
version: "1.0.0"
trigger_keywords:
- crap score
- risk hotspots
- cyclomatic complexity
- test coverage gaps
- coverage thresholdUse this skill when:
---
**CRAP Score = Complexity x (1 - Coverage)^2**
The CRAP (Change Risk Anti-Patterns) score combines cyclomatic complexity with test coverage to identify risky code.
| CRAP Score | Risk Level | Action Required | |------------|------------|-----------------| | **< 5** | Low | Well-tested, maintainable code | | **5-30** | Medium | Acceptable but watch complexity | | **> 30** | High | Needs tests or refactoring |
| Method | Complexity | Coverage | Calculation | CRAP | |--------|------------|----------|-------------|------| | `GetUserId()` | 1 | 0% | 1 x (1 - 0)^2 | **1** | | `ParseToken()` | 54 | 52% | 54 x (1 - 0.52)^2 | **12.4** | | `ValidateForm()` | 20 | 0% | 20 x (1 - 0)^2 | **20** | | `ProcessOrder()` | 45 | 20% | 45 x (1 - 0.20)^2 | **28.8** | | `ImportData()` | 80 | 10% | 80 x (1 - 0.10)^2 | **64.8** |
---
Create a `coverage.runsettings` file in your repository root. The **OpenCover format is required** for CRAP score calculation because it includes cyclomatic complexity metrics.
<?xml version="1.0" encoding="utf-8" ?>
<RunSettings>
<DataCollectionRunSettings>
<DataCollectors>
<DataCollector friendlyName="XPlat code coverage">
<Configuration>
<!-- OpenCover format includes cyclomatic complexity for CRAP scores -->
<Format>cobertura,opencover</Format>
<!-- Exclude test and benchmark assemblies -->
<Exclude>[*.Tests]*,[*.Benchmark]*,[*.Migrations]*</Exclude>
<!-- Exclude generated code, obsolete members, and explicit exclusions -->
<ExcludeByAttribute>Obsolete,GeneratedCodeAttribute,CompilerGeneratedAttribute,ExcludeFromCodeCoverageAttribute</ExcludeByAttribute>
<!-- Exclude source-generated files, Blazor generated code, and migrations -->
<ExcludeByFile>**/obj/**/*,**/*.g.cs,**/*.designer.cs,**/*.razor.g.cs,**/*.razor.css.g.cs,**/Migrations/**/*</ExcludeByFile>
<!-- Exclude test projects -->
<IncludeTestAssembly>false</IncludeTestAssembly>
<!-- Optimization flags -->
<SingleHit>false</SingleHit>
<UseSourceLink>true</UseSourceLink>
<SkipAutoProps>true</SkipAutoProps>
</Configuration>
</DataCollector>
</DataCollectors>
</DataCollectionRunSettings>
</RunSettings>| Option | Purpose | |--------|---------| | `Format` | Must include `opencover` for complexity metrics | | `Exclude` | Exclude test/benchmark assemblies by pattern | | `ExcludeByAttribute` | Skip generated, obsolete, and explicitly excluded code (includes `ExcludeFromCodeCoverageAttribute`) | | `ExcludeByFile` | Skip source-generated files, Blazor components, and migrations | | `SkipAutoProps` | Don't count auto-properties as branches |
---
Install ReportGenerator as a local tool for generating HTML reports with Risk Hotspots.
{
"version": 1,
"isRoot": true,
"tools": {
"dotnet-reportgenerator-globaltool": {
"version": "5.4.5",
"commands": ["reportgenerator"],
"rollForward": false
}
}
}Then restore:
dotnet tool restore
dotnet tool install --global dotnet-reportgenerator-globaltool
---
# Clean previous results rm -rf coverage/ TestResults/ # Run unit tests with coverage dotnet test tests/MyApp.Tests.Unit \ --settings coverage.runsettings \ --collect:"XPlat Code Coverage" \ --results-directory ./TestResults # Run integration tests (optional, adds to coverage) dotnet test tests/MyApp.Tests.Integration \ --settings coverage.runsettings \ --collect:"XPlat Code Coverage" \ --results-directory ./TestResults
dotnet reportgenerator \ -reports:"TestResults/**/coverage.opencover.xml" \ -targetdir:"coverage" \ -reporttypes:"Html;TextSummary;MarkdownSummaryGithub"
| Type | Description | Output | |------|-------------|--------| | `Html` | Full interactive report | `coverage/index.html` | | `TextSummary` | Plain text summary | `coverage/Summary.txt` | | `MarkdownSummaryGithub` | GitHub-compatible markdown | `coverage/SummaryGithub.md` | | `Badges` | SVG badges for README | `coverage/badge_*.svg` | | `Cobertura` | Merged Cobertura XML | `coverage/Cobertura.xml` |
---
The HTML report includes a **Risk Hotspots** section showing methods sorted by complexity:
DotNet Episteme Skills - a curated, manual-first .NET AI skills library rooted in systematic knowledge (episteme) and shaped by disciplined craft (techne), designed for engineers who prioritise precision over hype.
Repo: Metalnib/dotnet-episteme-skills
Use when the user asks to verify a story or ticket implementation against its spec - per-AC verdicts, code reuse and design conformance, dead code, then…
Use when the user asks for a phase-gated refactoring or redesign loop - session-blind workers map and trace the area, empirical probes precede the design, an…
Use when the user asks for a multi-agent .NET code review - five parallel reviewers (correctness, performance, security/observability,…
Use when reviewing PRs/diffs/branches/documents for .NET quality, correctness, performance, security, data access, messaging, and observability. Includes…
Use when reviewing a .NET pull request for breaking changes that may affect other microservice repositories. Detects cross-repo API, DTO, endpoint, EF entity,…
Use when designing or changing public C#/.NET APIs with compatibility and versioning constraints. Keywords: breaking change, API design, backward…