roslyn-analyzers
Skill40k starsChanged 2 months agoMITView on GitHub
Build, review, debug, package, and test Roslyn diagnostic analyzers, code fix providers, and incremental source generators. Use for DiagnosticAnalyzer, CodeFixProvider, IIncrementalGenerator, IOperation analysis, Microsoft.CodeAnalysis dependency pinning, Roslyn test harnesses, C#/VB tests, and analyzer NuGet packaging.
Trending
More talk lately.about the whole repository
Who's talking about github/awesome-copilot
- vercel-labs/skills“[Bug]: `npx skills update <skill-name>` adds all other skills from the skill repo”GitHub · Apr 12, 2026 · 46 reactions
- @vscode.dev“Less vibes, more standards. Custom instructions, prompts, and chat modes for Copilot → …”Bluesky · Jul 2, 2025 · 28 likes
- microsoft/copilot-intellij-feedback“Support for *.instructions.md files in IntelliJ for project-scoped Copilot customization”GitHub · Jul 9, 2025 · 25 reactions
- @aaron-powell.com“I did an overhaul of the Awesome Copilot README to make it easier to install the prompts, instructions, and …”Bluesky · Aug 20, 2025 · 14 likes
- vercel-labs/skills“[Bug]: `npx skills update` downloads entire repository instead of specific skill when using subpaths”GitHub · Apr 26, 2026 · 6 reactions
The biggest 5 of 79 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 79
Talked about on Bluesky, GitHub and Hacker News (79 times).
On Bluesky · 42
- Jul 2, 2025Less vibes, more standards. Custom instructions, prompts, and chat modes for Copilot → github.com/github/aweso... — @vscode.dev28 likes and reposts
- Aug 20, 2025I did an overhaul of the Awesome Copilot README to make it easier to install the prompts, instructions, and chat modes to VS Code - there… — @aaron-powell.com14 likes and reposts
- Jul 31, 2025Fixed a bug on github.com/github/aweso... so you can now one-click add Chat Modes to your VS Code environment (it worked for prompts and… — @aaron-powell.com5 likes and reposts
- Jul 1, 2025Community-contributed instructions, prompts, and configurations to help you make the most of GitHub Copilot. github.com/github/aweso... — @garrytrinder.dev5 likes and reposts
- Jul 3, 2025Want GitHub Copilot to follow the most modern best practices in your language of choice? Guide it with custom instructions, starting from… — @pamelafox.bsky.social4 likes and reposts
37 more on Bluesky
- Oct 1, 2026📦 github / awesome-copilot ⭐ 39,586 (+59) 🗒 JavaScript Community-contributed instructions, agents, skills, and configurations to help you… — @github-trending-js.bsky.social3 likes and reposts
- Mar 5, 2026It's honestly been a lot of a trial and error for me. I did do some training at work but applying it to real-world problems and picking the… — @adamrdriscoll.com3 likes and reposts
- Dec 11, 2025🔥 Hot Repo! 🔥 (100+ new stars) 📦 github / awesome-copilot ⭐ 13,991 (+111) 🗒 JavaScript Community-contributed instructions, prompts, and… — @github-trending-js.bsky.social3 likes and reposts
- Oct 23, 2025📦 github / awesome-copilot ⭐ 10,301 (+73) 🗒 JavaScript Community-contributed instructions, prompts, and configurations to help you make… — @github-trending-js.bsky.social3 likes and reposts
- Sep 25, 2025🔥 Hot Repo! 🔥 (100+ new stars) 📦 github / awesome-copilot ⭐ 8,027 (+102) 🗒 JavaScript Community-contributed instructions, prompts, and… — @github-trending-js.bsky.social3 likes and reposts · 1 reply
- Jul 4, 2025👀 Check this :A community-powered repo to enhance your GitHub Copilot experience > shared prompts, instructions, and configs so Copilot… — @elbruno.com3 likes and reposts
- Sep 24, 2026📦 github / awesome-copilot ⭐ 39,304 (+43) 🗒 JavaScript Community-contributed instructions, agents, skills, and configurations to help you… — @github-trending-js.bsky.social2 likes and reposts
- Aug 26, 2026📦 github / awesome-copilot ⭐ 38,267 (+44) 🗒 JavaScript Community-contributed instructions, agents, skills, and configurations to help you… — @github-trending-js.bsky.social2 likes and reposts
- Mar 7, 2026github / awesome-copilot Community-contributed instructions, prompts, and configurations to help you make the most of GitHub Copilot.… — @pythonhub.dev2 likes and reposts
- Mar 1, 2026Community-curated collection of specialized agents, instructions, and workflows that transform GitHub Copilot from basic autocomplete into… — @arifsolmaz.bsky.social2 likes and reposts
- Feb 26, 2026🔥 Hot Repo! 🔥 (100+ new stars) 📦 github / awesome-copilot ⭐ 22,634 (+146) 🗒 JavaScript Community-contributed instructions, prompts, and… — @github-trending-js.bsky.social2 likes and reposts
- Jan 10, 2026🔥 Hot Repo! 🔥 (100+ new stars) 📦 github / awesome-copilot ⭐ 16,762 (+165) 🗒 JavaScript Community-contributed instructions, prompts, and… — @github-trending.bsky.social2 likes and reposts
- Dec 2, 2025📦 github / awesome-copilot ⭐ 13,317 (+77) 🗒 JavaScript Community-contributed instructions, prompts, and configurations to help you make… — @github-trending-js.bsky.social2 likes and reposts
- Nov 19, 2025Awesome GitHub Copilot Customizations github.com/github/aweso... — @adamrdriscoll.com2 likes and reposts
- Nov 7, 2025📦 github / awesome-copilot ⭐ 11,436 (+79) 🗒 JavaScript Community-contributed instructions, prompts, and configurations to help you make… — @github-trending-js.bsky.social2 likes and reposts
- Oct 9, 2025I've enrolled the Awesome Copilot repo for #Hacktoberfest, so if you want to join the challenge, you now can with github.com/github/aweso... — @aaron-powell.com2 likes and reposts
- Nov 3, 2026📦 github / awesome-copilot ⭐ 40,747 (+52) 🗒 JavaScript Community-contributed instructions, agents, skills, and configurations to help you… — @github-trending-js.bsky.social1 likes and repost · 1 reply
- Oct 28, 2026📦 github / awesome-copilot ⭐ 40,463 (+45) 🗒 JavaScript Community-contributed instructions, agents, skills, and configurations to help you… — @github-trending-js.bsky.social1 likes and repost · 1 reply
- Sep 11, 2026📦 github / awesome-copilot ⭐ 38,893 (+53) 🗒 JavaScript Community-contributed instructions, agents, skills, and configurations to help you… — @github-trending-js.bsky.social1 likes and repost
- Mar 17, 2026Vous connaissez peut être le repository Github awesome-copilot (github.com/github/aweso...) contenant des skills, prompts, etc. pour Github… — @devdevdev.net1 likes and repost
- Feb 20, 2026🔥 Hot Repo! 🔥 (100+ new stars) 📦 github / awesome-copilot ⭐ 21,816 (+133) 🗒 JavaScript Community-contributed instructions, prompts, and… — @github-trending-js.bsky.social1 likes and repost
- Feb 5, 2026🔥 Hot Repo! 🔥 (100+ new stars) 📦 github / awesome-copilot ⭐ 20,129 (+137) 🗒 JavaScript Community-contributed instructions, prompts, and… — @github-trending-js.bsky.social1 likes and repost
- Jan 28, 2026🔥 Hot Repo! 🔥 (100+ new stars) 📦 github / awesome-copilot ⭐ 19,270 (+147) 🗒 JavaScript Community-contributed instructions, prompts, and… — @github-trending-js.bsky.social1 likes and repost
- Jan 15, 2026🔥 Hot Repo! 🔥 (100+ new stars) 📦 github / awesome-copilot ⭐ 17,630 (+180) 🗒 JavaScript Community-contributed instructions, prompts, and… — @github-trending-js.bsky.social1 likes and repost
- Dec 31, 2025🔥 Hot Repo! 🔥 (100+ new stars) 📦 github / awesome-copilot ⭐ 15,940 (+100) 🗒 JavaScript Community-contributed instructions, prompts, and… — @github-trending-js.bsky.social1 likes and repost
- Dec 20, 2025🚀 Skyrocketing! 🚀 (200+ new stars) 📦 github / awesome-copilot ⭐ 14,836 (+217) 🗒 JavaScript Community-contributed instructions, prompts,… — @github-trending.bsky.social1 likes and repost
- Dec 19, 2025🔥 Hot Repo! 🔥 (100+ new stars) 📦 github / awesome-copilot ⭐ 14,605 (+172) 🗒 JavaScript Community-contributed instructions, prompts, and… — @github-trending-js.bsky.social1 likes and repost
- Dec 6, 2025📦 github / awesome-copilot ⭐ 13,645 (+52) 🗒 JavaScript Community-contributed instructions, prompts, and configurations to help you make… — @github-trending-js.bsky.social1 likes and repost
- Nov 23, 202511월의 남은 쿼터를 소진하기 위한 작업은 Chatmode + Agent 지원방법에 대한 공부. 이번달은 대부분 직접 코딩하거나, GPT5-mini를 사용했기 때문에 Sonnet 펑펑 돌리면서 공부해도 되겠다. Chatmode 기반으로 작업할때는… — @luncliff.bsky.social1 likes and repost
- Nov 12, 2025🔥 Hot Repo! 🔥 (100+ new stars) 📦 github / awesome-copilot ⭐ 11,788 (+110) 🗒 JavaScript Community-contributed instructions, prompts, and… — @github-trending-js.bsky.social1 likes and repost
- Nov 1, 2025🔥 Hot Repo! 🔥 (100+ new stars) 📦 github / awesome-copilot ⭐ 10,993 (+115) 🗒 JavaScript Community-contributed instructions, prompts, and… — @github-trending-js.bsky.social1 likes and repost
- Oct 1, 2025📦 github / awesome-copilot ⭐ 8,546 (+91) 🗒 JavaScript Community-contributed instructions, prompts, and configurations to help you make… — @github-trending.bsky.social1 likes and repost
- Sep 23, 2025Join the AMA at 4PM SF time, here: discord.gg/YZbkuKb3?eve... Check out the awesome-copilot repo, here: github.com/github/aweso... — @nonfamous.bsky.social1 likes and repost · 1 reply
- Aug 15, 2025Shape Copilot to your workflow. Use the Awesome-Copilot repo’s custom instructions, reusable prompts, and chat modes to get AI suggestions… — @martinrojas.dev1 likes and repost
- Jul 2, 2025Awesome GitHub Copilot Customizations github.com/github/aweso... #GitHub #Copilot #GitHubCopilot — @yzhums.bsky.social1 likes and repost
- Nov 19, 2026📦 github / awesome-copilot ⭐ 41,301 (+61) 🗒 JavaScript Community-contributed instructions, agents, skills, and configurations to help you… — @github-trending-js.bsky.social0 likes and reposts · 1 reply
- Jan 22, 2026🔥 Hot Repo! 🔥 (100+ new stars) 📦 github / awesome-copilot ⭐ 18,469 (+149) 🗒 JavaScript Community-contributed instructions, prompts, and… — @github-trending-js.bsky.social0 likes and reposts · 1 reply
On GitHub · 32
- Apr 12, 2026[Bug]: `npx skills update <skill-name>` adds all other skills from the skill repo — vercel-labs/skills46 reactions · 8 comments
- Jul 9, 2025Support for *.instructions.md files in IntelliJ for project-scoped Copilot customization — microsoft/copilot-intellij-feedback25 reactions · 9 comments
- Apr 26, 2026[Bug]: `npx skills update` downloads entire repository instead of specific skill when using subpaths — vercel-labs/skills6 reactions · 4 comments
- Jul 16, 2026docs(agent-skills): point the public catalog at the public org — chainguard-dev/edu2 reactions · 3 comments
- Jun 21, 2026[Feature]: Is there a way to specify .github/skills as the install location for skills? — vercel-labs/skills2 reactions
27 more on GitHub
- Oct 31, 2025Links to awesome-copilot are broken and result in 404 — github/docs2 reactions · 2 comments
- Nov 12, 2026https://github.com/github/awesome-copilot/blob/b13e55f85ffdf451d40d09839cb1e337bf3eda98/skills%2Fdebian-linux-triage%2FSKILL.md — CypherpunkArmory/UserLAnd1 reaction
- Oct 30, 2026feat(skills): add public Git installation to the CLI — alex-de-haas/docker-host1 reaction · 2 comments
- Oct 28, 2026docs(skills): correct the [dependabot skip] wording in the dependabot skill — docdyhr/mcp-wordpress1 reaction · 3 comments
- Sep 25, 2026Unblock learning-hub activation job by bumping blocked gh-aw compile version — Vbddr/awesome-copilot1 reaction · 1 comment
- Sep 24, 2026Automate agent package releases — socialbu/socialbu-agent1 reaction · 13 comments
- Sep 20, 2026fix(deps): clear Critical Dependabot alert for astro — Wicked-Sick-Ltd/awesome-copilot1 reaction
- Sep 20, 2026fix(security): CodeQL clear-text storage + hostBridge allowlist (#1–#2) — Wicked-Sick-Ltd/awesome-copilot1 reaction
- Sep 10, 2026Create Skill.md — 1napz/crystalcastleX1 reaction
- Sep 4, 2026fix(plugin): conform manifest to Agent Plugins 1.0.0 — BigCactusLabs/blotter1 reaction · 1 comment
- Aug 31, 2026fix(agents): launch Droid at High autonomy in yolo mode — stablyai/orca1 reaction · 3 comments
- Aug 21, 2026chore(skills): awesome-copilot update candidate 83561bd7 — KraineOpasen/bukerov-twitch-miner-go1 reaction
- Aug 10, 2026Bundled github-issues skill documents an unsafe shell-quoting pattern, and its locus is a synced file — devantler-tech/agent-plugins1 reaction · 1 comment
- Jul 23, 2026Plugin plan — charlyautomatiza/playwright-plugin1 reaction
- Jun 9, 2026Problem with the description length on using `az boards work-item create` — Azure/azure-cli1 reaction · 4 comments
- May 26, 2026[BUG] Unable to specify Skills/Agents when installing via the UI — runkids/skillshare1 reaction · 1 comment
- May 16, 2026[Ensure Agent skills follow the standards] — ralphke/Agentic-Coding1 reaction · 3 comments
- Apr 13, 2026Simplify, transfer/reorganize `.github/copilot-instructions.md` into `AGENTS.md` and other more appropriate agent context files — huanshankeji/compose-multiplatform-html-unified1 reaction · 1 comment
- Apr 9, 2026[broken-links] Broken external links detected (2 confirmed 404s) — htekdev/gh-aw-overview1 reaction
- Mar 31, 2026Add the awesome-copilot repo-architect agent to this repository — derecskey/valleypaintingco1 reaction
- Mar 22, 2026Add createagents.md skill — sparkfabrik/sf-agents-harness1 reaction
- Mar 22, 2026Code architecture inspection — davidamitchell/Research1 reaction
- Mar 10, 2026Git fatal: destination path error due to Windows long paths in Extensions view — microsoft/vscode1 reaction
- Mar 4, 2026Migrate to copilot-sdk — george-cz/ai-plan-comparator1 reaction
- Feb 6, 2026Add plugins for other Microsoft owned MCPs (Docs, playwright, etc). — github/copilot-plugins1 reaction · 2 comments
- Dec 25, 2025リポジトリ内の全ファイルの日本語への翻訳 — yamayuski/awesome-copilot1 reaction
- Oct 19, 2025File protocol handler for installing custom instructions, prompts, and chat modes — github/CopilotForXcode1 reaction
On Hacker News · 5
- Nov 11, 2025Copilot modes you probably didn't know exist4 points · 1 comment
- Aug 10, 2025Awesome-copilot: Community-contributed instructions, prompts, and configurations3 points
- Feb 17, 2026Rug – Repeat Until Good1 point
- Dec 22, 2025Gilfoyle code review agent skill that roasts your code1 point
- Oct 28, 2025GitHub Copilot Customizations1 point
In this repository448 other files it gives its agents.
- AGENTS.mdAGENTS.md
- skills/repo-standardizer/templates/AGENTS.mdAGENTS.md
- skills/setup-my-iq/assets/templates/AGENTS.mdAGENTS.md
- skills/repo-standardizer/templates/CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- agentic-workflowsSkill
- code-reviewSkill
- create-canvas-extensionSkill
- acquire-codebase-knowledgeSkill
- acreadiness-assessSkill
- acreadiness-generate-instructionsSkill
- acreadiness-policySkill
- ad-campaign-analyzerSkill
- add-educational-commentsSkill
- adobe-illustrator-scriptingSkill
- agent-architectureSkill
- agent-governanceSkill
- agentic-evalSkill
- agent-owasp-complianceSkill
- agent-skill-stackSkill
- agent-supply-chainSkill
- ai-prompt-engineering-safety-reviewSkill
- ai-readySkill
- ai-team-orchestrationSkill
- anti-ui-slopSkill
- api-breaking-change-detectorSkill
- appinsights-instrumentationSkill
- apple-appstore-reviewerSkill
- architecture-blueprint-generatorSkill
- arch-linux-triageSkill
- arduino-azure-iot-edge-integrationSkill
- arize-ai-provider-integrationSkill
- arize-annotationSkill
- arize-datasetSkill
- arize-evaluatorSkill
- arize-experimentSkill
- arize-instrumentationSkill
- arize-linkSkill
- arize-prompt-optimizationSkill
- arize-traceSkill
- aspireSkill
- aspnet-minimal-api-openapiSkill
- audit-integritySkill
- automate-thisSkill
- autoresearchSkill
- aws-cdk-python-setupSkill
- aws-cloudwatch-investigationSkill
- aws-cost-optimizeSkill
- aws-resource-health-diagnoseSkill
- aws-resource-querySkill
- aws-well-architected-reviewSkill
- az-cost-optimizeSkill
- azure-architecture-autopilotSkill
- azure-container-registry-cliSkill
- azure-deployment-preflightSkill
- azure-developer-cliSkill
- azure-devops-cliSkill
- azure-pricingSkill
- azure-resource-health-diagnoseSkill
- azure-resource-visualizerSkill
- The first 60 shown.
The file
Show its rules and text
We split this skill into the rules it gives an agent
38 rules. About 0 are common, 19 are distinctive, and 19 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈19
Distinctive · estimate
This author's own choices. Worth a look.
19
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 12
Prefer IOperation-based analysis wherever possible.
- Distinctive: line 15
Keep analyzer and code-fix providers in distinct assemblies.
- Very specific: line 18
Avoid InternalsVisibleTo. Test analyzers through their public DiagnosticAnalyzer and CodeFixProvider APIs and the Roslyn test harness.
- Very specific: line 21
Document every diagnostic ID.
- Distinctive: line 28
Write down examples that must report and near-misses that must not report.
- Very specific: line 32
Add or update the diagnostic's documentation page and wire the descriptor's HelpLinkUri to its published URL.
- Distinctive: line 34
Add or update the code fix in the separate code-fix assembly.
- Distinctive: line 35
Add positive, negative, edge, and code-fix tests in one test class for the rule.
- Distinctive: line 36
Verify that every analyzer project has per-commit assembly versioning and that its project-local version configuration is actually honored.
- Very specific: line 37
Run the narrow test class or method first, then the test project, then the repository's normal build or analyzer validation.
- Very specific: line 109
When supporting both languages, use [DiagnosticAnalyzer(LanguageNames.CSharp, LanguageNames.VisualBasic)] only if all analysis and …
- Distinctive: line 113
Use syntax callbacks only when syntax itself controls the rule.
- Very specific: line 124
Before choosing this pattern, check whether IInvocationOperation.TargetMethod, IArgumentOperation.Parameter, IConversionOperation, or …
- Very specific: line 128
Always implement IIncrementalGenerator.
- Very specific: line 132
Use SyntaxProvider.ForAttributeWithMetadataName for attribute-driven discovery.
- Very specific: line 134
Keep independent inputs in independent providers.
- Very specific: line 135
Avoid Collect() unless one output truly depends on the complete set.
- Very specific: line 136
Use stable equality. Records and immutable value types are good models.
- Distinctive: line 137
Keep transforms and output callbacks static, pure, deterministic, and cancellation-aware.
- Very specific: line 141
Use SourceText with an explicit encoding when calling AddSource.
- Very specific: line 181
Test source generators with GeneratorDriver or the repository's generator test harness.
- Distinctive: line 196
Create one discoverable documentation page for every diagnostic code.
- Distinctive: line 205
If the repository has a Docfx site, place these pages under its existing analyzer documentation area, typically:
- Distinctive: line 248
Use this three-part pattern.
- Very specific: line 306
Do not set its central version to $(CodeAnalysisVersionForAnalyzers) and do not include it among packages excluded from minor or major …
- Distinctive: line 323
Verify dependency isolation with a restore graph or assets file and, when practical, load the built analyzer in the oldest supported …
- Very specific: line 332
use Simplifier.Annotation and Formatter.Annotation where appropriate.
- Distinctive: line 335
use a meaningful, stable equivalence key, especially when multiple fixes share a title.
- Distinctive: line 373
When C# source is assigned to a local variable instead of passed directly to an annotated parameter, add a language comment before the …
- Distinctive: line 381
Prefer inline markup to hard-coded line/column spans:
- Distinctive: line 427
If there is no code fix:
- Distinctive: line 433
When VB support is required, use the corresponding Visual Basic verifier and include VB source, fixed source, and negative snippets.
- Distinctive: line 443
every offered code action and equivalence key.
- Distinctive: line 448
Prefer reference-assembly definitions supplied by the test framework over references copied from the executing runtime.
- Very specific: line 461
Every source generator implements IIncrementalGenerator, uses immutable equatable pipeline models, and has tests proving cached and …
- Distinctive: line 463
No syntax callback fetches another semantic model.
- Very specific: line 472
Every diagnostic ID has a documentation page, is present in site navigation, and has a HelpLinkUri matching the published URL.
- Very specific: line 473
Every analyzer project produces a unique assembly version per commit.
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 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
Roslyn Analyzers and Source Generators
Use this workflow when adding or changing a Roslyn analyzer, code fix, source generator, tests, dependencies, or package layout. First inspect the repository's target frameworks, central package management, test framework, analyzer and generator conventions, diagnostic ID allocation, localization, and packaging. Preserve established conventions unless they conflict with the compatibility rules below.
Non-negotiable design rules
- Prefer
IOperation-based analysis wherever possible. Register the narrowest applicableOperationKindand inspect typed operations such asIInvocationOperation,IAwaitOperation, orIObjectCreationOperation. This usually supports C# and VB with one analyzer and gives direct access to symbols and conversions. - Use syntax analysis only for inherently syntactic rules or syntax not represented adequately by
IOperation. A syntax-node callback already has aSemanticModel; do not callCompilation.GetSemanticModelor fetch another semantic model from it. Repeated semantic-model creation is expensive and often indicates that an operation or symbol action is the better abstraction. - Every analyzer must support C#. VB.NET support is optional until requested or established repository precedent requires it. A language-neutral operation analyzer may declare both languages. If VB support is promised, include equivalent C# and VB snippets in tests; do not infer VB correctness from shared implementation alone.
- Keep analyzer and code-fix providers in distinct assemblies. The analyzer project must never reference Roslyn Workspaces packages. Workspaces dependencies belong only in the code-fix and test projects.
- Analyzer callbacks must be stateless or concurrency-safe. Call
EnableConcurrentExecution(). Make an explicit generated-code choice withConfigureGeneratedCodeAnalysis(...); follow repository policy rather than silently accepting the default. - Respect cancellation where APIs expose a token. Do not retain compilations, operations, syntax trees, symbols, or semantic models in static state.
- Avoid
InternalsVisibleTo. Test analyzers through their publicDiagnosticAnalyzerandCodeFixProviderAPIs and the Roslyn test harness. A small analyzer helper may be public when direct testing is genuinely useful, but most behavior should be tested end to end. - Centralize metadata names and member names instead of propagating magic strings. Use one shared static catalog for fully qualified type names, namespaces, and API member names.
- Never identify a symbol, including an attribute class, by calling
ToDisplayString()and comparing the result with a string literal. Resolve an expected named type from theCompilationonce by metadata name. To resolve a method, property, field, or event, first resolve its containing type, then select the expected member by name and signature. Compare encountered symbols withSymbolEqualityComparer.Default.Equals(actual, expected). When generic substitutions are irrelevant, compare named types, properties, fields, and events byOriginalDefinition; compare methods after replacing a reduced extension method withReducedFrom ?? methodand then takingOriginalDefinition. Normalize both expected and encountered symbols, and inspect type arguments separately when they are part of the match. Display strings are for presentation, not identity, and can vary with formatting, aliases, qualification, nullability, and other context. - Document every diagnostic ID. When the repository uses Docfx, put analyzer documentation under its Docfx tree, typically
docfx/analyzers, and include each page in the relevant table of contents. - Set every analyzer assembly's version precisely enough that each commit produces a unique assembly version. When using Nerdbank.GitVersioning, give each analyzer project its own
version.jsonwithassemblyVersion.precisionset torevisionand ensure that repository-wide MSBuild properties do not prevent that file from being discovered. - Source generators must implement
IIncrementalGenerator, notISourceGenerator. Design the provider graph so unchanged inputs remain cached and do not regenerate output. - Source generators must use a small
SourceWriterabstraction for deterministic newlines, indentation, encoding, and balanced output. Start from SourceWriter.cs and tailor its namespace and target-framework details to the receiving repository.
Implementation workflow
- Write down examples that must report and near-misses that must not report. Decide the exact diagnostic span and message arguments before implementation.
- Determine whether the rule is semantic. Prefer, in order, operation actions, operation-block actions, symbol actions, compilation-start actions that register one of those actions, and finally syntax actions.
- Resolve well-known named types once in a compilation-start action with
Compilation.GetTypeByMetadataNamewhen needed. Resolve expected members from the resulting containing type by name and full signature;GetTypeByMetadataNamedoes not resolve methods, properties, fields, or events. If a required type or member is absent, register no inner action. Capture the resolvedISymbolin the registered callback and compare encountered symbols withSymbolEqualityComparer.Default.Equals. When generic substitutions are irrelevant, normalize both expected and encountered named types, properties, fields, and events withOriginalDefinitionbefore comparing them; this includes comparingAttributeData.AttributeClasswith a resolved generic attribute definition. For methods, normalize eachIMethodSymbolwith(method.ReducedFrom ?? method).OriginalDefinitionso constructed generic and reduced extension methods match their declaration. Inspect type arguments separately when they matter. Never useToDisplayString()plus a string literal as a substitute for symbol identity. Check metadata names, arity, containing type, and signature as appropriate when selecting members; do not identify APIs by simple method name alone. - Define a stable diagnostic ID and descriptor. Follow repository practices for category, severity, localization, help links, telemetry tags, and release tracking.
- Add or update the diagnostic's documentation page and wire the descriptor's
HelpLinkUrito its published URL. - Report the smallest useful source location. Avoid diagnostics on generated code unless that is intentional.
- Add or update the code fix in the separate code-fix assembly. Preserve trivia, use syntax generators or typed syntax APIs, annotate simplifiable/formattable nodes where appropriate, provide stable equivalence keys for distinct actions, and offer
FixAllProvideronly when batch application is correct. - Add positive, negative, edge, and code-fix tests in one test class for the rule.
- Verify that every analyzer project has per-commit assembly versioning and that its project-local version configuration is actually honored.
- Run the narrow test class or method first, then the test project, then the repository's normal build or analyzer validation. Honor the repository's test-runner syntax; do not assume VSTest
--filteris supported.
For a source generator, replace steps 1-8 with: define generated API examples and invalid-input diagnostics; model each independent input; build an incremental provider graph; render with SourceWriter; and test output, diagnostics, determinism, and incremental caching before continuing with versioning, packaging, and repository validation.
Analyzer pattern
This is the preferred shape for a semantic rule. Adapt descriptor construction and generated-code policy to local conventions.
using System.Collections.Immutable;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Operations;
[DiagnosticAnalyzer(LanguageNames.CSharp)]
public sealed class AvoidBlockingAnalyzer : DiagnosticAnalyzer
{
public const string DiagnosticId = "LIB0001";
private static readonly DiagnosticDescriptor Rule = new(
DiagnosticId,
"Avoid blocking calls",
"Do not call '{0}'",
"Usage",
DiagnosticSeverity.Warning,
isEnabledByDefault: true);
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics => [Rule];
public override void Initialize(AnalysisContext context)
{
context.EnableConcurrentExecution();
context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.None);
context.RegisterCompilationStartAction(static context =>
{
INamedTypeSymbol? taskType = context.Compilation.GetTypeByMetadataName(KnownApis.Task.FullName);
if (taskType is null)
{
return;
}
context.RegisterOperationAction(
operationContext => AnalyzeInvocation(operationContext, taskType),
OperationKind.Invocation);
});
}
private static void AnalyzeInvocation(OperationAnalysisContext context, INamedTypeSymbol taskType)
{
var invocation = (IInvocationOperation)context.Operation;
IMethodSymbol method = invocation.TargetMethod;
if (method.Name == KnownApis.Task.Wait &&
SymbolEqualityComparer.Default.Equals(method.ContainingType, taskType))
{
context.ReportDiagnostic(Diagnostic.Create(
Rule,
invocation.Syntax.GetLocation(),
method.Name));
}
}
}
public static class KnownApis
{
public static class Task
{
public const string FullName = "System.Threading.Tasks.Task";
public const string Wait = "Wait";
}
}When supporting both languages, use [DiagnosticAnalyzer(LanguageNames.CSharp, LanguageNames.VisualBasic)] only if all analysis and diagnostic locations are actually language-neutral or both languages are separately handled and tested.
Syntax-analysis exception
Use syntax callbacks only when syntax itself controls the rule. Use the callback's existing semantic model if semantic information is unavoidable:
private static void AnalyzeNode(SyntaxNodeAnalysisContext context)
{
var invocation = (InvocationExpressionSyntax)context.Node;
ISymbol? symbol = context.SemanticModel.GetSymbolInfo(invocation, context.CancellationToken).Symbol;
// Do not call context.Compilation.GetSemanticModel(invocation.SyntaxTree).
}Before choosing this pattern, check whether IInvocationOperation.TargetMethod, IArgumentOperation.Parameter, IConversionOperation, or another operation supplies the same information.
Incremental source generators
Always implement IIncrementalGenerator. Do not wrap an ISourceGenerator with AsSourceGenerator; that preserves the old execution model rather than designing for incrementality.
Build a pipeline with these properties:
- Use
SyntaxProvider.ForAttributeWithMetadataNamefor attribute-driven discovery. Otherwise, useCreateSyntaxProviderwith a very cheap syntactic predicate and perform semantic work only in its transform. - Transform syntax and symbols immediately into small immutable, value-equatable models containing only information needed for generation. Do not carry
SyntaxNode,ISymbol,SemanticModel, orCompilationinto later stages because their identity changes defeat caching. - Keep independent inputs in independent providers. Combine providers as late as possible. Avoid combining every item with
CompilationProvidermerely for convenience. - Avoid
Collect()unless one output truly depends on the complete set. Prefer one output per model so editing one declaration invalidates only that output. - Use stable equality. Records and immutable value types are good models; add
WithComparerwhen normal equality does not represent semantic equivalence. - Keep transforms and output callbacks static, pure, deterministic, and cancellation-aware. Do not read ambient files, clocks, environment state, or mutable static state. Model configuration, additional files, analyzer config options, and parse options as explicit providers.
- Give providers
WithTrackingNamelabels while developing or testing incremental behavior. - Generate stable, collision-resistant hint names. Sort any aggregated inputs explicitly before emitting output.
- Report invalid user input with generator diagnostics instead of throwing. Generator exceptions surface as compiler failures.
- Use
SourceTextwith an explicit encoding when callingAddSource.
A compact pipeline should look like this:
[Generator(LanguageNames.CSharp)]
public sealed class FactoryGenerator : IIncrementalGenerator
{
public void Initialize(IncrementalGeneratorInitializationContext context)
{
IncrementalValuesProvider<TypeModel> models = context.SyntaxProvider
.ForAttributeWithMetadataName(
"Product.GenerateFactoryAttribute",
static (node, _) => node is TypeDeclarationSyntax,
static (attributeContext, cancellationToken) =>
TypeModel.Create(attributeContext, cancellationToken))
.WithTrackingName("FactoryModels");
context.RegisterSourceOutput(models, static (productionContext, model) =>
{
var writer = new SourceWriter();
writer.WriteLine("// <auto-generated/>");
writer.WriteLine($"namespace {model.Namespace};");
writer.WriteLine();
writer.WriteLine($"partial class {model.TypeName}");
writer.WriteLine('{');
writer.Indentation++;
writer.WriteLine($"public static {model.TypeName} Create() => new();");
writer.Indentation--;
writer.WriteLine('}');
productionContext.AddSource(model.HintName, writer.ToSourceText());
});
}
}The model creation step must normalize symbol data into strings, booleans, enums, and other immutable values, validate unsupported declarations, escape identifiers, and derive a stable hint name. The output callback should only render the model. Use the complete SourceWriter.cs example rather than ad hoc StringBuilder concatenation, then adapt indentation style and framework compatibility to the repository.
Generator tests
Test source generators with GeneratorDriver or the repository's generator test harness. Cover:
- exact generated hint names and source text;
- multiple and nested declarations, namespaces, generics, escaped identifiers, and partial types;
- malformed or unsupported inputs and their diagnostic locations;
- additional files, analyzer config options, and parse options when consumed;
- deterministic output independent of input enumeration and operating-system newlines;
- a second driver run with identical inputs that caches all expected tracked steps;
- a narrowly changed input that reruns only the affected pipeline and output;
- compilation of generated output without unexpected diagnostics.
Enable incremental step tracking in tests and assert run reasons such as cached, unchanged, modified, or newly produced according to the Roslyn version in use. Do not settle for snapshot-only tests: identical generated text can hide a pipeline that recomputes everything.
Diagnostic documentation and help links
Create one discoverable documentation page for every diagnostic code. A useful page includes:
- the diagnostic ID, title, category, and default severity;
- the exact condition that triggers the diagnostic;
- why the reported pattern is problematic;
- bad and corrected C# examples;
- VB examples when VB support is promised;
- exceptions, configuration, suppression guidance, and code-fix behavior when relevant.
If the repository has a Docfx site, place these pages under its existing analyzer documentation area, typically:
docfx/
analyzers/
LIB0001.md
toc.ymlFollow the site's existing URL and navigation conventions. Add each page to the applicable toc.yml so it is rendered and discoverable. The descriptor's help link must be the public GitHub Pages URL that Docfx will produce, not a source-tree path. Centralize construction when all diagnostics share a route:
private static string GetHelpLink(string diagnosticId)
=> $"https://example.github.io/product/analyzers/{diagnosticId}.html";
private static readonly DiagnosticDescriptor Rule = new(
id: DiagnosticId,
title: "Avoid blocking calls",
messageFormat: "Do not call '{0}'",
category: "Usage",
defaultSeverity: DiagnosticSeverity.Warning,
isEnabledByDefault: true,
helpLinkUri: GetHelpLink(DiagnosticId));Derive the exact hostname, base path, output extension, casing, and route from the repository's Docfx configuration and deployment setup. Confirm that the generated site's route matches HelpLinkUri; do not merely assume that a Markdown path maps to the expected URL. When no Docfx folder exists, follow the repository's established documentation system or create an equivalent durable page and public help URL.
Project and dependency boundaries
A typical solution has three projects:
Product.Analyzers -> Microsoft.CodeAnalysis.Common/CSharp only
Product.CodeFixes -> Product.Analyzers + Roslyn Workspaces/Features APIs
Product.Analyzers.Tests -> analyzer + code-fix projects + current testing packagesTarget analyzer assemblies conservatively, commonly netstandard2.0, unless host requirements dictate otherwise. Treat the analyzer's Roslyn version as a host-compatibility floor, not a routine dependency to float.
Choose exactly one Roslyn reference-assembly version for shipping analyzer projects. Pin it independently from the latest Roslyn version used by code-fix tests or the rest of the repository. Pin the analyzer dependency's entire transitive closure to mutually compatible versions, including packages such as System.Collections.Immutable, System.Memory, System.Reflection.Metadata, System.Runtime.CompilerServices.Unsafe, and System.Threading.Tasks.Extensions when they appear in restore. Directly pinning only Microsoft.CodeAnalysis.* is insufficient: a newer centrally managed transitive dependency can make the analyzer fail in an older compiler host.
With central package management, create a dedicated Directory.Packages.Analyzers.props at the repository root and import it only for shipping analyzer, source-generator, and code-fix projects. Do not fold these overrides into the general Directory.Packages.props: the separate file makes the compatibility boundary visible and lets dependency automation treat it specially.
Use this three-part pattern.
First, have every shipping analyzer, source-generator, and code-fix project import one shared props file such as src/AnalyzerCompatibility.props. That file should identify the project:
<Project>
<PropertyGroup>
<!-- This is set so that Directory.Packages.Analyzers.props can apply version overrides specific to analyzer projects. -->
<IsAnalyzerCompatibilityProject>true</IsAnalyzerCompatibilityProject>
</PropertyGroup>
</Project>Second, conditionally import the dedicated package file from a repository-wide props or targets file after central package versions are available:
<Import Project="$(MSBuildThisFileDirectory)Directory.Packages.Analyzers.props"
Condition="'$(IsAnalyzerCompatibilityProject)' == 'true'" />Third, copy this Directory.Packages.Analyzers.props structure and tailor the baseline comment, Roslyn version, and transitive versions to the oldest supported compiler or SDK host. Use Update only for a package already declared by the repository's central package file; use Include to add a pin for a package that is otherwise transitive-only. The example assumes the Roslyn packages are already declared and the listed runtime dependencies are new pins:
<Project>
<!-- These versions are chosen to support the oldest compiler/SDK host named here. -->
<PropertyGroup>
<CodeAnalysisVersionForAnalyzers>4.11.0</CodeAnalysisVersionForAnalyzers>
<!-- Apply analyzer compatibility pins to packages referenced only transitively. -->
<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
</PropertyGroup>
<ItemGroup>
<PackageVersion Update="Microsoft.CodeAnalysis" Version="$(CodeAnalysisVersionForAnalyzers)" />
<PackageVersion Update="Microsoft.CodeAnalysis.Common" Version="$(CodeAnalysisVersionForAnalyzers)" />
<PackageVersion Update="Microsoft.CodeAnalysis.CSharp" Version="$(CodeAnalysisVersionForAnalyzers)" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="$(CodeAnalysisVersionForAnalyzers)" />
<PackageVersion Update="Microsoft.CodeAnalysis.VisualBasic" Version="$(CodeAnalysisVersionForAnalyzers)" />
<PackageVersion Include="Microsoft.CodeAnalysis.VisualBasic.Workspaces" Version="$(CodeAnalysisVersionForAnalyzers)" />
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="8.0.0" />
<PackageVersion Include="System.Collections.Immutable" Version="8.0.0" />
<PackageVersion Include="System.Memory" Version="4.5.5" />
<PackageVersion Include="System.Reflection.Metadata" Version="8.0.0" />
<PackageVersion Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" />
<PackageVersion Include="System.Text.Json" Version="8.0.0" />
<PackageVersion Include="System.Threading.Tasks.Extensions" Version="4.5.4" />
</ItemGroup>
</Project>The XML comments in these samples are required, not decorative. Keep equivalent comments in the receiving repository explaining why IsAnalyzerCompatibilityProject exists, why the conditional import exists when its purpose is not obvious, which oldest host the pinned versions support, and why these versions intentionally differ from the repository defaults. Include the Roslyn version-support documentation URL in or next to the baseline comment when it helps maintainers choose the correct compiler baseline. Future dependency updates must preserve or update these comments so users do not mistake deliberate compatibility pins for stale packages.
The versions above are a structural example, not universal recommendations. Recalculate the complete package set for the selected oldest host by inspecting the resolved dependency graph. Retain each package that Roslyn or the generator loads in the compiler process, even when the repository does not reference it directly. Workspaces entries centrally pin versions for code-fix projects but must not be referenced by analyzer or source-generator projects. The test project should remain outside IsAnalyzerCompatibilityProject and use the latest repository-approved Roslyn and analyzer-testing packages so tests also catch compatibility with current APIs and compilers.
Always prefer the latest available version of Microsoft.CodeAnalysis.Analyzers. It is a development-time analyzer package, not a compiler-host runtime dependency, so it does not need to match Microsoft.CodeAnalysis, Microsoft.CodeAnalysis.Common, C#/VB, or Workspaces package versions and must not be held back to the analyzer compatibility baseline. Keep it on the repository's normal latest-version update path and reference it without flowing it to consumers:
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" PrivateAssets="all" />Do not set its central version to $(CodeAnalysisVersionForAnalyzers) and do not include it among packages excluded from minor or major dependency updates. This exception applies specifically to Microsoft.CodeAnalysis.Analyzers; packages loaded with the shipping analyzer or generator still belong to the carefully pinned compatibility closure.
Configure dependency automation so the analyzer baseline is not upgraded across Roslyn versions. For Renovate, isolate the analyzer version file or package group and disallow updates:
{
"packageRules": [
{
"matchFileNames": ["Directory.Packages.Analyzers.props"],
"enabled": false
}
]
}For Dependabot, use an ignore entry for each analyzer-baseline package with update-types containing version-update:semver-major, version-update:semver-minor, and version-update:semver-patch. Include the pinned transitive packages, not only Microsoft.CodeAnalysis.*. If the tool cannot distinguish analyzer-only central versions from repository-wide versions, place the analyzer pins in a dedicated file/directory or make those upgrades manual.
Verify dependency isolation with a restore graph or assets file and, when practical, load the built analyzer in the oldest supported compiler/IDE host. A successful build on the newest SDK does not prove host compatibility.
Code-fix boundaries
The code-fix project may reference packages such as Microsoft.CodeAnalysis.CSharp.Workspaces or Microsoft.CodeAnalysis.VisualBasic.Workspaces; the analyzer project may not. Keep the code fix optional from the analyzer's perspective. A fix should:
- register only when the diagnostic can be fixed safely;
- find the target node from the diagnostic span defensively;
- preserve leading/trailing trivia and imports;
- use
Simplifier.AnnotationandFormatter.Annotationwhere appropriate; - return a new document or solution without mutating shared state;
- support cancellation and avoid blocking async Roslyn APIs;
- use a meaningful, stable equivalence key, especially when multiple fixes share a title;
- return the batch fixer only when fixes do not conflict or depend on application order.
Unique assembly versions
Analyzer hosts cache and identify assemblies by assembly identity. Every commit that can change an analyzer should therefore produce a unique, precise assembly version; relying only on package version or file version is insufficient.
With Nerdbank.GitVersioning, put a version.json directly in every analyzer project directory, including each language-specific analyzer assembly when those are separate:
{
"$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/main/src/NerdBank.GitVersioning/version.schema.json",
"inherit": true,
"assemblyVersion": {
"precision": "revision"
}
}Then inspect all imported Directory.Build.props, Directory.Build.targets, and project SDK props for GitVersionBaseDirectory. A repository may set that property to a shared root so version calculation happens once; that can cause a project-local version.json to be ignored. In each analyzer project file, reset it to the analyzer project's own directory:
<PropertyGroup>
<!-- Honor this analyzer project's version.json and produce a unique assembly identity per commit. -->
<GitVersionBaseDirectory>$(MSBuildProjectDirectory)</GitVersionBaseDirectory>
</PropertyGroup>Apply this override after any shared property import that sets the value, or otherwise ensure normal MSBuild precedence leaves the project-local value effective. Do not add the override blindly: first locate the controlling assignment and confirm which version.json the evaluated analyzer project uses.
Validate the built assembly rather than only inspecting MSBuild source. Build the same analyzer from two distinct commits when practical and confirm that AssemblyName.Version differs. At minimum, inspect the evaluated GitVersionBaseDirectory, the selected version file, and the resulting assembly version. Repeat this for every analyzer assembly, not merely the packaging or code-fix project.
Test structure
Use Microsoft.CodeAnalysis.Testing or the repository's established equivalent. Keep one test class per diagnostic rule for analyzer and code-fix behavior together. Do not create a separate code-fix test class. Even when a diagnostic intentionally has no fix, instantiate the same analyzer-plus-code-fix harness with EmptyCodeFixProvider; this keeps all cases and configuration for the rule together.
Annotate every verifier/helper parameter that accepts C# source with [StringSyntax("c#-test")] from System.Diagnostics.CodeAnalysis. This enables syntax highlighting and language services at test call sites. Start from CSharpCodeFixVerifier.cs for a complete example and apply the attribute to analyzer-only and generator test helpers as well. If the target framework does not define StringSyntaxAttribute, use the repository's compatibility/polyfill pattern.
When C# source is assigned to a local variable instead of passed directly to an annotated parameter, add a language comment before the literal:
const string source = /* lang=c#-test */ """
// C# code here
""";Prefer inline markup to hard-coded line/column spans:
using Verify = CSharpCodeFixVerifier<AvoidBlockingAnalyzer, AvoidBlockingCodeFix>;
public class AvoidBlockingTests
{
[Fact]
public async Task ReportsBlockingCallAndFixesIt()
{
const string source = /* lang=c#-test */ """
using System.Threading.Tasks;
class C
{
void M(Task task) => [|task.Wait()|];
}
""";
const string fixedSource = /* lang=c#-test */ """
using System.Threading.Tasks;
class C
{
async Task M(Task task) => await task;
}
""";
await Verify.VerifyCodeFixAsync(source, fixedSource);
}
[Fact]
public async Task DoesNotReportAwaitedTask()
{
const string source = /* lang=c#-test */ """
using System.Threading.Tasks;
class C
{
async Task M(Task task) => await task;
}
""";
await Verify.VerifyAnalyzerAsync(source);
}
}Use [|bad code|] for one diagnostic and named markup such as {|#0:bad code|} when diagnostics need distinct descriptors, arguments, or locations. Use explicit DiagnosticResult objects for IDs, severities, arguments, and additional locations, but attach them to markup locations where the harness supports it. Hard-coded WithSpan(line, column, ...) is a last resort for locations that markup cannot express.
If there is no code fix:
using Verify = CSharpCodeFixVerifier<AvoidBlockingAnalyzer, EmptyCodeFixProvider>;When VB support is required, use the corresponding Visual Basic verifier and include VB source, fixed source, and negative snippets. Keep shared behavioral cases aligned across languages while retaining language-specific parser/reference configuration.
Test at least:
- a straightforward positive case with the exact diagnostic span;
- a straightforward negative case;
- qualified, aliased, generic, inherited, overloaded, and extension-method forms relevant to symbol matching;
- nullability, implicit conversions, conditional access, lambdas/local functions, and malformed code when relevant;
- absence of an optional referenced type or assembly;
- generated code according to declared policy;
- every offered code action and equivalence key;
- fix-all behavior when advertised;
- preservation of trivia, imports, and formatting;
- both C# and VB for every promised cross-language behavior.
Prefer reference-assembly definitions supplied by the test framework over references copied from the executing runtime. Add only the metadata references and additional files needed by the scenario. Keep test parse options explicit when testing language-version-sensitive syntax.
Packaging
Prefer bundling analyzer assemblies in the same NuGet package as the library they serve so consumers receive diagnostics automatically. Put analyzer DLLs under language-appropriate analyzer paths such as analyzers/dotnet/cs and analyzers/dotnet/vb; do not place them under lib. Include code-fix assemblies and their required dependencies according to the target host/package convention.
Package source generators as analyzer assets as well, commonly under analyzers/dotnet/cs. Keep generator runtime dependencies self-contained and minimal because compiler hosts do not resolve dependencies like ordinary application projects. Validate generator loading and generated output from a packed consumer project.
A separate Product.Analyzers package is also valid. In that model, the main library package should depend on it with appropriate asset metadata so analyzers flow to consumers without becoming runtime dependencies. Validate the packed .nupkg, not merely the build output: inspect paths, dependencies, satellite resources, build/buildTransitive assets, and verify the analyzer loads from a sample consumer project.
Review checklist
- The implementation uses the narrowest suitable
IOperationor symbol action. - Every source generator implements
IIncrementalGenerator, uses immutable equatable pipeline models, and has tests proving cached and selective recomputation. - Generated code uses the shared
SourceWriterfor deterministic formatting and encoding. - No syntax callback fetches another semantic model.
- C# behavior is implemented and tested; promised VB behavior has equivalent VB tests.
- Analyzer and code-fix assemblies are separate, and the analyzer has no Workspaces dependency.
- Shipping Roslyn references and their transitive dependency closure are coherently pinned to one compatibility baseline.
Microsoft.CodeAnalysis.Analyzersuses the latest available version as a private development dependency and is not tied to the shipping Roslyn baseline.- Shipping analyzer, source-generator, and code-fix projects set
IsAnalyzerCompatibilityProject, conditionally import a dedicatedDirectory.Packages.Analyzers.props, and retain XML comments explaining the compatibility baseline and override mechanism. - Renovate or Dependabot cannot automatically advance that baseline at any SemVer level: patch, minor, or major.
- API/type/member names come from a shared catalog rather than scattered literals.
- Symbol and attribute matching resolves expected named types from the compilation and expected members from their containing types by name and signature. When generic substitutions are irrelevant, it normalizes both expected and encountered named types, properties, fields, and events with
OriginalDefinition, and methods with(method.ReducedFrom ?? method).OriginalDefinition, then usesSymbolEqualityComparer.Default; it inspects relevant type arguments separately and never comparesToDisplayString()output with a literal. - Every diagnostic ID has a documentation page, is present in site navigation, and has a
HelpLinkUrimatching the published URL. - Every analyzer project produces a unique assembly version per commit; with Nerdbank.GitVersioning, its local
version.jsonuses revision precision and any sharedGitVersionBaseDirectoryis overridden correctly. - Tests use inline markup where possible and cover positive and negative behavior.
- C# verifier parameters use
[StringSyntax("c#-test")], and local C# source literals use/* lang=c#-test */where useful. - One rule-focused test class contains analyzer and code-fix cases, using
EmptyCodeFixProviderwhen needed. - Tests exercise public APIs without
InternalsVisibleTo. - The packed package places analyzer assets correctly and has been tested from a consumer project.
- Focused tests, the full test project, and the repository build pass without new analyzer warnings.
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.

