dotnet-roslyn-analyzers

Author custom Roslyn analyzers, code fix providers, and diagnostic suppressors for .NET.

71|10|Updated Feb 11, 2026
One-click install
npx skills add https://github.com/wshaddix/dotnet-skills --skill dotnet-roslyn-analyzers-wshaddix
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dotnet-roslyn-analyzers
Source: https://github.com/wshaddix/dotnet-skills/tree/main/skills/dotnet-roslyn-analyzers
Command: npx skills add https://github.com/wshaddix/dotnet-skills --skill dotnet-roslyn-analyzers-wshaddix

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides comprehensive guidance on creating custom Roslyn analyzers, code fix providers, and diagnostic suppressors, enabling developers to enforce coding standards, identify potential bugs, and automate code transformations within the .NET ecosystem.

Core Features & Use Cases

  • Analyzer Authoring: Learn to implement DiagnosticAnalyzer for detecting code issues.
  • Code Fixes & Refactorings: Develop CodeFixProvider and CodeRefactoringProvider to offer automated solutions and transformations.
  • Multi-Version Targeting: Understand how to support multiple Roslyn versions for broader compatibility.
  • Testing & Packaging: Master the process of testing analyzers and packaging them as NuGet libraries.
  • Use Case: You need to create a custom analyzer to ensure all public fields in your C# projects are replaced with properties, and you want to provide an automated code fix to perform this conversion.

Quick Start

Follow the project setup instructions to create a new Roslyn analyzer project.

Frequently Asked Questions about dotnet-roslyn-analyzers

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a custom Roslyn analyzer in C#?

You create a custom Roslyn analyzer by implementing the DiagnosticAnalyzer class to detect code issues and registering analysis context. This Skill guides you through project setup, diagnostic descriptor conventions, and performance best practices for the .NET platform.

How do I add an automated code fix for a Roslyn diagnostic?

You add an automated code fix by developing a CodeFixProvider that offers actions to resolve the detected diagnostic. This Skill covers implementing code fix actions, code refactoring providers, and automated code transformations within the .NET ecosystem.

What is the best way to test Roslyn analyzers and code fix providers?

The best way to test Roslyn analyzers is using the Microsoft.CodeAnalysis.Testing framework. This Skill provides comprehensive guidance on testing analyzers, code fix providers, and diagnostic suppressors to ensure accuracy before NuGet packaging.

How do I package a Roslyn analyzer as a NuGet library?

You package a Roslyn analyzer as a NuGet library by configuring your project for distribution. This Skill covers the NuGet packaging process, multi-version targeting, and supporting multiple Roslyn versions for broader C# compatibility.

When do I need a diagnostic suppressor versus a custom analyzer?

You need a custom analyzer to detect new code issues and enforce coding standards, while a diagnostic suppressor is used to hide existing diagnostics. This Skill guides you through authoring both, alongside code refactoring providers for the .NET platform.