c-sharp — Claude Code skill: C#, .NET and Unity guidelines
Tells the agent how to write C#: naming, async, DI, tests, Blazor and Unity. Useful when the project is .NET and you are tired of restating conventions.
npx skills add Mindrally/skills --skill c-sharp -a claude-codeWhat c-sharp does
The skill loads as a set of instructions for the agent and covers C# style: PascalCase for classes and methods, camelCase for locals, an I prefix on interfaces, underscores on private fields. It also lists C# 10 and later features — file-scoped namespaces, global usings, records, pattern matching, nullable reference types.
Then come the practice sections. Error handling: try-catch for expected exceptions, custom exception classes, ArgumentNullException.ThrowIfNull(), the Result pattern. API design: REST conventions, DTOs between layers, status codes, versioning. Performance: async/await for I/O, StringBuilder in loops, Span<T> and Memory<T>. There are blocks on dependency injection with Scoped, Transient and Singleton lifetimes, on tests with xUnit or NUnit plus Moq and FluentAssertions, and on input validation with parameterized queries.
Blazor and Unity get their own sections. For Blazor that means component architecture, state management, cascading parameters, rendering optimised with @key and virtualization. For Unity — MonoBehaviour, ScriptableObjects, coroutines, object pooling. The skill is plain text: it runs nothing and checks nothing in your code, it only shapes what the agent suggests. If your team names things differently, these instructions will fight your conventions, so compare them before installing.
What it helps with
- settle on one naming style across a C# codebase
- pick between records, pattern matching and plain classes for new code
- assign Scoped, Transient and Singleton lifetimes to services
- write xUnit tests with mocks and readable assertions
- speed up a Blazor component with
@keyand virtualization
Example prompts for the agent
- write an order service following the c-sharp skill guidelines
- refactor this controller: DTOs, status codes and DI as in c-sharp
- add xUnit tests with Moq following the c-sharp conventions
How to install c-sharp
1Skills CLI (Vercel)
npx skills add Mindrally/skills --skill c-sharp -a claude-code2Manually: put the files in place
~/.claude/skills/c-sharp/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/c-sharp/
1Skills CLI (Vercel)
npx skills add Mindrally/skills --skill c-sharp -a codex2Manually: put the files in place
.agents/skills/c-sharp/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add Mindrally/skills --skill c-sharp -a cursor2Manually: put the files in place
.cursor/skills/c-sharp/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install Mindrally/skills c-sharp2Manually: put the files in place
.github/skills/c-sharp/SKILL.md1Skills CLI (Vercel)
npx skills add Mindrally/skills --skill c-sharp -a gemini-cli2Platform CLI
gemini skills install https://github.com/Mindrally/skills --path c-sharpManually: put the files in place
.devin/skills/c-sharp/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add Mindrally/skills --skill c-sharp -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about c-sharp
How do I install c-sharp in Claude?
Run npx skills add Mindrally/skills --skill c-sharp -a claude-code. The skill file lands at ~/.claude/skills/c-sharp/SKILL.md.
What does the c-sharp skill do?
It gives the agent C# development guidelines: code style, naming, async, dependency injection, testing and security, plus separate sections for Blazor and Unity.
Does the skill lint or test my code?
No, it is a text guideline for the agent with no scripts or checks of its own. What shows up in a reply depends on your prompt and the project.
Source text
SKILL.md · Apache-2.0
--- name: c-sharp description: Guidelines for C# development including Blazor, Unity game development, and .NET backend best practices metadata: maintainer: Mindrally source: https://github.com/Mindrally/skills --- # 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
© Mindrally · Apache-2.0 · Mindrally/skills