본문으로 건너뛰기
Skillpedia
일반 코딩40k · #7406

roslyn-analyzers

하는 일

이 도구는 개발자가 자동 코드 검사(Roslyn 분석기)와 코드 생성기를 만들고 개선하는 데 도움을 줍니다. 코드가 특정 규칙을 따르도록 하고 오류를 찾아냅니다.

사용하는 경우

  • ✓흔한 코드 오류를 찾는 새 검사를 만들 때.
  • ✓분석기가 이미 찾아낸 문제를 고쳐야 할 때.
  • ✓자동으로 생성되는 코드의 방식을 최적화할 때.

스킬 링크

https://github.com/github/awesome-copilot/blob/main/skills/roslyn-analyzers/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/github/awesome-copilot/blob/main/skills/roslyn-analyzers/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“모든 변수가 설명적인 이름을 갖는지 확인하는 분석기는 어떻게 만들 수 있나요?”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

코드를 작성하거나 컴파일할 때 그 내용을 살펴보는 방식으로 작동합니다. 규칙을 사용해 코드의 구조와 심볼을 이해하고, 주의하거나 고쳐야 할 패턴을 찾아냅니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 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 applicable OperationKind and inspect typed operations such as IInvocationOperation, IAwaitOperation, or IObjectCreationOperation. 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 a SemanticModel; do not call Compilation.GetSemanticModel or 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 with ConfigureGeneratedCodeAnalysis(...); 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 public DiagnosticAnalyzer and CodeFixProvider APIs 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 the Compilation once 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 with SymbolEqualityComparer.Default.Equals(actual, expected). When generic substitutions are irrelevant, compare named types, properties, fields, and events by OriginalDefinition; compare methods after replacing a reduced extension method with ReducedFrom ?? method and then taking OriginalDefinition. 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.json with assemblyVersion.precision set to revision and ensure that repository-wide MSBuild properties do not prevent that file from being discovered.
  • Source generators must implement IIncrementalGenerator, not ISourceGenerator. Design the provider graph so unchanged inputs remain cached and do not regenerate output.
  • Source generators must use a small SourceWriter abstraction for deterministic newlines, indentation, encoding, and balanced output. Start from SourceWriter.cs and tailor its namespace and target-framework details to the receiving repository.

…

자주 묻는 질문

'Roslyn 분석기'란 무엇인가요?

C# 또는 VB.NET 코드를 분석해 잠재적인 문제를 찾고, 개선점을 제안하거나 자동으로 고치는 도구입니다.

'코드 생성기'란 무엇인가요?

프로젝트의 다른 부분을 바탕으로 코드를 자동으로 만들어 주는 프로그램입니다. 시간을 절약하고 수작업 실수를 줄여 줍니다.

이 도구를 쓰려면 프로그래밍을 많이 알아야 하나요?

이 도구는 이미 코드를 작성하고 있는 개발자를 위한 것입니다. 개발자의 코드를 더 좋고 효율적으로 만드는 데 도움을 줍니다.

상세 정보

작성자의 원본 설명

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

인기도

GitHub 스타
40k
순위
#7406
라이선스
MIT
업데이트
2026. 10. 15.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬