new-control-api

Guides adding public APIs to existing WinForms controls with tracking and conventions.

1.2k|337|Updated Oct 13, 2022
One-click install
npx skills add https://github.com/dotnet/dotnet --skill new-control-api
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: new-control-api
Source: https://github.com/dotnet/dotnet/tree/main/src/winforms/.github/skills/new-control-api
Command: npx skills add https://github.com/dotnet/dotnet --skill new-control-api

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Adding new public APIs to WinForms controls involves many easy-to-miss requirements: API proposal issues, PublicAPI file tracking, PropertyStore backing, CodeDOM serialization, design-time attributes, and XML documentation. This Skill codifies all of these rules so contributors ship compliant, review-ready API changes.

Core Features & Use Cases

  • API Proposal Workflow: Enforces creating or updating an api-suggestion issue with background, proposal, usage, alternatives, and risks sections before implementation.
  • PublicAPI File Maintenance: Specifies exact Roslyn PublicAPI.Unshipped.txt entry formats, including override tracking (RS0016) and experimental API prefixes.
  • WinForms Conventions: Mandates PropertyStore-backed properties, Events-collection delegate storage, ShouldSerialize/Reset patterns, SR.resx resource strings, and XML documentation standards.
  • Use Case: When adding a CornerRadius property to a WinForms control, follow this Skill to produce the property, change event, serialization logic, PublicAPI entries, resource strings, and docs in one compliant pass.

Quick Start

Add a new public property with change notification to an existing WinForms control following the new-control-api conventions.

Frequently Asked Questions about new-control-api

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

FAQPage Schema
How do I add a new public property to a WinForms control?

Store the value in the control's PropertyStore using a static key from PropertyStore.CreateKey, never a backing field. Add a protected virtual On[Property]Changed method, a [Property]Changed event, a CodeDOM serialization strategy, and design-time attributes like SRCategory and SRDescription.

How do I track new WinForms APIs in PublicAPI files?

Add one line per accessor to PublicAPI.Unshipped.txt in Roslyn PublicAPI format, fully qualified and alphabetically sorted. Newly added overrides of public or protected members must also be listed with the override prefix, since RS0016 treats them as new API surface.

Should new WinForms APIs be marked as Experimental?

No, new public APIs are stable by default and must not use the [Experimental] attribute or WFO5xxx diagnostic IDs. Only apply experimental markings when the work item explicitly requests them, including the diagnostic ID, PublicAPI prefixes, and docs rows.

Why does my WinForms API change fail CI but pass dotnet build?

The RS0016 PublicAPI analyzer is enforced as an error only under the CI/Arcade build via build.cmd, while a single-project dotnet build may report zero warnings. Always re-verify API tracking with build.cmd before submitting.

Do WinForms events with custom data use EventHandler<T>?

No, WinForms conventions prohibit generic event handlers. Create a dedicated EventArgs subclass and a dedicated delegate, store the delegate in the inherited Events collection with a static key object, and raise it from the On method.