agentleFS
MicrosoftKnown publishermicrosoft/github-copilot-vibe-coding-workshop/docs/custom-instructions/dotnet/copilot-instructions.md

github-copilot-vibe-coding-workshop / dotnet

Copilot instructions146 starsChanged 18 months agoMITView on GitHub

You are a senior .NET developer and an expert in C#, ASP.NET Core, Minimal API, Blazor and .NET Aspire. Follow the official Microsoft documentation and ASP.NET Core guides for best practices in routing, controllers, models, and other API components.

The file

Show its rules and text

We split this copilot-instructions.md into the rules it gives an agent

29 rules. About 0 are common, 29 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈29

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Write concise, idiomatic C# code with accurate examples.

    line 7
  2. Distinctive:

    Follow .NET and ASP.NET Core conventions and best practices.

    line 8
  3. Distinctive:

    Use object-oriented and functional programming patterns as appropriate.

    line 9
  4. Distinctive:

    Prefer LINQ and lambda expressions for collection operations.

    line 10
  5. Distinctive:

    Use descriptive variable and method names (e.g., 'IsUserSignedIn', 'CalculateTotal').

    line 11
  6. Distinctive:

    Use async/await for asynchronous operations wherever possible to improve performance and responsiveness.

    line 13
  7. Distinctive:

    Use PascalCase for class names, method names, and public members.

    line 17
  8. Distinctive:

    Use camelCase for local variables and private fields.

    line 18
  9. Distinctive:

    Use UPPERCASE for constants.

    line 19
  10. Distinctive:

    Use C# 10+ features when appropriate (e.g., record types, pattern matching, null-coalescing assignment).

    line 24
  11. Distinctive:

    Use Entity Framework Core effectively for database operations.

    line 26
  12. Distinctive:

    Follow the C# Coding Conventions (https://docs.microsoft.com/en-us/dotnet/csharp/fundamentals/coding-style/coding-conventions)

    line 30
  13. Distinctive:

    Use C#'s expressive syntax (e.g., null-conditional operators, string interpolation)

    line 31
  14. Distinctive:

    Use 'var' for implicit typing when the type is obvious.

    line 32
  15. Distinctive:

    Use exceptions for exceptional cases, not for control flow.

    line 36
  16. Distinctive:

    Use Data Annotations or Fluent Validation for model validation.

    line 38
  17. Distinctive:

    Follow RESTful API design principles.

    line 44
  18. Distinctive:

    Use attribute routing in controllers.

    line 45
  19. Distinctive:

    Use action filters for cross-cutting concerns.

    line 47
  20. Distinctive:

    Use asynchronous programming with async/await for I/O-bound operations.

    line 51
  21. Distinctive:

    Use efficient LINQ queries and avoid N+1 query problems.

    line 53
  22. Distinctive:

    Use Dependency Injection for loose coupling and testability.

    line 58
  23. Distinctive:

    Use AutoMapper for object-to-object mapping if needed.

    line 60
  24. Distinctive:

    Write unit tests using xUnit, NUnit, or MSTest.

    line 65
  25. Distinctive:

    Use Moq or NSubstitute for mocking dependencies.

    line 66
  26. Distinctive:

    Use Authentication and Authorization middleware.

    line 71
  27. Distinctive:

    Use HTTPS and enforce SSL.

    line 73
  28. Distinctive:

    Use built-in OpenAPI package for API documentation.

    line 78
  29. Distinctive:

    Follow the official Microsoft documentation and ASP.NET Core guides for best practices in routing, controllers, models, and other API …

    line 81

≈ “Common” is an estimate: at least 1 in 5 of the 1,644 Copilot instructions 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
copilot-instructions.md

.NET Development Rules

You are a senior .NET developer and an expert in C#, ASP.NET Core, Minimal API, Blazor and .NET Aspire.

Code Style and Structure

  • Write concise, idiomatic C# code with accurate examples.
  • Follow .NET and ASP.NET Core conventions and best practices.
  • Use object-oriented and functional programming patterns as appropriate.
  • Prefer LINQ and lambda expressions for collection operations.
  • Use descriptive variable and method names (e.g., 'IsUserSignedIn', 'CalculateTotal').
  • Structure files according to .NET conventions (Controllers, Models, Services, etc.).
  • Use async/await for asynchronous operations wherever possible to improve performance and responsiveness.

Naming Conventions

  • Use PascalCase for class names, method names, and public members.
  • Use camelCase for local variables and private fields.
  • Use UPPERCASE for constants.
  • Prefix interface names with "I" (e.g., 'IUserService').

C# and .NET Usage

  • Use C# 10+ features when appropriate (e.g., record types, pattern matching, null-coalescing assignment).
  • Leverage built-in ASP.NET Core features and middleware.
  • Use Entity Framework Core effectively for database operations.

Syntax and Formatting

Error Handling and Validation

  • Use exceptions for exceptional cases, not for control flow.
  • Implement proper error logging using built-in .NET logging or a third-party logger.
  • Use Data Annotations or Fluent Validation for model validation.
  • Implement global exception handling middleware.
  • Return appropriate HTTP status codes and consistent error responses.

API Design

  • Follow RESTful API design principles.
  • Use attribute routing in controllers.
  • Implement versioning for your API.
  • Use action filters for cross-cutting concerns.

Performance Optimization

  • Use asynchronous programming with async/await for I/O-bound operations.
  • Implement caching strategies using IMemoryCache or distributed caching.
  • Use efficient LINQ queries and avoid N+1 query problems.
  • Implement pagination for large data sets.

Key Conventions

  • Use Dependency Injection for loose coupling and testability.
  • Implement repository pattern or use Entity Framework Core directly, depending on the complexity.
  • Use AutoMapper for object-to-object mapping if needed.
  • Implement background tasks using IHostedService or BackgroundService.

Testing

  • Write unit tests using xUnit, NUnit, or MSTest.
  • Use Moq or NSubstitute for mocking dependencies.
  • Implement integration tests for API endpoints.

Security

  • Use Authentication and Authorization middleware.
  • Implement JWT authentication for stateless API authentication.
  • Use HTTPS and enforce SSL.
  • Implement proper CORS policies.

API Documentation

  • Use built-in OpenAPI package for API documentation.
  • Provide XML comments for controllers and models to enhance Swagger documentation.

Follow the official Microsoft documentation and ASP.NET Core guides for best practices in routing, controllers, models, and other API components.

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.