agentleFS
MindrallyMindrally/skills/c-sharp/SKILL.md

c-sharp

Skill266 starsChanged 10 months agoApache-2.0View on GitHub

Guidelines for C# development including Blazor, Unity game development, and .NET backend best practices

The file

Show its rules and text

We split this skill into the rules it gives an agent

37 rules. About 0 are common, 30 are distinctive, and 7 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈30

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 7

    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 12
  2. Distinctive:

    Follow .NET and C# conventions and best practices

    line 13
  3. Distinctive:

    Use object-oriented and functional programming patterns as appropriate

    line 14
  4. Distinctive:

    Prefer LINQ and lambda expressions for collection operations

    line 15
  5. Very specific:

    Use descriptive variable and method names (e.g., IsUserLoggedIn, GetUserById)

    line 16
  6. Distinctive:

    Use PascalCase for class names, method names, and public properties

    line 21
  7. Distinctive:

    Use camelCase for local variables and private fields

    line 22
  8. Very specific:

    Use SCREAMING_SNAKE_CASE for constants

    line 23
  9. Distinctive:

    Use file-scoped namespaces for cleaner code

    line 30
  10. Distinctive:

    Use global usings for common namespaces

    line 31
  11. Distinctive:

    Use pattern matching for type checking and deconstruction

    line 33
  12. Distinctive:

    Use nullable reference types with proper annotations

    line 34
  13. Distinctive:

    Use expression-bodied members for simple methods and properties

    line 37
  14. Very specific:

    Use target-typed new expressions (new())

    line 38
  15. Distinctive:

    Use switch expressions for concise conditional logic

    line 39
  16. Distinctive:

    Use string interpolation over string concatenation

    line 40
  17. Distinctive:

    Use try-catch blocks for expected exceptions

    line 44
  18. Distinctive:

    Create custom exception classes for domain-specific errors

    line 45
  19. Very specific:

    Use ArgumentNullException.ThrowIfNull() for parameter validation

    line 46
  20. Distinctive:

    Follow RESTful conventions for web APIs

    line 52
  21. Distinctive:

    Use DTOs for data transfer between layers

    line 53
  22. Distinctive:

    Use action filters for cross-cutting concerns

    line 55
  23. Very specific:

    Use async/await for I/O-bound operations

    line 60
  24. Very specific:

    Use StringBuilder for string concatenation in loops

    line 62
  25. Distinctive:

    Avoid boxing/unboxing with generics

    line 63
  26. Very specific:

    Use Span<T> and Memory<T> for high-performance scenarios

    line 64
  27. Distinctive:

    Use constructor injection for dependencies

    line 68
  28. Distinctive:

    Use interfaces for service abstractions

    line 70
  29. Distinctive:

    Write unit tests using xUnit or NUnit

    line 75
  30. Distinctive:

    Use Moq or NSubstitute for mocking

    line 76
  31. Distinctive:

    Use FluentAssertions for readable assertions

    line 79
  32. Distinctive:

    Use parameterized queries or Entity Framework to prevent SQL injection

    line 84
  33. Distinctive:

    Use HTTPS for all communications

    line 87
  34. Distinctive:

    Use cascading parameters for shared state

    line 93
  35. Distinctive:

    Use MonoBehaviour for game object behaviors

    line 99
  36. Distinctive:

    Follow the Component pattern for modularity

    line 101
  37. Distinctive:

    Use coroutines for time-based operations

    line 102

≈ “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

C# Development Guidelines

You are an expert in C# development with deep knowledge of .NET, Blazor, Unity, and modern C# language features.

Code Style and Structure

  • Write concise, idiomatic C# code with accurate examples
  • Follow .NET and C# 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., IsUserLoggedIn, GetUserById)
  • Structure files according to .NET conventions (Controllers, Models, Services, etc.)

Naming Conventions

  • Use PascalCase for class names, method names, and public properties
  • Use camelCase for local variables and private fields
  • Use SCREAMING_SNAKE_CASE for constants
  • Prefix interfaces with "I" (e.g., IUserService)
  • Prefix private fields with underscore (e.g., _userRepository)

C# Language Features

C# 10+ Features

  • Use file-scoped namespaces for cleaner code
  • Use global usings for common namespaces
  • Leverage records for immutable data types
  • Use pattern matching for type checking and deconstruction
  • Use nullable reference types with proper annotations

Modern Syntax

  • Use expression-bodied members for simple methods and properties
  • Use target-typed new expressions (new())
  • Use switch expressions for concise conditional logic
  • Use string interpolation over string concatenation

Error Handling

  • Use try-catch blocks for expected exceptions
  • Create custom exception classes for domain-specific errors
  • Use ArgumentNullException.ThrowIfNull() for parameter validation
  • Implement the Result pattern for operation outcomes when appropriate
  • Log exceptions with context information

API Design

  • Follow RESTful conventions for web APIs
  • Use DTOs for data transfer between layers
  • Implement proper HTTP status codes
  • Use action filters for cross-cutting concerns
  • Version APIs appropriately

Performance

  • Use async/await for I/O-bound operations
  • Implement caching where appropriate
  • Use StringBuilder for string concatenation in loops
  • Avoid boxing/unboxing with generics
  • Use Span<T> and Memory<T> for high-performance scenarios

Dependency Injection

  • Use constructor injection for dependencies
  • Register services with appropriate lifetimes (Scoped, Transient, Singleton)
  • Use interfaces for service abstractions
  • Configure DI in Program.cs or Startup.cs

Testing

  • Write unit tests using xUnit or NUnit
  • Use Moq or NSubstitute for mocking
  • Follow Arrange-Act-Assert pattern
  • Aim for high test coverage on business logic
  • Use FluentAssertions for readable assertions

Security

  • Validate all user inputs
  • Use parameterized queries or Entity Framework to prevent SQL injection
  • Implement proper authentication and authorization
  • Store secrets in configuration (User Secrets, Azure Key Vault)
  • Use HTTPS for all communications

Blazor-Specific Guidelines

  • Use component-based architecture
  • Implement proper state management
  • Use cascading parameters for shared state
  • Optimize rendering with @key and virtualization
  • Handle component lifecycle events appropriately

Unity-Specific Guidelines

  • Use MonoBehaviour for game object behaviors
  • Implement ScriptableObjects for data containers
  • Follow the Component pattern for modularity
  • Use coroutines for time-based operations
  • Implement object pooling for frequently instantiated objects

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.