Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
microsoft avatar

Winui Code Review

  • 114 installs
  • 370 repo stars
  • Updated July 27, 2026
  • microsoft/win-dev-skills

winui-code-review is an agent skill that reviews WinUI 3 apps for MVVM, x:Bind, accessibility, theming, security, and performance quality.

About

The winui-code-review skill performs code quality review for WinUI 3 apps covering MVVM compliance, x:Bind correctness, accessibility, theming, security, and performance after the app builds and before committing. It integrates Microsoft.WindowsAppSDK.Analyzers injected via BuildAndRun.ps1 from the winui-dev-workflow skill, surfacing categorized WUI0xxx through WUI4xxx diagnostics for UWP migration, runtime pitfalls, MVVM patterns, and interop issues. MVVM checks require ObservableObject ViewModels with partial ObservableProperty properties, RelayCommand attributes, no UI types in ViewModels, and no business logic in code-behind. x:Bind rules mandate compiled bindings with explicit Mode, x:DataType on DataTemplates, and FallbackValue for nested nullable paths. Accessibility requires AutomationId on interactive controls, names on icon-only buttons, and semantic controls instead of clickable borders. Theming enforces ThemeResource brushes, built-in typography styles, 4px spacing grid, and ControlCornerRadius usage. Security covers secrets in source, unsanitized Process.Start, and validated file paths. Performance checks virtualized lists, x:Load deferral, async UI work, and disposab.

  • Integrates WindowsAppSDK.Analyzers WUI0xxx through WUI4xxx diagnostic rules.
  • Checks MVVM, x:Bind, accessibility, theming, security, and performance.
  • Requires compiled x:Bind with explicit Mode and x:DataType on templates.
  • Enforces AutomationId, ThemeResource brushes, and virtualized list patterns.
  • Produces severity-rated review report with file, line, and fix suggestions.

Winui Code Review by the numbers

  • 114 all-time installs (skills.sh)
  • Ranked #425 of 1,382 Code Review & Quality skills by installs in the Skillselion catalog
  • Security screen: LOW risk (skills.sh audit)
  • Data as of Jul 27, 2026 (Skillselion catalog sync)
At a glance

winui-code-review capabilities & compatibility

Capabilities
mvvm and relaycommand compliance checking · x:bind mode and x:datatype validation · accessibility automationid and semantic control · themeresource theming and spacing grid enforceme · security and performance pattern review with sev
Use cases
code review · frontend
npx skills add https://github.com/microsoft/win-dev-skills --skill winui-code-review

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs114
repo stars370
Security audit3 / 3 scanners passed
Last updatedJuly 27, 2026
Repositorymicrosoft/win-dev-skills

What WinUI 3 quality issues should I fix before committing that compilers and UI tests will not catch?

Review WinUI 3 XAML and C# for MVVM compliance, x:Bind correctness, accessibility, theming, security, and performance before commit.

Who is it for?

WinUI 3 developers reviewing XAML and C# after a successful build and before committing changes.

Skip if: Skip for non-WinUI projects, initial project scaffolding, or build error diagnosis workflows.

When should I use this skill?

User asks for WinUI code review, MVVM compliance check, or pre-commit XAML quality review.

What you get

A severity-rated review report listing MVVM, binding, accessibility, theming, security, and performance issues with fixes.

Files

SKILL.mdMarkdownGitHub ↗

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. The Microsoft.WindowsAppSDK.Analyzers Roslyn analyzer ships with the winui-dev-workflow skill and is injected into your build when you compile via the BuildAndRun.ps1 script that ships with that skill — the script drops a temporary Directory.Build.props into the project that loads the analyzer DLL and its .targets, then cleans up after the build. Plain dotnet build (or VS) does not load the analyzer automatically; if you want it to surface as build diagnostics outside the script, add the <Analyzer Include="..." /> and <Import Project="..." /> to your project's own Directory.Build.props (or wait for the planned NuGet package).

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 TabView content, nested x:Bind without fallback, x:Bind without Mode, null Converter, missing AutomationId, attached-property syntax)
  • WUI3xxx — MVVM patterns (old [ObservableProperty] field syntax)
  • WUI4xxx — Interop (WebView2 not initialized, removed ONNX Runtime GenAI APIs WUI4101-WUI4103)

Every diagnostic ships at Warning severity (no rule is Error) and includes a helpLinkUri. Suppress noise with #pragma warning disable WUIxxxx or <NoWarn> as usual — the analyzer's SuppressionTests verify that pragma suppression round-trips correctly.

MVVM Compliance

  • [ ] ViewModels extend ObservableObject, use [ObservableProperty] partial properties (not fields)
  • [ ] Commands use [RelayCommand] attribute, not manual ICommand implementations
  • [ ] 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 Task for async methods, async void only for event handlers
  • [ ] Never replace ObservableCollection<T> — use .Clear() + re-add

x:Bind and Data Binding

  • [ ] All bindings use {x:Bind}, not {Binding}
  • [ ] Mode=OneWay or TwoWay set explicitly — OneTime default causes blank UI for dynamic data
  • [ ] x:DataType set on every DataTemplate — required for compiled x:Bind
  • [ ] No nested nullable paths (e.g., ViewModel.Selected.Name) without FallbackValue
  • [ ] Command bindings can use OneTime (commands don't change) — don't add Mode=OneWay to Command="{x:Bind}"

Accessibility

  • [ ] AutomationProperties.AutomationId on every interactive control (Button, TextBox, ComboBox, ToggleSwitch, ListView, NavigationViewItem)
  • [ ] AutomationProperties.Name on icon-only buttons and controls without visible text
  • [ ] Semantic controls (Button, HyperlinkButton) — not clickable Border/TextBlock
  • [ ] No information conveyed by color alone

Theming

  • [ ] All colors use {ThemeResource} brushes — no hardcoded #FF0000 or Color="Blue"
  • [ ] Typography uses built-in styles (TitleTextBlockStyle, SubtitleTextBlockStyle, BodyTextBlockStyle, CaptionTextBlockStyle) — no raw FontSize
  • [ ] 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.Start with unsanitized user input
  • [ ] External input validated and sanitized before use
  • [ ] File paths from user input not used directly in File.Delete / File.WriteAllText without validation

Performance

  • [ ] Long or dynamic lists use ListView/GridView (virtualized), not StackPanel with foreach
  • [ ] x:Load for content that's not always visible (e.g., dialogs, secondary panels)
  • [ ] Heavy work off UI thread via Task.Run or async/await — never block UI
  • [ ] No .Result / .Wait() / .GetAwaiter().GetResult() — these deadlock the UI thread
  • [ ] using statements on all disposable objects (Model, Tokenizer, InferenceSession, Generator)

Globalization

  • [ ] User-facing strings use x:Uid in XAML and ResourceLoader in 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 (FlowDirection inherited from root, no absolute positioning that breaks in RTL)
  • [ ] No string concatenation for user-facing messages — use string.Format or interpolation with resource strings

Review Report

After reviewing, summarize: 1. Issues found: List each with file, line, and what's wrong 2. Severity: Error (must fix), Warning (should fix), or Note (could improve) 3. 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).

Related skills

FAQ

What does winui-code-review produce?

A review report with issues, severity ratings, file and line references, and specific fix suggestions.

When should I use winui-code-review?

After the WinUI app builds and before committing to catch patterns that compile but are wrong or fragile.

Is winui-code-review safe to install?

Review the Security Audits panel on this page before installing in production.

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.