roslynator

GitHub

为 .NET 项目配置 Roslynator 分析器与 CLI,执行 C# 静态分析、代码清理及自动修复。适用于引入新规则、统一代码规范或集成 CI/CD 检查流程的场景。

catalog/Tools/Roslynator/skills/roslynator/SKILL.md managedcode/dotnet-skills

Trigger Scenarios

需要配置 Roslynator.Analyzers 希望使用 Roslynator CLI 进行代码分析或清理 询问 C# 静态分析或代码修复

Install

npx skills add managedcode/dotnet-skills --skill roslynator -g -y
More Options

Non-standard path

npx skills add https://github.com/managedcode/dotnet-skills/tree/main/catalog/Tools/Roslynator/skills/roslynator -g -y

Use without installing

npx skills use managedcode/dotnet-skills@roslynator

指定 Agent (Claude Code)

npx skills add managedcode/dotnet-skills --skill roslynator -a claude-code -g -y

安装 repo 全部 skill

npx skills add managedcode/dotnet-skills --all -g -y

预览 repo 内 skill

npx skills add managedcode/dotnet-skills --list

SKILL.md

Frontmatter
{
    "name": "roslynator",
    "description": "Use the open-source free `Roslynator` analyzer packages and optional CLI for .NET. USE FOR: Roslynator.Analyzers setup; Roslynator CLI checks or cleanup; C# linting, static analysis, and code-fix automation. DO NOT USE FOR: overlapping analyzer packs with no consolidation plan; formatting-only work owned by another formatter. INVOKES: inspect the repository context, edit targeted files, and run relevant build, test, lint, or validation commands when changes are made.",
    "compatibility": "Requires a .NET SDK-based repository; respects the repo's `AGENTS.md` commands first."
}

Roslynator

Trigger On

  • the repo uses or wants Roslynator.Analyzers
  • the team wants Roslynator CLI or extra Roslyn-based rules
  • the user asks about C# linting, static analysis, code cleanup, or unused code

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

  • repos that already have overlapping analyzer packs with no consolidation plan
  • formatting-only work when the repo already standardized on dotnet format or CSharpier

Inputs

  • the nearest AGENTS.md
  • current analyzer packages
  • .editorconfig

Quick Start

  1. Read the nearest AGENTS.md and confirm scope and constraints.
  2. Run this skill's Workflow through the Ralph Loop until outcomes are acceptable.
  3. Return the Required Result Format with concrete artifacts and verification evidence.

Workflow

  1. Prefer the NuGet analyzer packages for build-enforced checks.
  2. Use the CLI when the repo needs one of these flows explicitly:
    • analyze
    • fix
    • find-unused
    • format
  3. Build first when Roslynator needs compiled context.
  4. Configure rule severity and Roslynator behavior in .editorconfig.
  5. Avoid duplicating the same rules across multiple analyzer packs without a severity plan.
  6. Treat CLI auto-fix as a controlled change:
    • run it on a bounded target first
    • rebuild
    • rerun tests

Bootstrap When Missing

If Roslynator is not configured yet:

  1. Detect current state:
    • rg -n "Roslynator\\.Analyzers" -g '*.csproj' .
    • rg --files -g '.config/dotnet-tools.json'
    • dotnet tool list --local
    • dotnet tool list --global
    • command -v roslynator
  2. Choose the install path deliberately:
    • analyzer package: dotnet add PROJECT.csproj package Roslynator.Analyzers
    • optional CLI: dotnet new tool-manifest (if missing) and dotnet tool install roslynator.dotnet.cli
  3. Configure ownership in root .editorconfig so Roslynator does not fight SDK analyzers, StyleCop, or Meziantou.
  4. If the CLI is adopted, add exact commands in AGENTS.md and CI, such as:
    • dotnet tool run roslynator analyze SOLUTION_OR_PROJECT
    • dotnet tool run roslynator fix SOLUTION_OR_PROJECT
  5. Run dotnet build SOLUTION_OR_PROJECT and the selected Roslynator command, then return status: configured or status: improved.
  6. If the repo wants only the current analyzer baseline and no Roslynator-specific CLI workflow, return status: not_applicable.

Deliver

  • Roslynator package or CLI setup that fits the repo
  • explicit ownership of rule severity
  • repeatable commands for analyze, fix, or unused-code workflows when the repo adopts them

Validate

  • Roslynator adds value beyond the current analyzer baseline
  • CI commands remain reviewable and reproducible
  • the repo is not confusing Roslynator CLI with the analyzer package itself

Ralph Loop

Use the Ralph Loop for every task, including docs, architecture, testing, and tooling work.

  1. 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
  2. Execute one planned step and produce a concrete delta.
  3. Review the result and capture findings with actionable next fixes.
  4. Apply fixes in small batches and rerun the relevant checks or review steps.
  5. Update the plan after each iteration.
  6. Repeat until outcomes are acceptable or only explicit exceptions remain.
  7. If a dependency is missing, bootstrap it or return status: not_applicable with explicit reason and fallback path.

Required Result Format

  • status: complete | clean | improved | configured | not_applicable | blocked
  • plan: concise plan and current iteration step
  • actions_taken: concrete changes made
  • validation_skills: final skills run, or skipped with reasons
  • verification: commands, checks, or review evidence summary
  • remaining: top unresolved items or none

For setup-only requests with no execution, return status: configured and exact next commands.

Load References

Example Requests

  • "Add Roslynator analyzers."
  • "Use Roslynator CLI in CI."
  • "Find unused code with Roslynator."
  • "Auto-fix Roslynator issues in this solution."

Version History

  • 7ab7f03 Current 2026-07-25 05:28

Same Skill Collection

catalog/Frameworks/gRPC/skills/grpc/SKILL.md
catalog/Frameworks/Official-Astro/skills/astro-developer/SKILL.md
catalog/Frameworks/Official-DotNet-ASPNetCore/skills/configuring-opentelemetry-dotnet/SKILL.md
catalog/Frameworks/Official-DotNet-ASPNetCore/skills/dotnet-webapi/SKILL.md
catalog/Frameworks/Official-DotNet-ASPNetCore/skills/minimal-api-file-upload/SKILL.md
catalog/Frameworks/Orleans/skills/orleans/SKILL.md
catalog/Frameworks/ThreeJS-WebGPU-TSL/skills/webgpu-threejs-tsl/SKILL.md
catalog/Libraries/Official-DotNet-Data/skills/optimizing-ef-core-queries/SKILL.md
catalog/Platform/Official-DotNet-Advanced/skills/csharp-scripts/SKILL.md
catalog/Platform/Official-DotNet-Advanced/skills/nuget-trusted-publishing/SKILL.md
catalog/Platform/Official-DotNet-Blazor/skills/create-blazor-project/SKILL.md
catalog/Platform/Official-DotNet-Blazor/skills/fetch-and-send-data/SKILL.md
catalog/Platform/Official-DotNet-Blazor/skills/support-prerendering/SKILL.md
catalog/Platform/Official-DotNet-Blazor/skills/use-js-interop/SKILL.md
catalog/Platform/Official-DotNet-Experimental/skills/exp-mock-usage-analysis/SKILL.md
catalog/Platform/Official-DotNet-Experimental/skills/exp-simd-vectorization/SKILL.md
catalog/Platform/Official-DotNet-Test-Migration/skills/migrate-xunit-to-mstest/SKILL.md
catalog/Platform/Official-DotNet-Test-Migration/skills/migrate-xunit-to-xunit-v3/SKILL.md
catalog/Platform/Official-DotNet-Upgrade/skills/dotnet-aot-compat/SKILL.md
catalog/Testing/Official-DotNet-Test/skills/code-testing-extensions/SKILL.md
catalog/Testing/Official-DotNet-Test/skills/filter-syntax/SKILL.md
catalog/Testing/Official-DotNet-Test/skills/find-untested-sources/SKILL.md
catalog/Testing/Official-DotNet-Test/skills/platform-detection/SKILL.md
catalog/Testing/Official-DotNet-Test/skills/scaffold-dotnet-test-project/SKILL.md
catalog/Testing/Official-DotNet-Test/skills/test-gap-analysis/SKILL.md
catalog/Testing/Official-DotNet-Test/skills/testability-obstacle/SKILL.md
catalog/Testing/Playwright/skills/playwright-visual-testing/SKILL.md
catalog/Testing/xUnit/skills/xunit/SKILL.md
catalog/Tools/Code-Analysis/skills/code-analysis/SKILL.md
catalog/Tools/HTMLHint/skills/htmlhint/SKILL.md
catalog/Tools/Official-DotNet-Diagnostics/skills/analyzing-dotnet-performance/SKILL.md
catalog/Tools/Official-DotNet-Diagnostics/skills/clr-activation-debugging/SKILL.md
catalog/Tools/Official-DotNet-Diagnostics/skills/dotnet-trace-collect/SKILL.md
catalog/Tools/Official-DotNet-Diagnostics/skills/dump-collect/SKILL.md
catalog/Tools/Official-DotNet-MSBuild/skills/binlog-failure-analysis/SKILL.md
catalog/Tools/Official-DotNet-MSBuild/skills/copy-to-output-directory/SKILL.md
catalog/Tools/Official-DotNet-MSBuild/skills/msbuild-server/SKILL.md
catalog/Tools/Official-DotNet-MSBuild/skills/resolve-project-references/SKILL.md
catalog/Tools/ReportGenerator/skills/reportgenerator/SKILL.md
catalog/Tools/ReSharper-CLT/skills/resharper-clt/SKILL.md
catalog/Tools/Stylelint/skills/stylelint/SKILL.md
external-sources/upstreams/webgpu-claude-skill/skills/webgpu-threejs-tsl/SKILL.md
catalog/Frameworks/ASP.NET-Core/skills/aspnet-core/SKILL.md
catalog/Frameworks/Aspire/skills/aspire/SKILL.md
catalog/Frameworks/Azure-Functions/skills/azure-functions/SKILL.md
catalog/Frameworks/Blazor/skills/blazor/SKILL.md
catalog/Frameworks/Entity-Framework-6/skills/entity-framework6/SKILL.md
catalog/Frameworks/Entity-Framework-Core/skills/entity-framework-core/SKILL.md
catalog/Frameworks/MAUI/skills/maui/SKILL.md

Metadata

Files
0
Version
0559476
Hash
9efe3fcc
Indexed
2026-07-25 05:28

inicio - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-20 05:25
浙ICP备14020137号-1 $mapa de visitantes$