roslyn-analyzers
Qué hace
Esta herramienta ayuda a los desarrolladores a crear y mejorar comprobaciones automáticas de código (analizadores de Roslyn) y generadores de código. Se asegura de que el código siga reglas específicas y ayuda a encontrar errores.
Cuándo usarla
- ✓Cuando creas nuevas comprobaciones para encontrar errores comunes en el código.
- ✓Cuando corriges problemas que los analizadores ya han detectado.
- ✓Cuando optimizas la forma en que se genera el código automáticamente.
Link de la skill
https://github.com/github/awesome-copilot/blob/main/skills/roslyn-analyzers/SKILL.mdCópialo y pégalo en tu IA (Claude, ChatGPT o Cursor) pidiéndole que siga las instrucciones.
Cómo usar
La forma más fácil: copia el mensaje y pégalo en tu IA. Ella lee la skill y sigue las instrucciones.
Mensaje listo para pegar
Para Claude Code, Codex o Cursor: ejecútalo en la carpeta del proyecto y la skill queda instalada.
Descarga el SKILL.md y ponlo en la carpeta de skills de tu agente.
Ejemplo de qué pedirle a la IA
“¿Cómo puedo crear un analizador que compruebe que todas las variables tengan nombres descriptivos?”
5 skills nuevas por semana. 1 minuto de lectura.
Cómo funciona
Funciona inspeccionando el código mientras se escribe o al compilarlo. Usa reglas para entender la estructura del código y sus símbolos, e identifica patrones que necesitan atención o corrección.
Contenido técnico (SKILL.md original)
Texto original del autor, en inglés, directo de GitHub.
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.
…
Preguntas frecuentes
¿Qué son los 'analizadores de Roslyn'?
Son herramientas que analizan tu código C# o VB.NET para encontrar posibles problemas, proponer mejoras o incluso corregirlos automáticamente.
¿Qué son los 'generadores de código'?
Son programas que crean código automáticamente a partir de otras partes de tu proyecto, lo que ahorra tiempo y reduce errores manuales.
¿Necesito saber mucho de programación para usar esto?
Esta herramienta es para desarrolladores que ya escriben código. Les ayuda a que su código sea mejor y más eficiente.
Detalles
Descripción original del autor
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.
repo: github/awesome-copilot
Popularidad
- Estrellas en GitHub
- 40 mil
- Posición en el ranking
- #7406
- Licencia
- MIT
- Actualizada
- 15/10/2026
Comentarios
- …
Más skills de este repositorio
acquire-codebase-knowledge
40 milAyuda a tu agente a entender y documentar un proyecto de código existente. Es útil para incorporar a nuevas personas o tener una visión general de la arquitectura.
acreadiness-assess
40 milPermite a tu agente evaluar qué tan preparado está un proyecto para la IA y generar un informe. Es útil para saber qué tan bien está listo un proyecto para usar herramientas de IA.
acreadiness-generate-instructions
40 milAyuda a tu agente a crear instrucciones para herramientas de IA basadas en una evaluación. Es útil para mejorar cómo la IA interactúa con el código y cerrar las brechas detectadas.
acreadiness-policy
40 milPermite a tu agente ayudar a definir o aplicar políticas para la evaluación de proyectos de IA. Es útil para estandarizar cómo se evalúan los proyectos y garantizar el cumplimiento.
Skills parecidas
diffs
394 milPermite que tu agente genere un diff real y compartible de los cambios, como enlace de visualización o archivo de imagen, en lugar de un resumen escrito a mano.
coding-agent
394 milAyuda a tu agente a pasar un trabajo de programación grande a Codex, Claude Code u OpenCode como trabajador en segundo plano, y después revisar su progreso.
gh-issues
394 milAyuda a tu agente a encontrar incidencias de GitHub, elegir cuáles trabajar y abrir pull requests con correcciones, incluido el seguimiento de los comentarios de revisión.