dotnet-best-practices

tarafından github

.NET/C# kodunuzu çözümünüz ve projeniz için kapsamlı en iyi uygulamalara göre doğrulayın. XML dokümantasyonu, tasarım desenleri, bağımlılık enjeksiyonu, async/await, test standartları ve hata yönetimi dahil 10'dan fazla uygulama alanını kapsar. Belirli desenleri zorunlu kılar: DI için birincil yapıcılar, jeneriklerle Command Handler deseni, arayüz ayrımı ve nesne oluşturma için Factory deseni. Yerelleştirme için ResourceManager ile kaynak yönetimi, yapılandırılmış günlükleme yoluyla... içerir.

npx skills add https://github.com/github/awesome-copilot --skill dotnet-best-practices

.NET/C# Best Practices

Your task is to ensure .NET/C# code in ${selection} meets the best practices specific to this solution/project. This includes:

Documentation & Structure

  • Create comprehensive XML documentation comments for all public classes, interfaces, methods, and properties
  • Include parameter descriptions and return value descriptions in XML comments
  • Follow the established namespace structure: {Core|Console|App|Service}.{Feature}

Design Patterns & Architecture

  • Use primary constructor syntax for dependency injection (e.g., public class MyClass(IDependency dependency))
  • Implement the Command Handler pattern with generic base classes (e.g., CommandHandler<TOptions>)
  • Use interface segregation with clear naming conventions (prefix interfaces with 'I')
  • Follow the Factory pattern for complex object creation.

Dependency Injection & Services

  • Use constructor dependency injection with null checks via ArgumentNullException
  • Register services with appropriate lifetimes (Singleton, Scoped, Transient)
  • Use Microsoft.Extensions.DependencyInjection patterns
  • Implement service interfaces for testability

Resource Management & Localization

  • Use ResourceManager for localized messages and error strings
  • Separate LogMessages and ErrorMessages resource files
  • Access resources via _resourceManager.GetString("MessageKey")

Async/Await Patterns

  • Use async/await for all I/O operations and long-running tasks
  • Return Task or Task from async methods
  • Use ConfigureAwait(false) where appropriate
  • Handle async exceptions properly

Testing Standards

  • Use MSTest framework with FluentAssertions for assertions
  • Follow AAA pattern (Arrange, Act, Assert)
  • Use Moq for mocking dependencies
  • Test both success and failure scenarios
  • Include null parameter validation tests

Configuration & Settings

  • Use strongly-typed configuration classes with data annotations
  • Implement validation attributes (Required, NotEmptyOrWhitespace)
  • Use IConfiguration binding for settings
  • Support appsettings.json configuration files

Semantic Kernel & AI Integration

  • Use Microsoft.SemanticKernel for AI operations
  • Implement proper kernel configuration and service registration
  • Handle AI model settings (ChatCompletion, Embedding, etc.)
  • Use structured output patterns for reliable AI responses

Error Handling & Logging

  • Use structured logging with Microsoft.Extensions.Logging
  • Include scoped logging with meaningful context
  • Throw specific exceptions with descriptive messages
  • Use try-catch blocks for expected failure scenarios

Performance & Security

  • Use C# 12+ features and .NET 8 optimizations where applicable
  • Implement proper input validation and sanitization
  • Use parameterized queries for database operations
  • Follow secure coding practices for AI/ML operations

Code Quality

  • Ensure SOLID principles compliance
  • Avoid code duplication through base classes and utilities
  • Use meaningful names that reflect domain concepts
  • Keep methods focused and cohesive
  • Implement proper disposal patterns for resources

github tarafından daha fazla skill

console-rendering
github
Go'da struct etiketi tabanlı konsol renderlama sistemini kullanma talimatları
official
acquire-codebase-knowledge
github
Bu beceriyi, kullanıcı açıkça mevcut bir kod tabanını haritalamayı, belgelemeyi veya bu kod tabanına dahil olmayı istediğinde kullanın. "Bu kod tabanını haritala", "belgele…" gibi ifadeler için tetikleyin.
official
acreadiness-assess
github
Run the AgentRC readiness assessment on the current repository and produce a static HTML dashboard at reports/index.html. Wraps `npx github:microsoft/agentrc…
official
acreadiness-generate-instructions
github
AgentRC talimatları komutu aracılığıyla özelleştirilmiş AI ajan talimat dosyaları oluşturur. .github/copilot-instructions.md dosyasını üretir (varsayılan, VS'de Copilot için önerilir…
official
acreadiness-policy
github
Kullanıcının bir AgentRC politikası seçmesine, yazmasına veya uygulamasına yardımcı olun. Politikalar, ilgisiz kontrolleri devre dışı bırakarak, etki/seviyeyi geçersiz kılarak, ayarlayarak…
official
add-educational-comments
github
We need to translate the given English text into Turkish, preserving the name "add-educational-comments" if it appears. The text is a description of an agent skill. We must not add any extra commentary, labels, or formatting. The translation should be accurate and natural in Turkish. The text: "Add educational comments to code files to transform them into effective learning resources. Adapts explanation depth and tone to three configurable knowledge levels: beginner, intermediate, and advanced Automatically requests a file if none is provided, with numbered list matching for quick selection Expands files by up to 125% using educational comments only (hard limit: 400 new lines; 300 for files over 1,000 lines) Preserves file encoding, indentation style, syntax correctness, and..." It seems cut off at the end. The original might have more, but we only have this. We'll translate what's given. Note: The name "add-educational-comments" does not appear in the text, so we don't include it. Translation: "Kod dosyalarına
official
adobe-illustrator-scripting
github
ExtendScript (JavaScript/JSX) kullanarak Adobe Illustrator otomasyon betiklerini yazın, hata ayıklayın ve optimize edin. Oluştururken veya değiştirirken kullanın…
official
agent-governance
github
Yapay zeka aracı erişimi ve davranışını kontrol etmek için bildirimsel politikalar, niyet sınıflandırması ve denetim izleri. Birleştirilebilir yönetişim politikaları, izin verilen/engellenen araçları, içerik filtrelerini, hız sınırlarını ve onay gereksinimlerini tanımlar — kod değil yapılandırma olarak saklanır. Anlamsal niyet sınıflandırması, araç yürütülmeden önce desen tabanlı sinyaller kullanarak tehlikeli istemleri (veri sızdırma, ayrıcalık yükseltme, istem enjeksiyonu) tespit eder. Araç düzeyinde yönetişim dekoratörü, politikaları işlevde u
official