Files
David Ortinau c4b6819dda Add 7 core .NET MAUI development skills to dotnet-maui plugin (#456)
* Add 7 core .NET MAUI development skills to dotnet-maui plugin

Add maui-shell-navigation, maui-collectionview, maui-data-binding,
maui-dependency-injection, maui-app-lifecycle, maui-safe-area, and
maui-theming skills with eval.yaml tests and reference docs.

Update plugin.json, marketplace.json (both copies), and CODEOWNERS.

Resolves #455

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Fix cross-skill references to non-existent skills

Replace 10 dangling references to skills not in this repo
(maui-deep-linking, maui-platform-invoke, maui-unit-testing,
maui-maps, maui-animations, maui-accessibility, maui-app-icons-splash,
maui-bootstrap-theme, maui-localization) with plain-English guidance
or references to skills that exist in this PR.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Fix code correctness bugs and remaining cross-references

Address PR review feedback and skeptic review findings:

Code correctness:
- Fix BackgroundColor="Primary" (XAML crash) → use {StaticResource Primary}
- Fix MergedDictionaries.Clear() (nukes all styles) → remove-then-add pattern
- Fix HorizontalStackLayout Fill (no effect) → use Grid with ColumnDefinitions
- Fix AncestorType with ViewModel type → use ContentPage (visual element)
- Fix Frame usage → replace with Border (recommended control)
- Remove redundant MultiBinding StringFormat="{}{0}"
- Fix OnStart reference → use CreateWindow for theme restore
- Soften lifecycle OnStart/OnSleep characterization (compat shims, not absent)
- Qualify ResourceDictionary code-behind requirement (only for x:Class)

Cross-references:
- Remove all remaining body-text refs to non-existent skills
- Replace with Microsoft Learn doc links or generic guidance

Eval:
- Relax SafeAreaRegions assertion to accept SafeAreaEdges or SafeAreaRegions
- Relax theming rubric for ResourceDictionary code-behind

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Restore Clear() theme pattern with clarifying comment

The Clear()+Add() pattern is intentional — theme dictionaries are designed
to be the only merged dictionaries in this architecture. Added comment
explaining the assumption and what to do if non-theme dictionaries exist.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Fix second-pass review findings: API accuracy and eval robustness

Code correctness:
- ScrollView SafeAreaEdges="All" → "Container" (ScrollView only honors
  Container and None; All silently fails for keyboard avoidance)
- DI CreateWindow example: add comment noting AppShell must be registered
- AddHttpClient: add comment noting Microsoft.Extensions.Http NuGet required
- MultiBinding: remove redundant StringFormat from reference doc (matches SKILL.md)
- RelativeSource Self table: Path=Width → Path=WidthRequest (Width is
  read-only -1 before layout; WidthRequest is the correct bindable property)
- CollectionView StackLayout warning: clarify it refers to BindableLayout
  on StackLayout vs CollectionView ItemsLayout types
- SafeAreaEdges: fix "attached property" → "property" (it's a regular property)
- ios:NavigationPage example: add xmlns comment for ios namespace

Eval assertions:
- DI Scoped regex: accept "doesn't"/"lacks"/"without" not just "no"
- CollectionView ViewCell: match negation in either direction around ViewCell
- Lifecycle events: require 3+ distinct events instead of any single one

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Fix final PR review comments

- safe-area eval: tighten Container assertion to require SafeAreaEdges context
- DI: merge #else fallback into single compilable #if block
- lifecycle: behaviour → behavior (American English consistency)
- theming: macOS Catalyst minimum 10.14 → 10.15 (Catalina required)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-02 15:48:30 +02:00

88 lines
4.0 KiB
YAML

scenarios:
- name: "Set up compiled bindings with x:DataType on a page"
prompt: |
I have a .NET MAUI ContentPage called SettingsPage.xaml that currently uses
plain bindings with no x:DataType. The page's BindingContext is a
SettingsViewModel with properties: string Theme, bool NotificationsEnabled,
and int FontSize. Convert this page to use compiled bindings and tell me
how to catch binding errors at build time.
assertions:
- type: "output_contains"
value: "x:DataType"
- type: "output_matches"
pattern: "(?i)SettingsViewModel"
- type: "output_matches"
pattern: "XC0022|XC0025|WarningsAsErrors"
rubric:
- "Places x:DataType on the ContentPage root element pointing to SettingsViewModel"
- "Does not scatter x:DataType on child elements or use x:DataType='x:Object'"
- "Recommends enabling XC0022 and/or XC0025 as warnings-as-errors in the .csproj"
- "Explains that compiled bindings are faster and required for NativeAOT/trimming"
timeout: 120
- name: "Implement MVVM ViewModel with ObservableObject"
prompt: |
I need to create a ProductDetailViewModel for a .NET MAUI app. It should
have properties for Name (string), Price (decimal), IsAvailable (bool),
and a LoadCommand that fetches data asynchronously. Show me how to
implement this with proper change notification so bindings update the UI.
assertions:
- type: "output_matches"
pattern: "(?i)ObservableObject|INotifyPropertyChanged"
- type: "output_matches"
pattern: "(?i)ObservableProperty|PropertyChanged"
- type: "output_matches"
pattern: "(?i)RelayCommand|ICommand"
rubric:
- "Uses CommunityToolkit.Mvvm ObservableObject with [ObservableProperty] or implements INotifyPropertyChanged manually"
- "Includes all four members: Name, Price, IsAvailable, and a load command"
- "Shows how the generated properties raise PropertyChanged automatically when using the toolkit"
- "Does not use a base class that doesn't implement INotifyPropertyChanged"
timeout: 120
- name: "Create and use an IValueConverter"
prompt: |
In my .NET MAUI app I have a status field that is an enum:
enum OrderStatus { Pending, Shipped, Delivered, Cancelled }.
I want to display a different color for each status in a Label's TextColor.
Show me how to create a value converter and wire it up in XAML.
assertions:
- type: "output_contains"
value: "IValueConverter"
- type: "output_matches"
pattern: "(?i)Convert"
- type: "output_matches"
pattern: "(?i)StaticResource|x:Key"
rubric:
- "Implements IValueConverter with a Convert method that maps each enum value to a Color"
- "Declares the converter in XAML resources with an x:Key"
- "Shows the binding syntax with Converter={StaticResource ...}"
- "Handles the default/fallback case in the converter"
timeout: 120
- name: "Diagnose missing BindingContext and non-compiled bindings"
prompt: |
My .NET MAUI page shows blank labels even though my ViewModel properties
have values. Here is my XAML:
```xml
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
<VerticalStackLayout>
<Label Text="{Binding Title}" />
<Label Text="{Binding Description}" />
</VerticalStackLayout>
</ContentPage>
```
What am I doing wrong?
assertions:
- type: "output_matches"
pattern: "(?i)BindingContext"
- type: "output_matches"
pattern: "(?i)x:DataType"
rubric:
- "Identifies that BindingContext is never set on the page"
- "Shows how to set BindingContext either in XAML or code-behind"
- "Points out the missing x:DataType and recommends compiled bindings"
- "Explains that without BindingContext, bindings resolve to null and display empty"
timeout: 120