winforms-expert
What it does
This skill helps create, change and debug Windows Forms desktop apps in .NET. It is for developers who work with forms, controls and the Visual Studio designer, and who need the designer files to stay editable.
When to use it
- ✓When a Windows Forms form, user control or designer file needs to be created or changed.
- ✓When a WinForms app has layout, data binding or DataGridView problems.
- ✓When a WinForms app updates the screen from background work and needs correct threading.
Skill link
https://github.com/dotnet/skills/blob/main/plugins/dotnet-winforms/skills/winforms-expert/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agent’s skills folder.
Example of what to ask your AI
“Add a search box and a DataGridView to my Windows Forms form, and make sure the designer still opens correctly.”
5 new skills a week. 1 minute to read.
How it works
The agent keeps the designer-generated code separate from the main logic, makes the changes, and runs the project's own checks where they exist to confirm the result.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
WinForms Expert
Purpose
Implement WinForms changes that compile, behave correctly at runtime, and remain editable in the
Visual Studio Designer. Treat InitializeComponent and *.Designer.* as a serialization format,
not ordinary application code; keep behavior in the main partial class and verify designer
usability whenever the environment permits.
Execution Contract
Before editing, list the workspace root and locate any task-specific validator, test script, or documented verification command. Read its scenario selector and required arguments before choosing an implementation. After editing:
- Run that narrow validator first and fix every failure it attributes to the change.
- Run the focused project build after the validator passes.
- If the build or any later edit changes source, rerun the narrow validator.
- Report those commands separately from runtime UI and Designer round-trip checks.
A successful build never substitutes for an available layout, binding, serialization, or designer-safety validator. Do not finish after merely reading a validator or after a build succeeds.
Use the repository's actual command and arguments; the sequence should look like:
pwsh -NoProfile -File <task-validator.ps1> <scenario-arguments>
dotnet build <project> --nologo
Boundaries
Use this skill for:
- Creating or changing a WinForms project,
Form,UserControl, or custom control. - Editing designer-generated layout, event wiring, resources, or component fields.
- Diagnosing a Form Designer load, serialization, scaling, binding, or toolbox problem.
- Implementing WinForms-specific async, MVVM, accessibility, DPI, or dark-mode behavior.
Do not use it to:
- Convert the application to another UI framework unless the user explicitly requests migration.
- Rewrite working generated code for style alone.
- Change the target framework, language version, SDK, package strategy, startup model, DPI mode, or application-wide theme unless required by the request.
- Claim that the Visual Studio Designer works when it was not actually opened and exercised.
Inputs
| Input | Required | How to obtain it |
|---|---|---|
| Requested UI behavior or defect | Yes | Use the user's request and reproduce the symptom when possible. |
| Project language and target framework | Yes | Inspect the project file; do not assume modern .NET or C#. |
| Existing Form/UserControl partial files | Yes | Find the main file, designer file, and matching .resx. |
| Repository conventions | Yes | Inspect nearby WinForms types, build scripts, analyzers, and package management. |
| Designer availability | No | Determine whether a compatible Visual Studio WinForms Designer can be opened. |
Non-Negotiable Designer Contract
There are two code contexts:
| Context | Files | Rule |
|---|---|---|
| Designer serialization | *.Designer.cs, *.Designer.vb, InitializeComponent |
Use simple, deterministic statements the designer can parse and regenerate. |
| Application behavior | Main partial class, services, view models | Use language features supported by the project's TFM and language version. |
In InitializeComponent and designer files:
- Keep control/component construction, property assignments, collection additions, layout suspension/resumption, resource application, and named event-handler wiring.
- Use class-level control/component fields. Do not add a control to
Controls,Items,Columns, or another serialized collection through a local variable. - Use named event handlers defined in the main partial file. Never use lambdas or anonymous delegates in generated event wiring.
- Do not add control flow (
if, loops,switch,try/catch,lock,await,goto), local functions, expression-bodied logic, collection expressions, null-conditional or null-coalescing expressions, or other runtime decision logic. - Do not add business logic, data loading, validation, service calls, or methods other than the
established generated members such as
InitializeComponentandDispose. - Preserve the generator's existing namespace style, qualification style, ordering, resources, and nullable treatment. Do not modernize generated syntax.
- Preserve existing constructors that the designer relies on. A designer-instantiated
Form/UserControlmust have a usable parameterless construction path unless the project uses an established custom designer pattern. - Keep
BeginInit/EndInit, `SuspendLayout
FAQ
Why keep designer code separate?
The designer files are a format Visual Studio reads and writes, so behavior belongs in the main class instead.
Does it help with other UI frameworks?
No. It covers Windows Forms only, and WPF or MAUI need their own guidance.
Will a successful build be enough?
No. The skill also asks for layout, binding and designer checks when the project provides them.
Details
Original description by the author
Create, modify, debug, or review Windows Forms applications only when the request contains a concrete Windows Forms marker. USE FOR: WinForms, Windows Forms, System.Windows.Forms, WinForms Form or UserControl designer files (*.Designer.cs or *.Designer.vb), Visual Studio WinForms Designer, TableLayoutPanel, BindingSource, DataGridView, Control.InvokeAsync, component-tray ownership, or custom control serialization. DO NOT USE FOR: WPF or WPF XAML, including Window.InputBindings, KeyBinding, commands, or DataContext; .NET MAUI; Avalonia; or any request where none of the listed Windows Forms mark
repo: dotnet/skills
Popularity
- GitHub stars
- 5.8k
- Ranking position
- #14650
- License
- MIT
- Updated
- 11/2/2026
Comments
- …
More skills from this repository
create-custom-agent
5.8kHelps your agent create VS Code custom agent files with their own tools, instructions and handoffs to other agents.
create-skill
5.8kHelps your agent create a new agent skill with a valid name, a clear trigger description and a SKILL.md file that follows the standard.
csharp-scripts
5.8kHelps your agent run a small C# program as a single file with the .NET command line tool, without creating a full project.
dotnet-pinvoke
5.8kHelps your agent call native C or C++ libraries from .NET correctly, covering signatures, string handling, memory and safe handles.
Similar skills
angular-developer
280kHelps your agent create Angular code and give project structure advice. Useful for starting new projects, creating code parts, or improving performance and accessibility.
frontend-a11y
280kHelps your agent make web interfaces accessible to everyone. It ensures websites and apps work well with screen readers and keyboard navigation.
frontend-patterns
280kHas your agent apply modern patterns in frontend development. It optimizes performance, manages state, and follows best practices in React and Next.js.