Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Build, maintain, or modernize Windows Forms applications with practical guidance on designer-driven UI, event handling, data binding, MVP separation, and migration to modern .NET. USE FOR: working on Windows Forms UI, event-driven workflows, or classic LOB applications; migrating WinForms from .NET Framework to modern .NET; cleaning up oversized form code. DO NOT USE FOR: unrelated stacks; generic tasks that do not need this specific guidance. INVOKES: inspect the repository context, edit target
.claude/skills/managedcode-winforms/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-02 | ✗→✓ | ▲ Improved | 19% | 0% |
| case-01 | ✗→✓ | ▲ Improved | 18% | 0% |
| case-06 | ✗→✓ | ▲ Improved | 71% | 0% |
| case-23 | ✓→✓ | = Same ✓ | 30% | 0% |
| case-04 | ✓→✓ | = Same ✓ | 25% | 0% |
.Designer.cs directly; changes are lost on regeneration.csharp // View interface — forms implement this public interface ICustomerView { string CustomerName { get; set; } event EventHandler SaveRequested; void ShowError(string message); }
// Presenter — testable without UI public class CustomerPresenter { private readonly ICustomerView _view; private readonly ICustomerService _service; public CustomerPresenter(ICustomerView view, ICustomerService service) { _view = view; _service = service; _view.SaveRequested += async (s, e) => { try { await _service.SaveAsync(_view.CustomerName); } catch (Exception ex) { _view.ShowError(ex.Message); } }; } }
csharp var services = new ServiceCollection(); services.AddSingleton<ICustomerService, CustomerService>(); services.AddTransient<MainForm>(); using var sp = services.BuildServiceProvider(); Application.Run(sp.GetRequiredService<MainForm>());
BindingSource and INotifyPropertyChanged instead of manual control population. See references/patterns.md for complete binding patterns.Progress<T> for progress reporting. Never block the UI thread.ErrorProvider and the Validating event. Call ValidateChildren() before save operations.mermaidflowchart LR A["Form event"] --> B["Presenter handles logic"] B --> C["Service layer / data access"] C --> D["Update view via interface"] D --> E["Validate and display results"]
| Decision | Guidance | |----------|----------| | MVP vs MVVM | Prefer MVP for WinForms — simpler with event-driven model | | BindingSource vs manual | Always prefer BindingSource for list/detail binding | | Sync vs async I/O | Always async — use async void only for event handlers | | Custom controls | Extract reusable UserControl when form grows beyond ~300 lines | | .NET Framework → .NET | Use the official migration guide; validate designer compatibility first |
Other measured skills in the registry, with their headline benchmark lift.