c-sharp — скилл для Claude Code: правила C#, .NET и Unity
Задаёт агенту стиль кода на C#: именование, async, DI, тесты, Blazor и Unity. Пригодится, когда проект на .NET и не хочется каждый раз объяснять конвенции.
npx skills add Mindrally/skills --skill c-sharp -a claude-codeЧто делает c-sharp
Скилл подключается как набор инструкций для агента и описывает, как писать на C#: PascalCase для классов и методов, camelCase для локальных переменных, префикс I у интерфейсов, подчёркивание у приватных полей. Отдельно перечислены возможности C# 10 и новее — file-scoped namespaces, global usings, records, pattern matching, nullable reference types.
Дальше идут разделы по практике. Обработка ошибок: try-catch для ожидаемых исключений, свои классы исключений, ArgumentNullException.ThrowIfNull(), паттерн Result. API: REST, DTO между слоями, коды статусов, версионирование. Производительность: async/await для I/O, StringBuilder в циклах, Span<T> и Memory<T>. Есть блоки про внедрение зависимостей с временами жизни Scoped, Transient и Singleton, про тесты на xUnit или NUnit с Moq и FluentAssertions, про безопасность ввода и параметризованные запросы.
Отдельные разделы — Blazor и Unity. Для Blazor это компонентная архитектура, управление состоянием, каскадные параметры, оптимизация отрисовки через @key и виртуализацию. Для Unity — MonoBehaviour, ScriptableObjects, корутины, пулинг объектов. Скилл текстовый, ничего не запускает и не проверяет ваш код: он влияет на то, что агент предложит. Если в проекте принят другой стиль именования, инструкции будут ему противоречить, поэтому конвенции стоит сверить до установки.
Какие задачи решает
- договориться с агентом о едином стиле именования в C#-проекте
- выбрать между records, pattern matching и обычными классами в новом коде
- разложить зависимости по временам жизни Scoped, Transient и Singleton
- написать тесты на xUnit с моками и читаемыми проверками
- оптимизировать отрисовку компонента Blazor через
@keyи виртуализацию
Примеры запросов агенту
- напиши сервис для работы с заказами по правилам скилла c-sharp
- отрефактори этот контроллер: DTO, коды статусов и внедрение зависимостей как в c-sharp
- добавь юнит-тесты на xUnit с Moq по конвенциям c-sharp
Как установить c-sharp
1Через Skills CLI (Vercel)
npx skills add Mindrally/skills --skill c-sharp -a claude-code2Вручную: положить файлы
~/.claude/skills/c-sharp/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/c-sharp/
1Через Skills CLI (Vercel)
npx skills add Mindrally/skills --skill c-sharp -a codex2Вручную: положить файлы
.agents/skills/c-sharp/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add Mindrally/skills --skill c-sharp -a cursor2Вручную: положить файлы
.cursor/skills/c-sharp/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install Mindrally/skills c-sharp2Вручную: положить файлы
.github/skills/c-sharp/SKILL.md1Через Skills CLI (Vercel)
npx skills add Mindrally/skills --skill c-sharp -a gemini-cli2Командой платформы
gemini skills install https://github.com/Mindrally/skills --path c-sharpВручную: положить файлы
.devin/skills/c-sharp/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Через Skills CLI (Vercel)
npx skills add Mindrally/skills --skill c-sharp -a opencodeClaude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Вопросы о c-sharp
Как установить c-sharp в Claude?
Выполните npx skills add Mindrally/skills --skill c-sharp -a claude-code. Файл скилла появится по пути ~/.claude/skills/c-sharp/SKILL.md.
Что делает скилл c-sharp?
Он даёт агенту инструкции по разработке на C#: стиль кода, именование, async, внедрение зависимостей, тесты, безопасность, а также отдельные разделы по Blazor и Unity.
Скилл проверяет мой код или только советует?
Это текстовые рекомендации для агента, своих скриптов и проверок внутри нет. Что именно попадёт в ответ, зависит от вашего запроса и содержимого проекта.
Исходный текст
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