
winui-code-review
Code quality review for WinUI 3 apps — MVVM compliance, x:Bind correctness, accessibility, theming, security, and performance. Use before committing to catch issues that the compiler and UI tests won't find.
- Installs
- 200
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/microsoft/win-dev-skills --skill winui-code-review- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads winui-code-review automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
When to Use
Run a code review after the app builds and before committing. This catches quality issues that aren't build errors and aren't visible in UI tests — patterns that compile and run but are wrong, fragile, or slow.
How to Review
Read through the project's XAML and C# files and check each section below. For analyzer setup, see winui-dev-workflow; if it isn't installed, tell the user its checks didn't run.
Before reporting an API mismatch or recommending a replacement, verify it against the restored app project's references with CLI 0.7+ winapp find-api, for example winapp find-api members NavigationView --filter selected --json --project-dir <app-project-dir>. See winui-design for batch property checks and project selection; machine-SDK results are not proof of app-package availability.
The analyzer catches a curated set of WinUI 3 / Windows App SDK issues with categorized 4-digit IDs:
- WUI0xxx — UWP → WinUI 3 API compatibility (
UwpXamlNamespace,Window.Current,CoreDispatcher,GetForCurrentView) - WUI1xxx — Migration-table data-driven hints (UWP API has WinAppSDK equivalent, no equivalent, feature-area hint)
- WUI2xxx — Runtime / layout / XAML pitfalls (raw
TabViewcontent, nullable binding paths, ineffective binding modes, nullConverter, missingAutomationId, attached-property syntax) - WUI3xxx — MVVM patterns (old
[ObservableProperty]field syntax) - WUI4xxx — Interop (
WebView2not initialized, removed ONNX Runtime GenAI APIsWUI4101-WUI4103)
Use the installed package's diagnostic help links for rule details. Check inherited x:DefaultBindMode and event/command/converter exceptions before treating an omitted mode as a defect. Fix root causes; any justified false-positive suppression must be narrow and documented, not a blanket NoWarn policy. Keep IL/CsWinRT warnings enabled as well; the WinUI analyzer does not replace AOT/trim analysis.
MVVM Compliance
- ViewModels extend
ObservableObject, use[ObservableProperty]partial properties (not fields) - Commands use
[RelayCommand]attribute, not manualICommandimplementations - No UI types in ViewModels (
SolidColorBrush,Visibility,BitmapImage) — these belong in converters or XAML - No business logic in code-behind — only navigation, dialog coordination, and event wiring
-
async Taskfor async methods,async voidonly for event handlers - Never replace
ObservableCollection<T>— use.Clear()+ re-add
x:Bind and Data Binding
- Prefer
{x:Bind}for known source types; runtime{Binding}needs a justified source and, for AOT, a generated property provider - Dynamic values use an effective
OneWay/TwoWaymode (explicit or inheritedx:DefaultBindMode) plus change notifications; don't rewrite stable event/command/converter bindings to satisfy a blanket mode rule -
x:DataTypeonDataTemplates using compiledx:Bind, not onPage - No nested nullable paths (e.g.,
ViewModel.Selected.Name) withoutFallbackValue
Native AOT / Trimming (When Intended)
- The published artifact was tested (a Release JIT run is not AOT validation), with IL/CsWinRT warnings fixed rather than suppressed
- ABI-crossing types are partial; JSON and runtime bindings use source generation — see
winui-packaging'sreferences/sourcegen-patterns.md
Accessibility
-
AutomationProperties.AutomationIdon every interactive control (Button, TextBox, ComboBox, ToggleSwitch, ListView, NavigationViewItem) -
AutomationProperties.Nameon icon-only buttons and controls without visible text - Semantic controls (
Button,HyperlinkButton) — not clickableBorder/TextBlock - No information conveyed by color alone
Theming
- All colors use
{ThemeResource}brushes — no hardcoded#FF0000orColor="Blue" - Typography uses built-in styles (
TitleTextBlockStyle,SubtitleTextBlockStyle,BodyTextBlockStyle,CaptionTextBlockStyle) — no rawFontSize - Spacing uses 4px grid multiples (4, 8, 12, 16, 24, 32, 48)
- Corner radius uses
ControlCornerRadius/OverlayCornerRadius— not hardcoded values - Styles referenced with
{StaticResource}not{ThemeResource}(except for brush usage sites)
Security
- No secrets, API keys, or tokens in source code
- No
Process.Startwith unsanitized user input - External input validated and sanitized before use
- File paths from user input not used directly in
File.Delete/File.WriteAllTextwithout validation
Performance
- Long or dynamic lists use
ListView/GridView(virtualized), notStackPanelwithforeach -
x:Loadfor content that's not always visible (e.g., dialogs, secondary panels) - Heavy work off UI thread via
Task.Runorasync/await— never block UI - No
.Result/.Wait()/.GetAwaiter().GetResult()— these deadlock the UI thread -
usingstatements on all disposable objects (Model,Tokenizer,InferenceSession,Generator)
Globalization
- User-facing strings use
x:Uidin XAML andResourceLoaderin C# — not hardcoded - String resources in
Strings/en-us/Resources.resw(not.resx) - Date/number formatting uses
CultureInfo.CurrentCulture— not hardcoded formats - Layout supports RTL (
FlowDirectioninherited from root, no absolute positioning that breaks in RTL) - No string concatenation for user-facing messages — use
string.Formator interpolation with resource strings
Review Report
After reviewing, summarize:
- Issues found: List each with file, line, and what's wrong
- Severity: Error (must fix), Warning (should fix), or Note (could improve)
- Suggested fixes: Specific code changes for each issue
References
For detailed rules with code examples, see references/quality-rules.md — covers performance deep dives (x:Phase, layout optimization), security (PasswordVault, DPAPI, WebView2 hardening), accessibility (keyboard nav, screen readers), code quality (.editorconfig, naming), and globalization (x:Uid patterns, RTL, pluralization).
FAQ
What does the winui-code-review skill do?
Code quality review for WinUI 3 apps — MVVM compliance, x:Bind correctness, accessibility, theming, security, and performance. Use before committing to catch issues that the compiler and UI tests won't find.
How do I install winui-code-review?
Run npx skills add https://github.com/microsoft/win-dev-skills --skill winui-code-review in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/winui-code-review/ (personal) or .claude/skills/winui-code-review/ (project).
Which AI agents can use winui-code-review?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is winui-code-review safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains winui-code-review?
It is published by microsoft in microsoft/win-dev-skills, and it is an official skill from the maker of the technology it covers. It has 200 recorded installs.
More from microsoft/win-dev-skills
winui-design
microsoft/win-dev-skills
Open the skill to read its SKILL.md instructions.
winui-ui-testing
microsoft/win-dev-skills
Open the skill to read its SKILL.md instructions.
winui-dev-workflow
microsoft/win-dev-skills
Build and run workflow for WinUI 3 apps with WinApp CLI 0.7+ — project creation with winapp new, per-app NuGet analyzer setup, project-mode winapp run, Native AOT publish runs, crash diagnosis, and prerequisites. Use when creating, building, running, or fixing build errors in a WinUI 3 project.
winui-packaging
microsoft/win-dev-skills
Open the skill to read its SKILL.md instructions.
winui-setup
microsoft/win-dev-skills
Install and verify WinUI 3 prerequisites — .NET SDK 8.0.100+, WinApp CLI 0.7+, and Developer Mode; identify additional Native AOT and Windows Sandbox requirements. Use when the user asks to set up or repair the toolchain, or when another WinUI skill finds a missing or outdated prerequisite.
pr-review
microsoft/win-dev-skills
Open the skill to read its SKILL.md instructions.
Popular code quality & workflow skills
grill-me
mattpocock/skills
A relentless interview to sharpen a plan or design.
improve-codebase-architecture
mattpocock/skills
Scan a codebase for deepening opportunities, present them as a visual HTML report, then grill through whichever one you pick.
handoff
mattpocock/skills
Compact the current conversation into a handoff document for another agent to pick up.
domain-modeling
mattpocock/skills
Build and sharpen a project's domain model. Use when discussing codebase terminology, writing or editing a GLOSSARY.md, or recording or editing an ADR.
codebase-design
mattpocock/skills
Shared vocabulary for designing deep modules. Use when the user wants to design or improve a module's interface, find deepening opportunities, decide where a seam goes, make code more testable or AI-navigable, or when another skill needs the deep-module vocabulary.
diagnosing-bugs
mattpocock/skills
Diagnosis loop for hard bugs and performance regressions. Use when the user says "diagnose"/"debug this", or reports something broken/throwing/failing/slow.