csharp-nullable-reference-types

csharp-nullable-reference-types is a skill for Claude Code from Aaronontheweb/dotnet-skills. It costs 126 tokens per session (2,526 once invoked), scanned A, original, MIT.

Guidance for using C# nullable reference types, which let the compiler track whether a reference may contain no value.

In plain words
What is it for?
Use it when adding nullability checks to new or existing C# code, designing APIs, or wrapping older libraries that do not describe nullability.
Why use it?
It makes missing-value expectations explicit and helps catch possible null-reference errors before the program runs.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the dotnet-skills plugin — 39 skills, 6 agents shipped together

Good fit Use it when adding nullability checks to new or existing C# code, designing APIs, or wrapping older libraries that do not describe nullability.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/aaronontheweb/dotnet-skills/csharp-nullable-reference-types
About the project

.NET Skills is an AI coding plugin that provides skills and specialized guidance for professional .NET development, covering areas such as C#, Akka.NET, Aspire, Entity Framework Core, testing, and performance. .NET developers use it with coding assistants to apply production-oriented patterns while building and maintaining applications. The catalogue contains the plugin’s skills, agents, and instructions.

Aaronontheweb/dotnet-skills · 1,241 stars · on GitHub

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 Aaronontheweb/dotnet-skills --skill csharp-nullable-reference-types
Clone the repo
git clone --depth 1 https://github.com/Aaronontheweb/dotnet-skills

Made for: Claude Code.

Or install dotnet-skills, the plugin that ships this one along with the rest of its 39 skills, 6 agents.

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-nullable-reference-types

README.md
[![agentmods](https://agentmods.dev/badge/skills/aaronontheweb/dotnet-skills/csharp-nullable-reference-types/github.svg)](https://agentmods.dev/skills/aaronontheweb/dotnet-skills/csharp-nullable-reference-types)
Your own site
<a href="https://agentmods.dev/skills/aaronontheweb/dotnet-skills/csharp-nullable-reference-types"><img src="https://agentmods.dev/badge/skills/aaronontheweb/dotnet-skills/csharp-nullable-reference-types/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-nullable-reference-types

Your own site · 80×15
<a href="https://agentmods.dev/skills/aaronontheweb/dotnet-skills/csharp-nullable-reference-types"><img src="https://agentmods.dev/badge/skills/aaronontheweb/dotnet-skills/csharp-nullable-reference-types.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 126 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,526 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 Anti-Refusal · line 168
    Skill instructs the agent to omit warnings, disclaimers, or ethical commentary. Stripping safety caveats hides risk from the user and is a common jailbreak preamble.
    Fix: Remove instructions that suppress warnings, disclaimers, or ethical commentary. Let the agent surface safety-relevant caveats to the user.
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.00126 $0.02526
Opus 5.5 $0.00050 $0.01010
Sonnet 5.5 $0.00025 $0.00505
Haiku 4.5 $0.00013 $0.00253

Measured 1mo ago against content hash 62c64b253f51, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

csharp-nullable-reference-types 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 1mo 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.

skills/csharp-nullable-reference-types/SKILL.md · 199 lines

How it starts

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

C# Nullable Reference Types

When to Use

  • Introducing nullable reference types (NRT) into a codebase that has not yet adopted them
  • Writing or refactoring C# code that uses T? / nullable annotations
  • Annotating APIs with System.Diagnostics.CodeAnalysis nullable attributes
  • Designing public/internal APIs where nullability contracts matter
  • Wrapping unannotated or legacy APIs so downstream callers still benefit from NRT
  • Reviewing code for correct null-state analysis, guard helpers, and the field keyword

Core Goals

  • Prevent NullReferenceException at runtime by making null intent explicit in signatures.
  • Express contracts the type system cannot represent directly using the official nullable attributes.
  • Adopt NRT incrementally in legacy codebases without a big-bang rewrite.

Core Nullability Model

Non-nullable vs nullable

  • string — non-nullable reference. The compiler assumes instances are never null; assigning null or a maybe-null value produces a warning.
  • string? — nullable reference. The variable may be null; the compiler requires a null check before dereference.
string name = "Alice";
name = null;          // Warning: assigning null to non-nullable.

string? nickname = null;
Console.WriteLine(nickname.Length); // Warning: possible null dereference.

Null-state analysis (flow)

The compiler tracks whether a reference is definitely non-null or maybe null. Null checks and assignments update this state.

string? message = GetMessageOrNull();

if (message != null)
{
    // message is definitely non-null in this block.
    Console.WriteLine(message.Length);
}

// Outside the if, message is maybe null again.

Introduce explicit null checks (if (x != null), is not null, pattern matching) before dereferencing nullable values. Narrow nullability early and keep the non-null state alive. Null-conditional assignment (C# 14) lets you write customer?.Order = CreateOrder(); — the right side is evaluated only when the receiver is non-null.

Read the full file on GitHub · 199 lines

Files

What ships with it

2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 1mo ago First seen · 199 lines · 126 tokens per session scan A 62c64b253f51

Subscribe to this mod's changes

csharp-nullable-reference-types is a skill published in the GitHub repository Aaronontheweb/dotnet-skills (1,241 stars, last pushed 16d ago), licensed MIT. It adds 126 tokens to every session and 2,526 once invoked, about $0.0005 per session on Opus 5.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-08-30.

Related

Other skills, from other repositories

csharp-patterns

C# / .NET discipline — ASP.NET Core idioms, Minimal APIs / MVC controllers, async/await end-to-end (no .Result/.Wait()), records for value types, sealed types where inheritance unneeded, IOptions for config, ILogger structured logging, HttpClientFactory not new HttpClient(), EF Core async + AsNoTracking + projection…

Nmor/the-claude-council · 107 tokens

dotnet-analyzer-config

Use a repo-root .editorconfig to configure free .NET analyzer and style rules. Use when a .NET repo needs rule severity, code-style options, section layout, or analyzer ownership made explicit. Nested .editorconfig files are allowed when they serve a clear subtree-specific purpose.

Postpartum-genushyacinthus29/dotnet-skills · 64 tokens

dotnet-meziantou-analyzer

Use the open-source free Meziantou.Analyzer package for design, usage, security, performance, and style rules in .NET. Use when a repo wants broader analyzer coverage with a single NuGet package.

Postpartum-genushyacinthus29/dotnet-skills · 54 tokens

dotnet-roslynator

Use the open-source free Roslynator analyzer packages and optional CLI for .NET. Use when a repo wants broad C# static analysis, auto-fix flows, dead-code detection, optional CLI checks, or extra rules beyond the SDK analyzers.

Postpartum-genushyacinthus29/dotnet-skills · 59 tokens

dotnet-csharpier

Use the open-source free CSharpier formatter for C# and XML. Use when a .NET repo intentionally wants one opinionated formatter instead of a highly configurable dotnet format-driven style model.

Postpartum-genushyacinthus29/dotnet-skills · 51 tokens

dotnet-stylecop-analyzers

Use the open-source free StyleCop.Analyzers package for naming, layout, documentation, and style rules in .NET projects. Use when a repo wants stricter style conventions than the SDK analyzers alone provide.

Postpartum-genushyacinthus29/dotnet-skills · 53 tokens