agentleFS
GitHubKnown publishergithub/awesome-copilot/skills/dotnet-best-practices/SKILL.md

dotnet-best-practices

Skill40k starsChanged 2 months agoMITView on GitHub

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

3 other projects use a version of this, 1 of them edited; 1 of 1 edited versions we compared changed its rules.

How people change it

1 of 1 edited versions changed its rules.

Of the 1 edited version we compared: 1 made changes of their own.

We split this file and each edited version into the rules they give an agent and match them by wording. A version that adds no rule of its own and has not changed since this file last did reads as an older text, so what it lacks is not counted as dropped. We keep no past texts of a file, so that is inferred, and an edited version that started from an older text still counts its gaps as drops.

Trending

More talk lately.about the whole repository

Dec 2025: 8 mentionsJan 2026: 4 mentionsFeb 2026: 5 mentionsMar 2026: 9 mentionsApr 2026: 4 mentionsMay 2026: 2 mentionsJun 2026: 2 mentionsJul 2026: 2 mentionsAug 2026: 4 mentionsSep 2026: 8 mentionsOct 2026: 4 mentionsNov 2026: 3 mentions
Dec 2025Jun 2026Nov 2026
Mentions a month of the github/awesome-copilot repository that our weekly crawl found. There is no adoption data for this file yet.

Most recently taken up by

Who's talking about github/awesome-copilot

The biggest 5 of 79 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 79

Talked about on Bluesky, GitHub and Hacker News (79 times).

On Bluesky · 42

37 more on Bluesky

On GitHub · 32

27 more on GitHub

The file

Show its rules and text

We split this skill into the rules it gives an agent

26 rules. About 0 are common, 25 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈25

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Create comprehensive XML documentation comments for all public classes, interfaces, methods, and properties

    line 12
  2. Distinctive:

    Follow the established namespace structure: {Core|Console|App|Service}.{Feature}

    line 14
  3. Very specific:

    Use primary constructor syntax for dependency injection (e.g., public class MyClass(IDependency dependency))

    line 18
  4. Distinctive:

    Use interface segregation with clear naming conventions (prefix interfaces with 'I')

    line 20
  5. Distinctive:

    Follow the Factory pattern for complex object creation.

    line 21
  6. Distinctive:

    Use constructor dependency injection with null checks via ArgumentNullException

    line 25
  7. Distinctive:

    Use ResourceManager for localized messages and error strings

    line 32
  8. Distinctive:

    Use async/await for all I/O operations and long-running tasks

    line 38
  9. Distinctive:

    Use ConfigureAwait(false) where appropriate

    line 40
  10. Distinctive:

    Use MSTest framework with FluentAssertions for assertions

    line 45
  11. Distinctive:

    Follow AAA pattern (Arrange, Act, Assert)

    line 46
  12. Distinctive:

    Use Moq for mocking dependencies

    line 47
  13. Distinctive:

    Test both success and failure scenarios

    line 48
  14. Distinctive:

    Use strongly-typed configuration classes with data annotations

    line 53
  15. Distinctive:

    Use IConfiguration binding for settings

    line 55
  16. Distinctive:

    Use Microsoft.SemanticKernel for AI operations

    line 60
  17. Distinctive:

    Use structured output patterns for reliable AI responses

    line 63
  18. Distinctive:

    Use structured logging with Microsoft.Extensions.Logging

    line 67
  19. Distinctive:

    Use try-catch blocks for expected failure scenarios

    line 70
  20. Distinctive:

    Use C# 12+ features and .NET 8 optimizations where applicable

    line 74
  21. Distinctive:

    Use parameterized queries for database operations

    line 76
  22. Distinctive:

    Follow secure coding practices for AI/ML operations

    line 77
  23. Distinctive:

    Ensure SOLID principles compliance

    line 81
  24. Distinctive:

    Avoid code duplication through base classes and utilities

    line 82
  25. Distinctive:

    Use meaningful names that reflect domain concepts

    line 83
  26. Distinctive:

    Keep methods focused and cohesive

    line 84

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

.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

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.