maui-current-apis

针对 .NET MAUI 的持续 API 货币性保护工具,防止在 XAML/C#、Blazor Hybrid 和 MauiReactor 中使用已弃用、过时或已移除的 API。包含用于推断项目目标框架和库版本的检测框架,以及关于 .NET MAUI 10 中常见已弃用 API 陷阱的精选表格。适用于检测、审查或生成 MAUI 代码以避免不兼容 API。

仓库最近推送
GitHub Stars
181
Forks
21
Issues / PRs
1

安装方式

先用 Prompt 核对来源与依赖。也可下载安装包。

用 AI 助手安装

复制提示词,让助手先核对固定版本和依赖。

查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "maui-current-apis":https://skillpi.com/zh/skills/deepskill-5df1a3dbeedc53817f76a18d6dced780597d0a132b64c9513613a8f5445e0326。安装前核对上游来源和版本:https://github.com/davidortinau/maui-skills。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。

来源与配置

github.com

配置方式待核实

请查看原始来源中的适用工具、依赖和权限要求。

安装实测待补充

针对 .NET MAUI 的持续 API 货币性保护工具,防止在 XAML/C#、Blazor Hybrid 和 MauiReactor 中使用已弃用、过时或已移除的 API。包含用于推断项目目标框架和库版本的检测框架,以及关于 .NET MAUI 10 中常见已弃用 API 陷阱的精选表格。适用于检测、审查或生成 MAUI 代码以避免不兼容 API。

0 下载

介绍来源: third_party · davidortinau · 0.0.1 参考来源

SkillPi 解读

能完成的任务
翻译待完成,请参阅来源文档。
输入和输出
翻译待完成,请参阅来源文档。
实测状态
未测试

文件浏览

在原站浏览文件 ↗

原始 SKILL.md

打开原文 ↗
Frontmatter
name: maui-current-apis
description: >
  Always-on guardrail for .NET MAUI API currency. Prevents AI coding agents from
  using deprecated, obsolete, or removed APIs across XAML/C#, Blazor Hybrid, and
  MauiReactor. Includes a reasoning framework for detecting project target framework
  and library versions, plus a curated table of the most common deprecated API traps
  in .NET MAUI 10.
  USE FOR: "deprecated API", "obsolete API", "API migration", "MAUI breaking changes",
  "check API currency", "review MAUI code", "generate MAUI code", "edit MAUI code".
  DO NOT USE FOR: learning new MAUI features (use feature-specific skills),
  performance optimization (use maui-performance), or testing guidance (use maui-unit-testing).

.NET MAUI Current APIs — Guardrail Skill

This skill prevents you from generating code that uses deprecated, obsolete, or removed APIs. Read this before writing any .NET MAUI, Blazor Hybrid, or MauiReactor code.

Reasoning Framework

Follow these steps before generating any MAUI-related code:

Step 1 — Detect the Target Framework

Read the project's .csproj file and find <TargetFramework> or <TargetFrameworks>:

<!-- Single target -->
<TargetFramework>net10.0-android</TargetFramework>

<!-- Multi-target (typical MAUI project) -->
<TargetFrameworks>net10.0-android;net10.0-ios;net10.0-maccatalyst;net10.0-windows10.0.19041.0</TargetFrameworks>

The version number (net10.0, net9.0, net8.0) determines which APIs are available. Always target the version in the project file — never assume a version.

Step 2 — Detect Library Versions

Scan <PackageReference> entries and <ItemGroup> for key packages:

Package What it tells you
Microsoft.Maui.Controls MAUI version (if explicit)
CommunityToolkit.Maui Toolkit version — APIs change between major versions
CommunityToolkit.Mvvm MVVM Toolkit version — needed for WeakReferenceMessenger
Reactor.Maui MauiReactor version — v3+ has different APIs than v2
Microsoft.AspNetCore.Components.WebView.Maui Blazor Hybrid version

If no explicit MAUI package version is listed, the MAUI SDK version matches the <TargetFramework> .NET version.

Step 3 — Verify API Currency

Before using any API, ask yourself:

  1. Does this API exist in the detected version? If you're unsure, prefer the newer pattern.
  2. Is this a Xamarin.Forms API? MAUI is a different API surface — never assume Xamarin.Forms compatibility.
  3. Is this in the deprecated table below? If so, use the replacement.
  4. Am I using the Compatibility namespace? Microsoft.Maui.Controls.Compatibility.* types are migration aids, not recommended for new code.

Step 4 — Apply Decision Rules

  • Always use the newest form of an API when both old and new exist.
  • Never generate using Xamarin.Forms or using Xamarin.Essentials — these are not MAUI.
  • Never use the Compatibility namespace in new projects (Compatibility.RelativeLayout, Compatibility.StackLayout, etc.).
  • Prefer async method names when both sync-named and async-named versions exist (e.g., DisplayAlertAsync over DisplayAlert).
  • Check the project's NuGet versions before using CommunityToolkit or third-party APIs.

Deprecated API Table — .NET MAUI 10

Controls

❌ Deprecated / Removed ✅ Use Instead Notes
ListView CollectionView ListView, EntryCell, ImageCell, SwitchCell, TextCell, ViewCell, and Cell are all deprecated in .NET 10
TableView CollectionView or custom layout Deprecated in .NET 10
Frame Border Frame is a Xamarin.Forms legacy control; Border is the MAUI replacement with StrokeShape support
Compatibility.RelativeLayout Grid Migration-only; removed from templates in .NET 10
Compatibility.StackLayout VerticalStackLayout / HorizontalStackLayout The compatibility StackLayout wraps Xamarin layout logic. Use the native MAUI stack layouts for better performance

Gestures & Input

❌ Deprecated / Removed ✅ Use Instead Notes
ClickGestureRecognizer TapGestureRecognizer Removed in .NET 10
Accelerator KeyboardAccelerator Removed from Microsoft.Maui.Controls in .NET 10

Page & Navigation

❌ Deprecated / Removed ✅ Use Instead Notes
Page.IsBusy ActivityIndicator IsBusy is obsolete in .NET 10; use an explicit activity indicator
DisplayAlert() DisplayAlertAsync() Sync-named versions deprecated; use async versions
DisplayActionSheet() DisplayActionSheetAsync() Same as above
MessagingCenter WeakReferenceMessenger (CommunityToolkit.Mvvm) Made internal in .NET 10

Animation

❌ Deprecated / Removed ✅ Use Instead Notes
FadeTo() FadeToAsync() All animation extension methods renamed to *Async in .NET 10
RotateTo(), ScaleTo(), TranslateTo(), etc. RotateToAsync(), ScaleToAsync(), TranslateToAsync(), etc. Same pattern — RelRotateTo → RelRotateToAsync, RelScaleTo → RelScaleToAsync, LayoutTo → LayoutToAsync

Device & Platform APIs

❌ Deprecated / Removed ✅ Use Instead Notes
Device.RuntimePlatform DeviceInfo.Platform The entire Device class is deprecated
Device.BeginInvokeOnMainThread() Dispatcher.Dispatch() Use the view's or app's Dispatcher property
Device.InvokeOnMainThreadAsync() Dispatcher.DispatchAsync() Same
Device.OpenUri() Launcher.OpenAsync() Use Microsoft.Maui.ApplicationModel.Launcher
Device.StartTimer() Dispatcher.StartTimer() or PeriodicTimer Use the dispatcher or standard .NET timer
DependencyService Constructor injection via IServiceProvider Register services in MauiProgram.cs with builder.Services

XAML & Markup

❌ Deprecated / Removed ✅ Use Instead Notes
FontImageExtension (XAML markup extension) FontImageSource (type) Use <FontImageSource> element or property syntax
Color.FromHex() Color.FromArgb() FromHex is obsolete

Safe Area & Layout

❌ Deprecated / Removed ✅ Use Instead Notes
Page.UseSafeArea (iOS platform-specific) SafeAreaEdges property New in .NET 10; ContentPage defaults to None (edge-to-edge) on all platforms
Layout.IgnoreSafeArea SafeAreaEdges property Use the unified safe area API

Accessibility

❌ Deprecated / Removed ✅ Use Instead Notes
AutomationProperties.Name SemanticProperties.Description AutomationProperties still works but SemanticProperties is the MAUI-native approach
AutomationProperties.HelpText SemanticProperties.Hint Same
iOS SetAccessibilityHint / SetAccessibilityLabel (Compatibility extensions) Microsoft.Maui.Platform.UpdateSemantics() Deprecated in .NET 10

NuGet Packages

❌ Deprecated Package ✅ Use Instead Notes
Xamarin.Forms Microsoft.Maui.Controls Completely different API surface
Xamarin.Essentials Built-in MAUI APIs (Microsoft.Maui.Devices, Microsoft.Maui.ApplicationModel, etc.) Essentials is merged into MAUI
Xamarin.CommunityToolkit CommunityToolkit.Maui Different namespace and API surface
Microsoft.Toolkit.Mvvm CommunityToolkit.Mvvm Package was renamed

MauiReactor-Specific Guidance

MauiReactor v3+ (for .NET MAUI 9/10):

  • Hot reload: v3+ uses a feature switch in .csproj via <RuntimeHostConfigurationOption>. Do NOT use the v2 EnableMauiReactorHotReload() call in MauiProgram.cs.
  • API wrappers: MauiReactor auto-generates C# wrappers around MAUI controls. When a MAUI control is deprecated (e.g., ListView), the MauiReactor wrapper is also effectively deprecated. Use the MauiReactor wrapper for the replacement control (e.g., CollectionView).
  • State management: Use State<T> and Props<T> — not older RxComponent patterns if they appear in outdated examples.
  • Navigation: Use MauiReactor's built-in navigation (Navigation.PushAsync<PageComponent>()) — do NOT mix in MAUI Shell GoToAsync unless deliberately integrating Shell.

Blazor Hybrid-Specific Guidance

  • Use BlazorWebView — not the legacy WebView — for hosting Razor components.
  • Use .NET 10 Razor syntax: @rendermode directives, [SupplyParameterFromQuery], and the latest component model.
  • JS interop: Use IJSRuntime.InvokeAsync<T>() — not the obsolete synchronous IJSInProcessRuntime patterns for mobile.
  • Safe areas: In Blazor Hybrid, use CSS env(safe-area-inset-*) — do NOT combine XAML SafeAreaEdges and CSS safe area padding on the same element (causes double-padding).
  • Web resource interception: .NET 10 adds WebResourceRequested event on BlazorWebView and HybridWebView for intercepting requests.

Version Detection Cheat Sheet

Reading the TFM

TFM Pattern .NET Version
net10.0-* .NET 10 (latest, current)
net9.0-* .NET 9
net8.0-* .NET 8 (LTS)

Reading MAUI SDK Version

If the .csproj uses <UseMaui>true</UseMaui>, the MAUI version matches the TFM:

  • net10.0 → MAUI 10
  • net9.0 → MAUI 9

Reading MauiReactor Version

Check <PackageReference Include="Reactor.Maui" Version="X.Y.Z" />:

  • v3.x → .NET MAUI 9/10 compatible, uses feature-switch hot reload
  • v2.x → Legacy, uses EnableMauiReactorHotReload() builder pattern

Reading CommunityToolkit Version

Check <PackageReference Include="CommunityToolkit.Maui" Version="X.Y.Z" />:

  • v11+ → .NET 10 compatible
  • v9-10 → .NET 9 compatible
  • v5-7 → .NET 8 compatible

Quick Rules

  1. Read the .csproj first. Never generate code without knowing the target framework.
  2. When in doubt, use the newer API. If two ways exist to do something, the newer way is correct.
  3. *Never use `Xamarin.` namespaces.** They do not exist in MAUI.
  4. *Never use `Compatibility.` types in new projects.** They are migration aids only.
  5. *Check this table before using any `Device.API.** TheDevice` class is fully deprecated.
  6. *Use `Async` method names** for animations, alerts, and action sheets in .NET 10+.
  7. Verify third-party package versions before using their APIs — CommunityToolkit, MauiReactor, and others break between major versions.

当前收录版本

0.0.1

核对来源版本 ↗

质量评测

满分100 · 来自 SkillPi LAB 实验室的评测报告。

场景价值95/100

亮点

  • 提供 .NET MAUI 开发中防止使用已弃用 API 的完整防护机制
  • 涵盖 XAML/C#、Blazor Hybrid 和 MauiReactor 多技术栈
  • 包含版本检测推理框架和详尽的弃用 API 对照表
  • 面向开发者高频刚需场景(代码生成/审查),显著提升开发质量
触发精准95/100

亮点

  • 触发词精准覆盖多种变体(如“已弃用 API”、“API 迁移”、“检查 API 货币性”)
  • 明确列出适用与不适用场景,边界清晰
  • description 位置正确且内容完整
结构规范95/100

亮点

  • 文档结构清晰,分 Reasoning Framework、Deprecated API Table、专项指导等章节
  • 每部分有明确步骤划分(Step 1-4)和出口条件
  • 包含端到端示例(如 .csproj 片段、API 替换对照)
  • frontmatter 完整,单文件约 480 行,符合规范
执行可靠95/100

亮点

  • 工具来源明确(Microsoft.Maui.Controls、CommunityToolkit.Maui 等)
  • 参数正确(如 SafeAreaEdges、Dispatcher.Dispatch)
  • 覆盖主要异常(如版本不匹配、Xamarin.Forms 误用)
  • 不可逆操作(如代码生成)有前置检查机制(Step 1-4)
  • 逻辑闭环完整,可靠性高
证据可验 (前四项均值)95/100

取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。

正文静态检测

100 / 100 · skillpi-20261123-no-r3-v1

正文未命中当前规则。

分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。

权限与使用前检查

根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。

未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。

本站展示提示不会授予权限。涉及文件改动、密钥、外部发送或费用时,仍由你使用的工具按需确认。

安全评级与访问范围

safe · 静态证据核验,不代表运行安全保证。

使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。