Skip to content
Agentmart
Submit a tool

nuget-package-propertychanged-sourcegenerator

Use when simplifying C# view-model property-change notification code, keeping computed properties updated, or reacting to property changes with…

Skill by Cologler

IndexedMIT
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/cologler-nuget-package-propertychanged-sourcegenerator

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Use when simplifying C# view-model property-change notification code, keeping computed properties updated, or reacting to property changes with PropertyChanged.SourceGenerator.

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/nuget-package-propertychanged-sourcegenerator

What's inside

Skill name
nuget-package-propertychanged-sourcegenerator
Description
Use when simplifying C# view-model property-change notification code, keeping computed properties updated, or reacting to property changes with PropertyChanged.SourceGenerator.
License
MIT
Metadata
version: PropertyChanged.SourceGenerator 1.1.2 · homepage: https://github.com/canton7/PropertyChanged.SourceGenerator · generated-by: gpt-6 · last-updated: 2026-10-16
Instructions
83 lines in SKILL.md · view on GitHub

Files (1)

  • SKILL.md

SKILL.md (first lines)

# PropertyChanged.SourceGenerator

## Prerequisite

For a project-local skill, inspect every project in the consuming repository or solution for `PropertyChanged.SourceGenerator`, including imported package references and resolved dependencies. A central `PackageVersion` entry alone does not prove installation. If no project references it, ask whether to install the package or remove this skill, and wait for the user's choice. Only if installation is chosen, run `dotnet add <project.csproj> package PropertyChanged.SourceGenerator`. This check does not apply to the skill catalog itself.

## When and why

Use this source generator to simplify `INotifyPropertyChanged` boilerplate and improve readability in C# view models, with or without an MVVM framework. Annotated fields replace repetitive property setters, equality checks, and notification calls; dependency declarations and hooks keep related behavior close to the property definitions.

The generator adds source code during compilation; it does not rewrite existing property setters. Version 1.1.x requires Visual Studio 2022 17.3 or .NET SDK 6.0.304 or later to build, without requiring the application to target .NET 6.

## Generate notifying properties

Use a `partial` class and put `[Notify]` on backing fields:

```csharp
using PropertyChanged.SourceGenerator;

public partial class PersonViewModel
{
    [Notify] private string _firstName = "";
    [Notify] private string _lastName = "";

    public string FullName => $"{FirstName} {LastName}";

    public void Rename(string firstName, string lastName)
    {
        // Use the generated setters so bindings and dependent properties are notified.
        FirstName = firstName;
        LastName = lastName;
    }
}
```

By default, `_firstName` becomes a public `FirstName` property with public accessors. Its setter compares values using `EqualityComparer<T>.Default` and raises notifications only when the value differs. The generator supplies missing `INotifyPropertyChanged` infrastructure. Do not redeclare generated properties or write directly to their backing fields when notifications are required.

Use `[Notify("DisplayName")]` to override a property name, or `[Notify(Setter.Private)]` to restrict its setter. XML documentation placed before `[Notify]` is copied to the generated property.

Existing notification implementations and base classes are supported. When generation fails with an existing base class, inspect the generator diagnostic and its event-raising method signature before adding duplicate infrastructure.

## Dependent properties

In the example, changes to either generated name property also notify `FullName`. Automatic detection requires getters to read properties on the same instance, not backing fields; it does not observe properties on other objects.

When dependencies cannot be inferred, choose the direction that best expresses the relationship:

1. Put `[DependsOn(nameof(FirstName), nameof(LastName))]` on the dependent property, such as `FullName`.
2. Alternatively, put `[Notify, AlsoNotify(nameof(FullName))]` on each source backing field.

Use property names, not field names. `[DependsOn(...)]` replaces automatic detection for that property, so list all intended dependencies; empty `[DependsOn]` disables automatic detection for it. These attributes raise notifications, not assignments or recalculations of stored property values.

## React to changes

Define an ordinary method in the same partial class using the generated property name:

```csharp
using PropertyChanged.SourceGenerator;

public partial class SearchViewModel
{
    [Notify] private string _query = "";
    [Notify(Setter.Private)] private bool _hasResults;

    private void OnQueryChanged(string oldValue, string newValue)
    {
        // Results for the previous query are no longer valid.
        HasResults = false;
    }
}
```

Supported property hooks are `OnQueryChanged()` or `OnQueryChanged(string oldValue, string newValue)`. For a hook reached through a dependent-property notification, the old value can be `default(T)`.

Before-change notifications are opt-in: the class or a base class must implement `INotifyPropertyChanging`. Its property hooks are `OnQueryChanging()` or `OnQueryChanging(string oldValue)`.

## Further reference

The [project homepage](https://github.com/canton7/PropertyChanged.SourceGenerator) covers details intentionally omitted here: `[IsChanged]` tracking, type-wide hooks, inherited dependency handling, supported base-class event-raising signatures, virtual properties, forwarding attributes with `[PropertyAttribute]`, `.editorconfig` customization, and version-specific build compatibility or workarounds. Consult it only when the task needs those details.

Do not fetch the homepage for information already covered here.

From Cologler/Skills, MIT.

More from Cologler/Skills

Signals

Stars
0
Forks
0
Open issues
0
Last commit (this folder)
Oct 15, 2026 (14 days ago)

From GitHub (fetched Oct 24, 2026).

Details

Version
PropertyChanged.SourceGenerator 1.1.2
License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from Cologler

Cite this page

nuget-package-propertychanged-sourcegenerator skill. Agent Mart. https://agentmart.dev/skills/cologler-nuget-package-propertychanged-sourcegenerator (last updated 2026-10-24)