csharp-rules

csharp-rules is a skill for Claude Code from softspark/ai-toolkit. It costs 55 tokens per session (3,160 once invoked), scanned A, original, Apache-2.0.

A set of coding rules for C# and .NET projects, covering style, common frameworks, security, and testing. It applies to files and tools such as ASP.NET, EF Core, LINQ, NUnit, and xUnit.

In plain words
What is it for?
Use it when creating or reviewing C#/.NET code, including ASP.NET applications, database code with EF Core, and automated tests.
Why use it?
It gives code written or reviewed by the agent a consistent structure and naming style. It also records project expectations such as safe handling of null values and required tests.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Part of the ai-toolkit plugin — 115 skills, 44 agents, 14 hooks shipped together

Good fit Use it when creating or reviewing C#/.NET code, including ASP.NET applications, database code with EF Core, and automated tests.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/softspark/ai-toolkit/csharp-rules
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add softspark/ai-toolkit --skill csharp-rules
Clone the repo
git clone --depth 1 https://github.com/softspark/ai-toolkit

Made for: Claude Code.

Or install ai-toolkit, the plugin that ships this one along with the rest of its 115 skills, 44 agents, 14 hooks.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for csharp-rules

README.md
[![agentmods](https://agentmods.dev/badge/skills/softspark/ai-toolkit/csharp-rules/github.svg)](https://agentmods.dev/skills/softspark/ai-toolkit/csharp-rules)
Your own site
<a href="https://agentmods.dev/skills/softspark/ai-toolkit/csharp-rules"><img src="https://agentmods.dev/badge/skills/softspark/ai-toolkit/csharp-rules/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for csharp-rules

Your own site · 80×15
<a href="https://agentmods.dev/skills/softspark/ai-toolkit/csharp-rules"><img src="https://agentmods.dev/badge/skills/softspark/ai-toolkit/csharp-rules.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 55 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,160 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 1 finding, up to high

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • high Privilege Escalation · line 195
    Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
    Fix: Remove references to credential paths. Use environment variables or secrets managers. For docs, use placeholder paths (e.g., /path/to/config). Never load .env or token files in production code paths.
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00055 $0.03160
Opus 5 $0.00028 $0.01580
Sonnet 5 $0.00011 $0.00632
Haiku 4.5 $0.00006 $0.00316

Measured 6d ago against content hash 8c2c5838061d, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

csharp-rules scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

app/skills/csharp-rules/SKILL.md · 283 lines

How it starts

The opening of the file, as written. The whole thing — 283 lines — stays where its author put it; the contents beside it link to each section on GitHub.

C#/.NET Rules

These rules come from app/rules/csharp/ in ai-toolkit. They cover the project's standards for coding style, frameworks, patterns, security, and testing in C#/.NET. Apply them when writing or reviewing C#/.NET code.

C# Coding Style

Naming

  • PascalCase: classes, structs, enums, interfaces, methods, properties, events.
  • camelCase: local variables, parameters, private fields.
  • Prefix interfaces with I: IUserRepository, IDisposable.
  • Prefix private fields with _: private readonly ILogger _logger;.
  • UPPER_SNAKE: not conventional in C#. Use PascalCase for constants.

Nullable Reference Types

  • Enable <Nullable>enable</Nullable> in all projects.
  • Use string? only when null is semantically meaningful.
  • Use ! (null-forgiving) operator sparingly -- only when compiler cannot infer.
  • Use ?? (null-coalescing) and ?. (null-conditional) for safe navigation.
  • Use required modifier (C# 11) on properties that must be set at initialization.

Records and Types

  • Use record for immutable value objects and DTOs.
  • Use record struct for small, stack-allocated value types.
  • Use init properties for immutable-after-construction objects.
  • Use with expressions for non-destructive mutation of records.
  • Use primary constructors (C# 12) for concise class definitions.

Pattern Matching

  • Use is pattern for type checks: if (obj is string s).
  • Use switch expressions for exhaustive matching over enums/types.
  • Use property patterns: user is { Age: > 18, Role: "admin" }.
  • Use relational patterns: size is > 0 and < 100.
  • Use list patterns (C# 11): numbers is [1, 2, .., var last].

Async/Await

  • Suffix async methods with Async: GetUserAsync().
  • Return Task<T> or ValueTask<T>, never void (except event handlers).
  • Use await with ConfigureAwait(false) in library code.
  • Use CancellationToken parameters in all async public APIs.
  • Prefer ValueTask<T> when synchronous completion is common.

File Organization

  • One type per file. File name matches type name.
  • Use file-scoped namespaces (C# 10): namespace MyApp.Services;.
  • Order members: fields, constructors, properties, public methods, private methods.
  • Use global using directives in a single GlobalUsings.cs file.

Read the full file on GitHub · 283 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 283 lines · 55 tokens per session scan A 8c2c5838061d

Subscribe to this mod's changes

csharp-rules is a skill published in the GitHub repository softspark/ai-toolkit (170 stars, last pushed 2d ago), licensed Apache-2.0. It adds 55 tokens to every session and 3,160 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

qa-testing-nunit

Designs NUnit-based C# test suites for API, component, and integration coverage. Use when creating fixtures, wiring Testcontainers, or reducing flaky CI behavior.

vasilyu1983/AI-Agents-public · 37 tokens

unit-test

A Go testing workflow for writing unit tests: small tests that check individual functions or components. It supports table-driven cases, where many inputs and expected results are organised in one test, and subtests.

johnqtcg/awesome-skills · 100 tokens

fuzzing-test

A Go testing guide for generating fuzz tests, which repeatedly try varied inputs to find crashes and unexpected behavior. It first checks whether the code is suitable for fuzzing.

johnqtcg/awesome-skills · 74 tokens

go-test-review

Review Go test code for quality including table-driven tests, t.Helper usage, assertion completeness, boundary cases, benchmarks, fuzz tests, and coverage targets. Trigger when PR contains test.go files, test helpers, httptest usage, testing.B, testing.F, or testdata directories. Use for test-quality focused review.

johnqtcg/awesome-skills · 68 tokens

tdd-workflow

Enforce practical Test-Driven Development for code changes in Go services. Use for new features, bug fixes, refactors, API changes, and new modules. Requires Red-Green-Refactor evidence, defect-hypothesis-driven tests, killer cases, and coverage gates (line + risk-path).

johnqtcg/awesome-skills · 65 tokens

dotnet-csharp-advisor

Développement .NET/C# avec ASP.NET Core, EF Core et patterns modernes. Se déclenche avec ".NET", "C#", "ASP.NET", "EF Core", "Entity Framework", "Minimal API", "Blazor", "LINQ", "NuGet", "dotnet". Also triggers on "C# best practices", "EF Core query".

khalilbenaz/claude-skills-collection · 80 tokens