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

83 lines
3.9 KiB
YAML

scenarios:
- name: "Add light/dark mode support using AppThemeBinding"
prompt: |
I have a .NET MAUI app with a ContentPage containing labels, buttons, and
a background color. Everything is hardcoded to light colors right now.
I want the app to automatically switch between light and dark mode based
on the device's system theme. Show me how to use AppThemeBinding to make
this page theme-aware in XAML and explain the C# alternative.
assertions:
- type: "output_contains"
value: "AppThemeBinding"
- type: "output_matches"
pattern: "(?i)Light.*Dark"
- type: "output_matches"
pattern: "SetAppThemeColor|SetAppTheme"
rubric:
- "Shows XAML AppThemeBinding syntax with Light and Dark values on visual properties"
- "Demonstrates the C# SetAppThemeColor or SetAppTheme<T> extension method"
- "Does not suggest hardcoded color values as a final solution"
timeout: 120
- name: "Create custom themes with ResourceDictionary switching"
prompt: |
I need to support three branded themes in my .NET MAUI app — a light theme,
a dark theme, and a high-contrast theme. Users should be able to pick their
preferred theme from a settings page and it should apply immediately across
the app. How do I set this up?
assertions:
- type: "output_contains"
value: "ResourceDictionary"
- type: "output_contains"
value: "DynamicResource"
- type: "output_contains"
value: "MergedDictionaries"
rubric:
- "Creates separate ResourceDictionary files with matching keys for each theme"
- "Uses DynamicResource (not StaticResource) for consuming theme values"
- "Shows how to swap theme dictionaries at runtime via MergedDictionaries"
- "Mentions how theme ResourceDictionaries are structured and loaded (compiled XAML with x:Class or Source-based)"
timeout: 120
- name: "Detect and respond to system theme changes"
prompt: |
My .NET MAUI app needs to detect when the user toggles dark mode in their
device settings and respond in real time — both updating the UI and logging
the change. How do I detect the current system theme and subscribe to
theme change events? Also, how do I let the user force a specific theme
regardless of system setting?
assertions:
- type: "output_contains"
value: "RequestedThemeChanged"
- type: "output_contains"
value: "UserAppTheme"
- type: "output_matches"
pattern: "RequestedTheme"
rubric:
- "Shows how to read the current theme via Application.Current.RequestedTheme"
- "Subscribes to the RequestedThemeChanged event for real-time detection"
- "Demonstrates forcing a theme with Application.Current.UserAppTheme"
- "Shows resetting to system default with AppTheme.Unspecified"
timeout: 120
- name: "Avoid common theming mistakes"
prompt: |
I'm adding dark mode to my .NET MAUI Android app. I created ResourceDictionary
themes and used StaticResource to bind colors in my XAML pages. When I
switch themes at runtime nothing changes — the colors stay the same. Also,
when the user toggles dark mode in Android settings my app seems to restart
completely. What am I doing wrong?
assertions:
- type: "output_contains"
value: "DynamicResource"
- type: "output_contains"
value: "StaticResource"
- type: "output_contains"
value: "UiMode"
rubric:
- "Identifies StaticResource as the root cause of colors not updating and recommends DynamicResource"
- "Explains that StaticResource is frozen at first load and does not respond to dictionary changes"
- "Identifies the missing ConfigChanges.UiMode on MainActivity as the cause of the activity restart"
- "Provides the correct Activity attribute with ConfigChanges.UiMode included"
timeout: 120