dotnet-complexity
Skill13 starsChanged 8 months agoMITView on GitHub
Use free built-in .NET maintainability analyzers and code metrics configuration to find overly complex methods and coupled code. Use when a repo needs cyclomatic complexity checks, maintainability thresholds, or complexity-driven refactoring gates.
In this repository84 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- dotnet-analyzer-configSkill
- dotnet-architectureSkill
- dotnet-archunitnetSkill
- dotnet-aspireSkill
- dotnet-aspnet-coreSkill
- dotnet-asynkron-profilerSkill
- dotnet-azure-functionsSkill
- dotnet-biomeSkill
- dotnet-blazorSkill
- dotnet-chousSkill
- dotnet-clocSkill
- dotnet-code-analysisSkill
- dotnet-codeqlSkill
- dotnet-code-reviewSkill
- dotnet-coverletSkill
- dotnet-csharpierSkill
- dotnet-entity-framework6Skill
- dotnet-entity-framework-coreSkill
- dotnet-eslintSkill
- dotnet-formatSkill
- dotnet-grpcSkill
- dotnet-htmlhintSkill
- dotnet-legacy-aspnetSkill
- dotnet-libvlcSkill
- dotnet-managedcode-communicationSkill
- dotnet-managedcode-markitdownSkill
- dotnet-managedcode-mimetypesSkill
- dotnet-managedcode-orleans-graphSkill
- dotnet-managedcode-orleans-signalrSkill
- dotnet-managedcode-storageSkill
- dotnet-mauiSkill
- dotnet-mcaf-agile-deliverySkill
- dotnet-mcaf-devexSkill
- dotnet-mcaf-documentationSkill
- dotnet-mcaf-feature-specSkill
- dotnet-mcaf-human-review-planningSkill
- dotnet-mcaf-ml-ai-deliverySkill
- dotnet-mcaf-nfrSkill
- dotnet-mcafSkill
- dotnet-mcaf-source-controlSkill
- dotnet-mcaf-ui-uxSkill
- dotnet-mcpSkill
- dotnet-metalintSkill
- dotnet-meziantou-analyzerSkill
- dotnet-microsoft-agent-frameworkSkill
- dotnet-microsoft-extensions-aiSkill
- dotnet-microsoft-extensionsSkill
- dotnet-minimal-apisSkill
- dotnet-mixed-realitySkill
- dotnet-mlnetSkill
- dotnet-modern-csharpSkill
- dotnet-mstestSkill
- dotnet-mvvmSkill
- dotnet-netarchtestSkill
- dotnet-nunitSkill
- dotnet-orleansSkill
- dotnet-profilingSkill
- dotnet-project-setupSkill
- The first 60 shown.
The file
Show its rules and text
We split this skill into the rules it gives an agent
17 rules. About 0 are common, 9 are distinctive, and 8 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈9
Distinctive · estimate
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 21
leave reusable project context so future tasks are faster and safer
- Distinctive: line 36
Read the nearest AGENTS.md and confirm scope and constraints.
- Very specific: line 37
Run this skill's Workflow through the Ralph Loop until outcomes are acceptable.
- Distinctive: line 42
Start with the built-in maintainability analyzers before reaching for non-standard tooling.
- Distinctive: line 43
Use these rules deliberately:
- Very specific: line 48
Keep rule severity in the root .editorconfig.
- Very specific: line 49
Keep metric thresholds in a checked-in CodeMetricsConfig.txt added as AdditionalFiles.
- Distinctive: line 54
If complexity thresholds are not configured yet:
- Very specific: line 59
Add severity entries for CA1502, CA1505, CA1506, and CA1501 in root .editorconfig.
- Very specific: line 60
Add checked-in CodeMetricsConfig.txt and include it as AdditionalFiles in project props.
- Distinctive: line 61
Keep maintainability limits aligned with AGENTS.md.
- Very specific: line 62
Run dotnet build SOLUTION_OR_PROJECT and return status: configured or status: improved.
- Very specific: line 63
If policy relies only on AGENTS.md limits with no analyzer gate by design, return status: not_applicable.
- Distinctive: line 80
Use the Ralph Loop for every task, including docs, architecture, testing, and tooling work.
- Distinctive: line 85
write a detailed execution plan
- Distinctive: line 90
Update the plan after each iteration.
- Very specific: line 92
If a dependency is missing, bootstrap it or return status: not_applicable with explicit reason and fallback path.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
.NET Complexity Review
Trigger On
- the team wants to find overly complex methods
- cyclomatic complexity thresholds are needed in CI
- maintainability metrics or coupling thresholds need to be configured
Value
- produce a concrete project delta: code, docs, config, tests, CI, or review artifact
- reduce ambiguity through explicit planning, verification, and final validation skills
- leave reusable project context so future tasks are faster and safer
Do Not Use For
- formatting-only work
- generic analyzer setup with no complexity policy change
Inputs
- the nearest
AGENTS.md - current analyzer settings
- current maintainability limits
Quick Start
- Read the nearest
AGENTS.mdand confirm scope and constraints. - Run this skill's
Workflowthrough theRalph Loopuntil outcomes are acceptable. - Return the
Required Result Formatwith concrete artifacts and verification evidence.
Workflow
- Start with the built-in maintainability analyzers before reaching for non-standard tooling.
- Use these rules deliberately:
CA1502for excessive cyclomatic complexity in methodsCA1505for low maintainability indexCA1506for excessive class couplingCA1501when inheritance depth is also part of the design problem
- Keep rule severity in the root
.editorconfig. - Keep metric thresholds in a checked-in
CodeMetricsConfig.txtadded asAdditionalFiles. - Pair analyzer findings with MCAF maintainability limits in
AGENTS.md.
Bootstrap When Missing
If complexity thresholds are not configured yet:
- Detect current state:
rg -n "CA1501|CA1502|CA1505|CA1506|CodeMetricsConfig" -g '.editorconfig' -g '*.csproj' -g 'Directory.Build.*' .rg --files -g 'CodeMetricsConfig.txt'
- Add severity entries for
CA1502,CA1505,CA1506, andCA1501in root.editorconfig. - Add checked-in
CodeMetricsConfig.txtand include it asAdditionalFilesin project props. - Keep maintainability limits aligned with
AGENTS.md. - Run
dotnet build SOLUTION_OR_PROJECTand returnstatus: configuredorstatus: improved. - If policy relies only on
AGENTS.mdlimits with no analyzer gate by design, returnstatus: not_applicable.
Deliver
- explicit complexity and maintainability policy
- checked-in metric thresholds
- CI commands that surface complex methods early
Validate
- method-complexity checks are enabled where the repo wants them
- thresholds are versioned in repo, not held in IDE memory
- complexity findings map to real refactoring decisions
Ralph Loop
Use the Ralph Loop for every task, including docs, architecture, testing, and tooling work.
- Plan first (mandatory):
- analyze current state
- define target outcome, constraints, and risks
- write a detailed execution plan
- list final validation skills to run at the end, with order and reason
- Execute one planned step and produce a concrete delta.
- Review the result and capture findings with actionable next fixes.
- Apply fixes in small batches and rerun the relevant checks or review steps.
- Update the plan after each iteration.
- Repeat until outcomes are acceptable or only explicit exceptions remain.
- If a dependency is missing, bootstrap it or return
status: not_applicablewith explicit reason and fallback path.
Required Result Format
status:complete|clean|improved|configured|not_applicable|blockedplan: concise plan and current iteration stepactions_taken: concrete changes madevalidation_skills: final skills run, or skipped with reasonsverification: commands, checks, or review evidence summaryremaining: top unresolved items ornone
For setup-only requests with no execution, return status: configured and exact next commands.
Load References
references/complexity.mdreferences/metrics.mdreferences/config.md
Example Requests
- "Which analyzer finds complex methods in .NET?"
- "Add a complexity gate for our C# code."
- "Configure cyclomatic complexity thresholds."
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

