csharp-winui
/csharp-winui
C# 13 and WinUI 3 code rules for native Windows apps, including async/await, CommunityToolkit.Mvvm, EF Core SQLite, DispatcherQueue, and compiler error fixes. Use when writing, reviewing, or debugging C# and XAML in a Windows app.
- Author
- MinnThikeTunn ↗
- Repository
- Phan-Tee ↗
- Licence
- MIT
- Last repository change
- 02.11.2026
Assessment and security
- Files in this package
- 2
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 02.11.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
C# 13 and WinUI 3 code rules for native Windows apps, including async/await, CommunityToolkit.Mvvm, EF Core SQLite, DispatcherQueue, and compiler error fixes. Use when writing, reviewing, or debugging C# and XAML in a Windows app.
Original author description
C# 13 and WinUI 3 code rules for native Windows apps, including async/await, CommunityToolkit.Mvvm, EF Core SQLite, DispatcherQueue, and compiler error fixes. Use when writing, reviewing, or debugging C# and XAML in a Windows app.
How it works
- Concurrency & UI Thread
- MVVM State with CommunityToolkit.Mvvm
- Entity Framework Core with SQLite
- Keyboard Accelerators & Focus
- Done when
SKILL.md preview
---
name: csharp-winui
description: C# 13 and WinUI 3 code rules for native Windows apps, including async/await, CommunityToolkit.Mvvm, EF Core SQLite, DispatcherQueue, and compiler error fixes. Use when writing, reviewing, or debugging C# and XAML in a Windows app.
---
# C# and WinUI 3
The code is right when it compiles with zero warnings, unit tests pass,
and the app does what the user story says.
## Concurrency & UI Thread
In WinUI 3, all UI elements must be touched on the UI thread only. Background
work uses async/await and hops back when updating models or views.
| Work | Put it in |
| --- | --- |
| UI state, view models, XAML bindings | Main UI thread |
| I/O, database queries, file reading, HTTP | `await Task.Run(...)` or `async` EF Core methods |
| Background timer or worker updating UI | Hop back with `dispatcherQueue.TryEnqueue(() => { ... })` |
- Never block the UI thread with `.Result` or `.Wait()`. Always use `await`.
- Use `CancellationToken` for operations that can be cancelled when navigation changes.
- Handle exceptions inside background tasks to prevent unhandled app termination.
## MVVM State with CommunityToolkit.Mvvm
- Use `[ObservableObject]` on view models.
- Use `[ObservableProperty]` to auto-generate `INotifyPropertyChanged` properties:
```csharp
[ObservableProperty]
private string _title = string.Empty;
```
- Use `[RelayCommand]` on methods to create commands bound in XAML.
- Bind in XAML with `{x:Bind ViewModel.Property, Mode=OneWay}` or `TwoWay`.
## Entity Framework Core with SQLite
- Models use stable `Guid` primary keys (`public Guid Id { get; set; } = Guid.NewGuid();`).
- Database configuration reads `PHANTEE_STORE` or `APP_STORE` for isolated test runs.
- Always enable Write-Ahead Logging (`PRAGMA journal_mode=WAL;`) for responsive concurrent reads.
- Wrap modifications in `using var db = new AppDbContext(); db.SaveChanges();`.
## Keyboard Accelerators & Focus
- Add `KeyboardAccelerator` to buttons and menu items:
```xml
<AppBarButton Icon="Add" Label="New Item">
<AppBarButton.KeyboardAccelerators>
<KeyboardAccelerator Key="N" Modifiers="Control" />
</AppBarButton.KeyboardAccelerators>
</AppBarButton>
```
- Windows open calm: suppress aggressive auto-focusing on startup so no unintended focus ring appears.
## Done when
`dotnet build` completes with 0 errors and 0 warnings, and unit tests pass.
Files in this package (2)
- SKILL.md 2 KB
- agents/openai.yaml 1 KB
Versions
| Repository | Score | Licence |
|---|---|---|
| This page · MinnThikeTunn/Phan-Tee | 100 | MIT |
| daveebbelaar/bawa | 90 | MIT |
Database snapshot: 13.11.2026 · package version ea89ad3155e4 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 100winui-wpf-migration
Migrate or port a WPF app to WinUI 3: namespaces (System.Windows to Microsoft.UI.Xaml), control mapping (DataGrid, WrapPanel, TabControl), Dispatcher to DispatcherQueue, imaging, MVVM with CommunityToolkit.Mvvm, ThemeResource. Use when converting WPF code or fixing migration build errors. - 95winui-app
Bootstrap, develop, and design modern WinUI 3 desktop applications with C# and the Windows App SDK using official Microsoft guidance, WinUI Gallery patterns, Windows App SDK samples, and CommunityToolkit components. Use when creating a brand new app, preparing a machine for… - 100winui-code-review
Review WinUI 3 code or changes for quality: MVVM, x:Bind correctness, accessibility, theming, security, performance, and WinUI analyzer findings. Use when asked to review or audit a WinUI app or its pending changes, or before committing. Catches issues the compiler and UI tests miss. - 100new-windows-app
Create a native Windows app in WinUI 3 from a working template (C# and .NET 10, SQLite, build script, icon script, snapshot mode, self-test, git), with no Visual Studio. Use when the user wants to start a new Windows app or scaffold a WinUI project. - 100wpf-to-winui3-migration
Guide for migrating PowerToys modules from WPF to WinUI 3 (Windows App SDK). Use when asked to migrate WPF code, convert WPF XAML to WinUI, replace System.Windows namespaces with Microsoft.UI.Xaml, update Dispatcher to DispatcherQueue, replace DynamicResource with ThemeResource,… - 98new-win-app
Create a native Windows WinUI 3 app from a working template (.NET, WinUI 3 unpackaged, EF Core SQLite, build script, icon script, snapshot mode, git), with no Visual Studio GUI. Use when the user wants to start a new Windows app or scaffold a Windows project.