csharp-nrt

Apply NRT rules to C# property declarations to prevent fake defaults.

Updated Mar 1, 2026
One-click install
npx skills add https://github.com/CloudyWing/ai-dotfiles --skill csharp-nrt
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: csharp-nrt
Source: https://github.com/CloudyWing/ai-dotfiles/tree/main/skills/csharp-nrt
Command: npx skills add https://github.com/CloudyWing/ai-dotfiles --skill csharp-nrt

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides clear, actionable guidelines to prevent misuse of C# Nullable Reference Types (NRT), stop developers from silencing nullability warnings with fake defaults, and ensure property nullability reflects actual business intent.

Core Features & Use Cases

  • Consistent property strategies for DTOs, request models, EF Core entities, domain models, and record types to reduce runtime null errors.
  • Clear exceptions and patterns such as allowing null-forgiving only for EF Core navigation properties, initializing collections with empty collections, and using required/init/set appropriately.
  • Practical guidance for null checks, guard clauses, and compiler flow-analysis friendly patterns to improve code reliability and readability.

Quick Start

Apply these C# NRT guidelines to review and update your project's property declarations so that nullability, required annotations, and collection initialization align with business semantics.

Frequently Asked Questions about csharp-nrt

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I stop masking C# nullable reference type warnings with fake defaults?

To stop masking C# nullable reference type warnings, apply NRT rules to property declarations so nullability reflects actual business intent rather than silencing compiler warnings with arbitrary initializers.

What is the best way to handle nullability for EF Core entity navigation properties?

The best way to handle EF Core entity navigation properties is using the null-forgiving operator strictly for initializations, as this Skill enforces clear exceptions to prevent runtime null errors.

How do I configure required and init semantics for C# DTOs and request models?

Configure required, init, and set semantics for C# DTOs and request models by applying consistent property strategies that align nullability annotations with business semantics to ensure proper API binding.

When should I use the null-forgiving operator in C# projects with nullable enabled?

You should strictly limit the null-forgiving operator in C# NRT projects to specific exceptions like EF Core navigation properties, preventing misuse that masks underlying nullability warnings.

Why do my C# collections trigger nullability warnings in domain models?

C# collections trigger nullability warnings in domain models when not initialized properly; initializing collections with empty collections enforces safe NRT rules and improves compiler flow-analysis.

Does this NRT guidance work for C# record types and API binding scenarios?

Yes, this NRT guidance works for C# record types and API binding scenarios by providing consistent property strategies, pattern-matching null checks, and guard clauses to improve code reliability.