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

dotnet-best-practices

하는 일

이 AI 에이전트는 .NET/C# 코드가 권장되는 모범 사례를 따르도록 돕습니다. 문서화, 구조, 디자인 패턴 사용, 의존성 주입, 리소스 관리, async/await 사용, 테스트, 설정, AI 통합, 오류 처리, 보안, 전반적인 코드 품질을 확인합니다.

사용하는 경우

  • ✓새 C# 코드를 작성할 때.
  • ✓기존 코드를 검토할 때.
  • ✓성능이나 보안을 최적화할 때.

스킬 링크

https://github.com/github/awesome-copilot/blob/main/skills/dotnet-best-practices/SKILL.md

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

사용 방법

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

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

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

AI에게 요청하는 예시

“이 C# 코드가 모범 사례를 따르는지 확인해 주세요.”

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

작동 방식

에이전트는 적절한 문서화, 디자인 패턴 사용, 올바른 오류 처리 같은 특정 패턴을 중심으로 코드를 분석합니다. 코드를 일련의 규칙과 비교하고 개선 사항을 제안합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

.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<T> 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
자주 묻는 질문

'모범 사례'란 무엇인가요?

코드를 더 쉽게 유지보수하고 흔한 오류를 피할 수 있도록 하는, 가장 효율적이고 안전한 코드 작성 방법입니다.

이 에이전트를 쓰려면 기술 용어를 모두 이해해야 하나요?

아니요. 에이전트는 경험 많은 프로그래머가 아니어도 도움을 받을 수 있도록 설계되었습니다. 코드 품질을 높이는 규칙을 적용하는 데 중점을 둡니다.

에이전트가 제 코드를 자동으로 고칠 수 있나요?

이 에이전트는 개선 사항을 찾고 제안하는 데 중점을 둡니다. 자동 수정은 다른 도구를 쓰거나 직접 개입해야 할 수도 있습니다.

상세 정보

작성자의 원본 설명

Ensure .NET/C# code meets best practices for the solution/project.

repo: github/awesome-copilot

인기도

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

이 스킬이 유용한가요?

0

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

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬