Skip to content
FunCoding

add-compiler-diagnostic-fix

Official

Use when adding a Roslynator code fix for C# compiler error CS#### or RCF####, editing Diagnostics.xml or CodeFixes.xml, or when compiler-diagnostic-fixes-testing.md shows XunitCompilerDiagnosticFixVerifier or bare DiagnosticId like "CS0106" — in-repo uses AbstractCSharpCompilerDiagnosticFixVerifier and CompilerDiagnosticIdentifiers. Contributor how-to exists but testing page targets NuGet consumers.

Star
3,506
Last commit
Nov 1, 2026

.claude/skills/add-compiler-diagnostic-fix/SKILL.md

View on GitHub

Add Compiler Diagnostic Fix

Overview

Compiler fixes use Diagnostics.xml + CodeFixes.xml → codegen → CompilerDiagnosticCodeFixProvider → test. Contributor how-to: how-to-add-compiler-diagnostic-fix. Do not follow compiler-diagnostic-fixes-testing alone — it targets NuGet consumers.

When to Use

  • New fix for CS#### compiler diagnostic
  • New RCF#### entry linking one or more CS ids
  • Extending fix coverage for an existing compiler error

Not for: Roslynator analyzers (add-analyzer), refactorings (add-refactoring).

Gate: approved GitHub issue (CONTRIBUTING.md).

Read references/implementation.md before writing tests.

Confirm metadata parameters (hard gate)

STOP. Do NOT edit Diagnostics.xml / CodeFixes.xml, run codegen, or implement until the user has confirmed every required parameter below. Do not invent titles or identifiers when the user (or issue) did not state them.

Use AskQuestion when available; otherwise ask conversationally. Batch related choices.

ParameterRequired?Notes
Compiler CS#### id(s)yesOne RCF may fix multiple CS ids
New Diagnostics.xml entry?if CS not already catalogedConfirm Title / Message / HelpUrl (usually from Microsoft docs)
RCF IdproposeCompute next free RCF#### from CodeFixes.xml, or extend an existing RCF when appropriate; do not ask unless ambiguous
IdentifieryesPascalCase for the code fix
TitleyesCode-fix menu / docs title
Code action titleyesString passed to CodeAction.Create (may match or differ from XML Title)

When proposing RCF Id, state the chosen value in your plan/summary (e.g. “using next free RCF0121”). Skip asking other parameters only when the approved issue or the user's message already states the value explicitly.

Quick Reference

StepLocation
Diagnostic catalogsrc/Diagnostics.xml
Fix metadatasrc/CodeFixes.xml
Codegencd tools && pwsh ./generate_code.ps1
Providersrc/CodeFixes/CSharp/CodeFixes/
Testssrc/Tests/CodeFixes.Tests/CS####IdentifierTests.cs
ChangelogCHANGELOG.md

Implementation

  1. Confirm metadata parameters (hard gate above).
  2. Full XML, provider, and test patterns: references/implementation.md.

Changelog:

- Add code fix "TITLE" for CS#### ([#PR](https://github.com/dotnet/roslynator/pull/PR))

Verify:

cd tools && pwsh ./generate_code.ps1
cd src && dotnet build Roslynator.sln
cd src && dotnet test Tests/CodeFixes.Tests --no-build --filter "FullyQualifiedName~CS####"
cd src && dotnet format Roslynator.sln --no-restore --verify-no-changes --severity info

Common Mistakes

MistakeFix
Guess RCF Title / Identifier / code-action stringAsk — hard gate above
Follow compiler-diagnostic-fixes-testing.mdIn-repo: AbstractCSharpCompilerDiagnosticFixVerifier
DiagnosticId = "CS0106" literalUse CompilerDiagnosticIdentifiers.CS####_Identifier constant
`[...
Skip IsEnabled in providerRequired for EditorConfig / global compiler-fix toggles
Only read testing docAlso need Diagnostics.xml, CodeFixes.xml, codegen, provider base
Codegen from repo rootcd tools && pwsh ./generate_code.ps1

Similar Skills

reverse-engineer-anything

MOmorluto/rea485k9,215 new stars in the last 7 days

reverse-engineer-anything

MOmorluto/rea485k9,215 new stars in the last 7 days

test-driven-development

OBobra/superpowers331k5,757 new stars in the last 7 days

agent-runtime-gateway-smoke-test

AFaffaan-m/ECC314k4,125 new stars in the last 7 days

ai-regression-testing

AFaffaan-m/ECC314k4,125 new stars in the last 7 days

Featured

accessibility

Audit accessibility on Web, iOS, and Android to meet WCAG 2.2, with keyboard navigation and screen-reader support.

AFaffaan-m/ECC314k4,125 new stars in the last 7 days