From maui-skills
Guides .NET MAUI performance optimization including profiling with dotnet-trace, compiled bindings, layout efficiency, image optimization, trimming, NativeAOT, and startup improvements. For slow apps, large sizes, or poor responsiveness.
npx claudepluginhub davidortinau/maui-skills --plugin maui-skillsThis skill uses the workspace's default tool permissions.
- **dotnet-trace**: Cross-platform profiler for all MAUI targets. Collect traces with:
Guides .NET MAUI XAML/C# data bindings: compiled x:DataType, INotifyPropertyChanged/ObservableObject, converters, modes, relative bindings, fallbacks, and MVVM practices.
Guards .NET MAUI projects against deprecated, obsolete, or removed APIs in XAML/C#, Blazor Hybrid, and MauiReactor. Detects target frameworks/library versions and provides replacement patterns for code generation/review/editing.
Audits SwiftUI runtime performance via code review for slow rendering, janky scrolling, high CPU/memory, excessive updates, layout thrash, and guides Instruments profiling.
Share bugs, ideas, or general feedback.
dotnet-trace collect --process-id <PID> --providers Microsoft-DotNETCore-SampleProfiler
x:DataType on pages/views to enable compiled bindings.x:DataType at the highest reasonable scope (page or root element).<ContentPage xmlns:vm="clr-namespace:MyApp.ViewModels"
x:DataType="vm:MainViewModel">
<Label Text="{Binding Title}" />
</ContentPage>
DataTemplate inside CollectionView/ListView, set x:DataType on the template root:<DataTemplate x:DataType="model:Item">
<Label Text="{Binding Name}" />
</DataTemplate>
{Binding}. Use literal values or x:Static instead.StackLayout with one child is pointless overhead.Grid over nested StackLayout/VerticalStackLayout — Grid resolves layout in a single pass.IsVisible="False" to hide elements rather than adding/removing from the tree at runtime.AbsoluteLayout when Grid with row/column definitions achieves the same result.WidthRequest/HeightRequest where sizes are known to reduce measure passes.ItemSizingStrategy="MeasureFirstItem" on CollectionView when items have uniform height — avoids measuring every item individually.<CollectionView ItemSizingStrategy="MeasureFirstItem"
ItemsSource="{Binding Items}">
CollectionView over ListView for new development.DataTemplate visual trees shallow — fewer nested layouts per item.Aspect="AspectFill" or AspectFit and set explicit dimensions.CachingEnabled="True" (default) on UriImageSource, set CacheValidity.App.xaml): Shared styles, colors, converters used across multiple pages.MergedDictionaries to organize large resource sets without bloating a single file.App constructor and MainPage constructor.Shell routing for deferred loading).Handlers/Effects registrations from MauiProgram.cs.AndroidManifest.xml doesn't force unnecessary permissions checks at launch.Enable IL trimming to reduce app size and remove unused code:
<PropertyGroup>
<PublishTrimmed>true</PublishTrimmed>
<TrimMode>full</TrimMode>
</PropertyGroup>
[DynamicDependency] or [UnconditionalSuppressMessage] to preserve reflection targets.<PropertyGroup>
<PublishAot>true</PublishAot>
<PublishTrimmed>true</PublishTrimmed>
</PropertyGroup>
[JsonSerializable] source generators instead of reflection-based JSON serialization.dotnet publish with AOT to verify no warnings before shipping.x:DataType on all pages, templates, and data-bound viewsItemSizingStrategy="MeasureFirstItem" on uniform CollectionViews