Skip to content

aalmada/Stationary / .agents/skills/dotnet-maui

dotnet-maui

Verified

Build, architect, debug, test, and publish .NET MAUI 10 cross-platform native apps for Android, iOS, Mac Catalyst, and Windows using C#, XAML, or C# markup. USE FOR: MAUI project configuration, single-project targeting, pages, layouts, controls, XAML, MVVM, data binding, CommunityToolkit.Mvvm, dependency injection, Shell navigation, handlers, platform integration, permissions, lifecycle, accessibility, localization, performance, trimming, Appium UI tests, Android/iOS/Windows publishing. DO NOT USE FOR: ASP.NET Core web UI, Blazor-only apps, Avalonia, WPF-only, Xamarin.Forms migration without MAUI target code, or generic .NET code with no MAUI UI or platform concern.

references/performance-and-trimming.md

View on GitHub
# Performance And Trimming

## Measure First

- Profile Release builds on representative physical hardware before optimizing. Measure startup, navigation, scrolling, memory, CPU, network latency, battery use, and crash-free behavior.
- Use platform profilers and traces to identify the actual hot path. Do not optimize XAML, layout, or allocations based on guesses.

## Common Improvements

| Symptom | First Checks |
| --- | --- |
| Slow startup | Startup I/O, unnecessary service construction, image/font assets, synchronous initialization |
| Janky lists | `CollectionView`, template depth, image size/cache, converters, UI-thread work |
| Memory growth | Event subscriptions, retained pages, singleton references to UI/native objects, image lifetimes |
| Slow navigation | Blocking constructors, synchronous data loads, excessive layout nesting, repeated resource lookup |
| Battery/network drain | Polling, uncanceled requests, background streams, duplicate refresh work |

- Virtualize lists with `CollectionView`, page data deliberately, use appropriately sized images, and cache only when measurement justifies it.
- Avoid synchronous I/O and CPU-heavy work on the UI thread. Batch collection changes and dispatch only the final UI mutation.

## Trimming

- Treat linker warnings as release defects. Remove unused dependencies first, then preserve dynamically accessed code with the narrowest supported annotation/configuration.
- Reflection, runtime XAML, serialization, and dynamic type activation can break trimming. Prefer statically analyzable APIs and test the trimmed package on every target.
- A successful Debug build does not validate a trimmed or signed Release artifact.

## Sources

- [Improve app performance](https://learn.microsoft.com/dotnet/maui/deployment/performance?view=net-maui-10.0)
- [Trim a .NET MAUI app](https://learn.microsoft.com/dotnet/maui/deployment/trimming?view=net-maui-10.0)
finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the workStars: 322kUpdated Claude CodeCodexVerifiedInstall
systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixesStars: 322kUpdated Claude CodeCodexVerifiedInstall
test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation codeStars: 322kUpdated Claude CodeCodexVerifiedInstall
skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.Stars: 198kUpdated Claude CodeCodexVerifiedInstall