roslyn-analyzers
Fungsinya
Alat ini membantu developer membuat dan meningkatkan pemeriksaan kode otomatis (Roslyn analyzers) serta generator kode. Alat ini memastikan kode mengikuti aturan tertentu dan membantu menemukan kesalahan.
Kapan dipakai
- ✓Saat membuat pemeriksaan baru untuk menemukan kesalahan kode yang umum.
- ✓Saat memperbaiki masalah yang sudah ditemukan oleh analyzer.
- ✓Saat mengoptimalkan cara kode dihasilkan secara otomatis.
Link skill
https://github.com/github/awesome-copilot/blob/main/skills/roslyn-analyzers/SKILL.mdSalin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.
Cara pakai
Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.
Pesan siap tempel
Untuk Claude Code, Codex, atau Cursor: jalankan di folder proyek, lalu skill langsung terpasang.
Unduh SKILL.md lalu taruh di folder skill agen Anda.
Contoh permintaan ke AI
“Bagaimana cara membuat analyzer yang memeriksa apakah semua variabel memiliki nama yang deskriptif?”
5 skill baru setiap minggu. 1 menit baca.
Cara kerjanya
Alat ini bekerja dengan memeriksa kode saat ditulis atau dikompilasi. Alat ini menggunakan aturan untuk memahami struktur dan simbol kode, lalu mengidentifikasi pola yang perlu diperhatikan atau diperbaiki.
Konten teknis (SKILL.md asli)
Teks asli dari pembuat, dalam bahasa Inggris, langsung dari 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.
…
Pertanyaan umum
Apa itu 'Roslyn analyzers'?
Ini adalah alat yang menganalisis kode C# atau VB.NET Anda untuk menemukan potensi masalah, memberikan saran perbaikan, atau bahkan memperbaikinya secara otomatis.
Apa itu 'generator kode'?
Ini adalah program yang secara otomatis membuat kode berdasarkan bagian lain dari proyek Anda, sehingga menghemat waktu dan mengurangi kesalahan manual.
Apakah saya perlu banyak pengetahuan pemrograman untuk menggunakan ini?
Alat ini ditujukan untuk developer yang sudah menulis kode. Alat ini membantu membuat kode mereka menjadi lebih baik dan lebih efisien.
Detail
Deskripsi asli dari pembuat
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
Popularitas
- Bintang GitHub
- 40k
- Peringkat
- #7406
- Lisensi
- MIT
- Diperbarui
- 15/10/2026
Komentar
- …
Skill lain dari repositori ini
acquire-codebase-knowledge
40kMembantu agent Anda memahami dan mendokumentasikan proyek kode yang sudah ada. Berguna untuk proses onboarding anggota baru atau mendapatkan gambaran arsitektur.
acreadiness-assess
40kMemungkinkan agent Anda menilai kesiapan proyek untuk AI dan membuat laporannya. Berguna untuk mengetahui seberapa siap proyek menggunakan alat AI.
acreadiness-generate-instructions
40kMembantu agent Anda membuat instruksi untuk alat AI berdasarkan hasil penilaian. Berguna untuk meningkatkan cara AI berinteraksi dengan kode dan menutup celah yang ditemukan.
acreadiness-policy
40kMemungkinkan agent Anda membantu menyusun atau menerapkan kebijakan untuk penilaian proyek AI. Berguna untuk menstandarisasi evaluasi proyek dan memastikan kepatuhan.
Skill serupa
diffs
394kMemungkinkan agent Anda menghasilkan diff perubahan yang nyata dan dapat dibagikan sebagai tautan viewer atau file gambar, bukan ringkasan yang ditulis manual.
coding-agent
394kMembantu agent Anda menyerahkan pekerjaan pemrograman besar ke Codex, Claude Code, atau OpenCode di latar belakang, lalu memeriksa kemajuannya.
gh-issues
394kMembantu agent Anda menemukan issue GitHub, memilih yang dikerjakan, dan membuka pull request perbaikan, termasuk tindak lanjut komentar tinjauan.