# dotnet-roslyn-analyzers

The dotnet-roslyn-analyzers Claude Code skill guides work on Roslyn analyzers, code fixes, and refactorings. It activates when an agent is asked to build custom C# diagnostics.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode, Windsurf (Devin Desktop), Claude.ai · 100 installs · ★ 92 repo stars
- Author: wshaddix
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/wshaddix/dotnet-skills/tree/HEAD/skills/dotnet-roslyn-analyzers/SKILL.md
- Updated: 2026-02-27
- Security check: automated, 2026-11-17 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/skills/dotnet-roslyn-analyzers

## What it does

The skill covers authoring Roslyn analyzers, code-fix and refactoring providers, plus diagnostic suppressors. It walks through project setup, analysis-context registration, diagnostic conventions, tests, NuGet packaging, and performance considerations.

Analyzer projects must target `netstandard2.0`. The examples use `Microsoft.CodeAnalysis.CSharp` and `Microsoft.CodeAnalysis.Analyzers`, and the guidance spans Roslyn versions 3.8 through 4.14. Its scope is building analyzer tooling, rather than configuring existing rules.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add wshaddix/dotnet-skills --skill dotnet-roslyn-analyzers -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/dotnet-roslyn-analyzers/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/dotnet-roslyn-analyzers/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add wshaddix/dotnet-skills --skill dotnet-roslyn-analyzers -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/dotnet-roslyn-analyzers/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add wshaddix/dotnet-skills --skill dotnet-roslyn-analyzers -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/dotnet-roslyn-analyzers/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install wshaddix/dotnet-skills skills/dotnet-roslyn-analyzers
```

2. **Manually: put the files in place**
- File: `.github/skills/dotnet-roslyn-analyzers/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add wshaddix/dotnet-skills --skill dotnet-roslyn-analyzers -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/wshaddix/dotnet-skills --path skills/dotnet-roslyn-analyzers
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/dotnet-roslyn-analyzers/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add wshaddix/dotnet-skills --skill dotnet-roslyn-analyzers -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/wshaddix/dotnet-skills/tree/HEAD/skills/dotnet-roslyn-analyzers/SKILL.md

## When to use it
- build a Roslyn analyzer for a C# code pattern
- attach a code fix to a diagnostic
- create a refactoring provider
- target multiple Roslyn versions in an analyzer project

## Example prompts
- Write a Roslyn analyzer that flags public fields in C#.
- Add a code fix for this diagnostic and choose the analysis registration.
- Set up an analyzer project to support several Roslyn versions.

## Similar
- [roslyn-analyzers](https://affpapa.org/en/nevibecode/skills/roslyn-analyzers.md) — skill · 30 installs
- [Roslyn CodeLens](https://affpapa.org/en/nevibecode/mcp/roslyn-codelens.md) — MCP server · ★ 75 repo stars
- [dotnet-best-practices](https://affpapa.org/en/nevibecode/skills/dotnet-best-practices.md) — skill · 15752 installs
- [dotnet-patterns](https://affpapa.org/en/nevibecode/skills/dotnet-patterns.md) — skill · 6300 installs
- [analyzing-dotnet-performance](https://affpapa.org/en/nevibecode/skills/analyzing-dotnet-performance.md) — skill · 6200 installs
- [dotnet-webapi](https://affpapa.org/en/nevibecode/skills/dotnet-webapi.md) — skill · 5600 installs

From the same set: [wshaddix/dotnet-skills](https://affpapa.org/en/nevibecode/by/wshaddix/dotnet-skills.md) — 24 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
