csharp-scripts
Run file-based C# apps with the .NET CLI when the user explicitly wants C#/.NET code without…
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
$ npx -y skills add dotnet/skills --skill winforms-expert --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/winforms-expertContext preview
The summary Claude sees to decide when to auto-load this skill.
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
name: winforms-expert description: >- 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 markers is present. license: MIT
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.
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:
1. Run that narrow validator first and fix every failure it attributes to the change. 2. Run the focused project build after the validator passes. 3. If the build or any later edit changes source, rerun the narrow validator. 4. 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
Use this skill for:
Do not use it to:
or application-wide theme unless required by the request.
| 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. |
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:
suspension/resumption, resource application, and named event-handler wiring.
`Items`, `Columns`, or another serialized collection through a local variable.
delegates in generated event wiring.
local functions, expression-bodied logic, collection expressions, null-conditional or null-coalescing expressions, or other runtime decision logic.
established generated members such as `InitializeComponent` and `Dispose`.
and nullable treatment. Do not modernize generated syntax.
`Form`/`UserControl` must have a usable parameterless construction path unless the project uses an established custom designer pattern.
`Friend WithEvents` fields and prefer `Handles` clauses in the main file.
A safe `InitializeComponent` sequence is:
1. Instantiate controls and components. 2. Instantiate the `IContainer` when owned components require it. 3. Call required `BeginInit` and `SuspendLayout` methods. 4. Assign child control/component properties. 5. Add children to serialized collections and wire named handlers. 6. Configure the containing Form/UserControl after its children. 7. Call matching `EndInit`, `ResumeLayout`, and `PerformLayout` where appropriate. 8. Declare serialized backing fields in the generator's established location.
Move anything more complex to the main part
This repository contains the .NET team's curated set of portable skills and host-specific custom agents for coding agents. For information about the Agent Skills standard, see agentskills.io.
Repo: dotnet/skills
Run file-based C# apps with the .NET CLI when the user explicitly wants C#/.NET code without…
Correctly call native (C/C++) libraries from .NET using P/Invoke and LibraryImport. Covers…
Set up NuGet trusted publishing (OIDC) on a GitHub Actions repo — replaces long-lived API…
Design, implement, optimize, and review SIMD code in .NET. USE FOR: vectorizing scalar loops…
Guides technology selection and implementation of AI and ML features in .NET 8+ applications…
Guides conversion of a pre-.NET 8 Blazor Server app into a .NET 8+ Blazor Web App. USE FOR:…