migrate-nullable-references

Migrate C# projects to nullable reference types with zero CS86xx warnings.

1|Updated May 21, 2026
One-click install
npx skills add https://github.com/1k-off/umbraco-observability-playground --skill migrate-nullable-references-1k-off
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: migrate-nullable-references
Source: https://github.com/1k-off/umbraco-observability-playground/tree/main/.agents/skills/migrate-nullable-references
Command: npx skills add https://github.com/1k-off/umbraco-observability-playground --skill migrate-nullable-references-1k-off

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill helps you adopt nullable reference types (NRTs) in an existing C# codebase and turn the resulting CS86xx warnings into a clean, trustworthy nullability contract without changing runtime behavior.

Core Features & Use Cases

  • Project/solution migration: Enable NRTs and systematically drive the codebase to zero nullable warnings by fixing dereference, annotation, and advanced contract issues.
  • Annotation-first with guardrails: Resolves warnings using metadata changes only (e.g., ?, nullable attributes, ! metadata-only), explicitly avoiding behavior changes like adding ?. or null guards inline.
  • Advanced contract correctness: Uses nullable attributes ([NotNullWhen], [MaybeNullWhen], [MemberNotNull], etc.) for scenarios where ? alone can’t express the true null contract.
  • Runtime-boundary awareness: Flags public/protected API surfaces that may be missing runtime null validation, while recommending an opt-in TODO comment rather than silently altering behavior.

Quick Start

Run the readiness scanner on your project using scripts/Get-NullableReadiness.ps1 to confirm NRT readiness and quantify remaining CS86xx work.

Frequently Asked Questions about migrate-nullable-references

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

FAQPage Schema
What is the best way to migrate a C# project to nullable reference types without changing runtime behavior?

To migrate C# projects to nullable reference types without changing runtime behavior, enable NRT settings and resolve CS86xx warnings using metadata-only annotations like `?` and `[NotNullWhen]`, avoiding inline null guards.

How do I resolve CS8602 and CS8618 warnings when enabling nullable reference types?

Resolve CS8602 and CS8618 warnings by applying metadata-only nullability annotations like `?` and `!`, or using System.Diagnostics.CodeAnalysis attributes like `[NotNullWhen]` to satisfy complex null-flow contracts.

Can I enable nullable reference types incrementally across an existing C# solution?

Yes, nullable reference types can be enabled incrementally using project-wide, warnings-first, or file-by-file rollout scenarios to systematically drive existing C# codebases to a zero-warning state.

When should I use nullable attributes like [NotNullWhen] instead of the ? operator in C#?

Use nullable attributes like `[NotNullWhen]`, `[MaybeNullWhen]`, or `[MemberNotNull]` for advanced contract correctness in C# when the `?` operator alone cannot express the true null-flow contract.

Does enabling nullable reference types require adding null checks to public API surfaces?

No, enabling NRTs avoids silently altering behavior; it flags public or protected API surfaces missing runtime null validation and recommends an opt-in TODO comment rather than automatically adding null checks.