enforcing-record-constructor-initialization

Enforce positional constructors with named arguments for C# record instantiation.

Updated Feb 12, 2026
One-click install
npx skills add https://github.com/christian289/task_20260212 --skill enforcing-record-constructor-initialization
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: enforcing-record-constructor-initialization
Source: https://github.com/christian289/task_20260212/tree/main/.claude/skills/enforcing-record-constructor-initialization
Command: npx skills add https://github.com/christian289/task_20260212 --skill enforcing-record-constructor-initialization

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps ensure strong immutability in C# record types by enforcing the use of positional constructor with named arguments instead of property initializer syntax.

Core Features & Use Cases

  • Immutability Enforcement: Enforces the use of positional constructor with named arguments in record type instantiation, enhancing code clarity and maintainability.
  • Code Clarity: Enhances readability by using named arguments, making it clear which arguments correspond to which properties.
  • Use Case: It can be used to enforce best practices in C# development for creating immutable record types, ensuring that all records are created with all necessary properties initialized.

Quick Start

Instantiate a record using positional constructor and named arguments, like: var record = new Record(Prop1: value1, Prop2: value2);

Frequently Asked Questions about enforcing-record-constructor-initialization

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

FAQPage Schema
How do I enforce immutability when constructing C# records?

To enforce immutability in C# records, instantiate them using a positional constructor with named arguments, like `var record = new Record(Prop1: value1);`, instead of using property initializer syntax.

What's the best way to initialize C# record types for code clarity?

The best way to initialize C# record types for clarity is using a positional constructor with named arguments, making it explicitly clear which arguments correspond to which properties during instantiation.

Why use positional constructors with named arguments for C# records?

Using positional constructors with named arguments for C# records ensures strong immutability and improves code readability by preventing the use of property initializer syntax and making property mappings obvious.

Can I use property initializer syntax for C# record instantiation?

You should avoid property initializer syntax for C# record instantiation. Instead, use a positional constructor with named arguments to guarantee all necessary properties are initialized immutably.

Do I need external dependencies to enforce C# record immutability?

No, you do not need external dependencies to enforce C# record immutability. You can enforce it directly by using the built-in positional constructor with named arguments during record instantiation.

When do I need to use named arguments in a positional constructor for C# records?

You need to use named arguments in a positional constructor for C# records when you want to enforce best practices for immutability, ensuring all records are created with all necessary properties clearly initialized.