Agent skill · Databases

migrate-nullable-references

Enable nullable reference types in a C# project and systematically resolve all warnings. USE FOR: adopting NRTs in existing codebases, file-by-file or project-wide migration, fixing CS8602/CS8618/CS86xx warnings, annotating APIs for nullability, cleaning up null-forgiving operators, upgrading dependencies with new nullable annotations. DO NOT USE FOR: projects already fully migrated with zero warnings (unless auditing suppressions), fixing a handful of nullable warnings in code that already has NRTs enabled, suppressing warnings without fixing them, C# 7.3 or earlier projects.

dotnetgithub.com/dotnetGitHub ↗
claude-codeMIT
Install
npx skills add dotnet/skills --skill migrate-nullable-references --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 6
SKILL.md size: 35 KB
Bundled scripts: none
Path: plugins/dotnet-upgrade/skills/migrate-nullable-references/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 4,927
Language: C#
Read our review of the source →

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

Review
written from the skill's own SKILL.md · Aug 5, 2026

What it does

Instructs an AI coding agent to perform a nullable reference type (NRT) migration on an existing C# project or solution. The aim is to switch to <Nullable>enable</Nullable> (or manage via a staged approach), systematically resolve CS8602/CS8618/CS86xx warnings, annotate public APIs for nullability, clean up null-forgiving operators, and adapt dependencies with new nullable annotations. It supports both file-by-file and project-wide migrations and outlines a commit strategy that creates discrete, reviewable changes across several steps.

How it works

  • The skill targets enabling NRTs in an existing codebase and requires generating a project (or solution) with <Nullable>enable</Nullable>, zero nullable warnings, and correctly annotated public APIs.
  • It is used when enabling NRTs in an existing project, resolving dereference warnings, annotating declarations, applying nullable attributes, and cleaning up suppressions (Steps 2–6).
  • It prescribes a step-by-step workflow with a strong emphasis on not changing runtime behavior: only metadata changes such as nullable annotations, NotNullWhen attributes, and nullable directives are allowed; any latent runtime bugs discovered should be deferred with TODO comments for separate fixes.
  • It defines a commit strategy: commit after enabling Nullable, after fixing dereference warnings, after annotating declarations, after applying nullable attributes, and after cleaning up suppressions.
  • It provides guidance on how to handle build and readiness checks, including language/framework suitability checks (C# 8.0+ and compatible targets), and whether to proceed based on existing Nullable and warnings state.
  • It includes detailed guidance for handling common dereference warnings (CS8602, CS8600, CS8603, CS8604) and explicit rules about when to use nullable markers, null-forgiving operators, or guard checks.

When to use it

  • Enabling nullable reference types in an existing C# project or solution.
  • Systematically resolving CS86xx nullable warnings after enabling NRTs.
  • Annotating a library’s public API surface for accurate nullability information.
  • Upgrading a dependency that introduces new nullable annotations and warnings.
  • Analyzing suppressions in a codebase with NRTs to determine possible removals.

What it can touch

  • The policy discusses touching project files to add <Nullable>enable</Nullable> (or <Nullable>warnings</Nullable> during staged strategies).
  • It covers annotations on public API surface and various code declarations to reflect intended nullability (e.g., adding ?, NotNullWhen, and related metadata-only changes).
  • It references commands and tools for readiness checks and builds but the concrete touched items are primarily code entities and project properties as part of the migration process.

Caveats

  • Runtime behavior must not be altered; changes are metadata-only where possible (nullable annotations, directives, and certain attributes).
  • If a latent bug is discovered during migration, the recommended action is to add a TODO comment suggesting a separate fix (e.g., ArgumentNullException.ThrowIfNull) rather than addressing it inline in this migration step.
  • The workflow emphasizes committing at natural boundaries and starting with core types to minimize cascading warnings.
  • It cautions against enabling NRTs on projects that target C# 7.3 or earlier and outlines what to do if language/framework requirements are not met.
From the SKILL.md

# Nullable Reference Migration Enable C# nullable reference types (NRTs) in an existing codebase and systematically resolve all warnings. The outcome is a project (or solution) with `<Nullable>enable</Nullable>`, zero nullable warnings, and accurately annotated public API surfaces — giving both the compiler and consumers reliable nullability information. ## When to Use - Enabling nullable reference types in an existing C# project or solution - Systematically resolving CS86xx nullable warnings after enabling the feature - Annotating a library's public API surface so consumers get accurate nullability information - Upgrading a dependency that has added nullable annotations and new warnings appear - Analyzing suppressions in a code base that has already enabled NRTs to determine whether they can be removed ## When Not to Use - The project already has `<Nullable>enable</Nullable>` and zero warnings — the migration is done unless the user wants to re-examine suppressions with a view to removing unnecessary ones (see Step 6) - The user only wants to suppress warnings without fixing them (recommend against this) - The code targets C# 7.3 or earlier, which does not support nullable referen

What's inside
Steps it walks through
  1. When to Use
  2. When Not to Use
  3. Inputs
  4. Workflow
  5. Step 1: Evaluate readiness
  6. Step 2: Choose a rollout strategy
  7. Step 3: Fix dereference warnings
  8. Step 4: Annotate declarations
  9. Step 5: Apply nullable attributes for advanced scenarios
  10. Step 6: Clean up suppressions
  11. Step 7: Validate
  12. Validation
  13. Code review checklist
  14. Breaking Changes from NRT Annotations (Libraries)
Ships with 5 files
  • references/aspnet-core.md
  • references/breaking-changes.md
  • references/ef-core.md
  • references/nullable-attributes.md
  • scripts/Get-NullableReadiness.ps1
More from skills
All skills →
About this skill
What does the migrate-nullable-references skill do?

Enable nullable reference types in a C# project and systematically resolve all warnings. USE FOR: adopting NRTs in existing codebases, file-by-file or project-wide migration, fixing CS8602/CS8618/CS86xx warnings, annotating APIs for nullability, cleaning up null-forgiving operators, upgrading dependencies with new nullable annotations. DO NOT USE FOR: projects already fully migrated with zero warnings (unless auditing suppressions), fixing a handful of nullable warnings in code that already has NRTs enabled, suppressing warnings without fixing them, C# 7.3 or earlier projects.

How do I install it?

Run `npx skills add dotnet/skills --skill migrate-nullable-references --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.

Where does this skill come from?

From dotnet/skills, a repository with 4,927 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.

Is a popular skill a good skill?

Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.

Keep going