winmd-api-search by github/awesome-copilot
npx skills add https://github.com/github/awesome-copilot --skill winmd-api-search此技能可帮助您为任何功能找到合适的 Windows API 并获取其完整详细信息。它从以下来源搜索所有 WinMD 元数据的本地缓存:
Windows.* WinRT API(始终可用,无需还原).winmd 文件的任何附加包.winmd 作为构建输出的类库(C++/WinRT, C#)即使是在没有还原或构建的全新克隆中,您仍然可以获得完整的平台 SDK + WinAppSDK 覆盖。
所有查询和搜索命令都从本地 JSON 缓存读取。在运行任何查询之前,您必须生成缓存。
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
# 仓库中的所有项目(首次运行推荐)
.\.github\skills\winmd-api-search\scripts\Update-WinMdCache.ps1
# 单个项目
.\.github\skills\winmd-api-search\scripts\Update-WinMdCache.ps1 -ProjectDir <project-folder>
基线覆盖(平台 SDK + WinAppSDK)不需要项目还原或构建。对于附加的 NuGet 包,项目需要 dotnet restore(这会生成 project.assets.json)或 packages.config 文件。
缓存存储在 Generated Files\winmd-cache\ 中,按包+版本去重。
| 来源 | 何时可用 |
|---|---|
| Windows 平台 SDK | 始终(从本地 SDK 安装读取) |
| WinAppSDK(最新) | 始终(作为基线捆绑在缓存生成器中) |
| WinAppSDK 运行时 | 当安装在系统上时(通过 Get-AppxPackage 检测) |
| 项目 NuGet 包 | 在 dotnet restore 之后或存在 packages.config 时 |
项目输出 .winmd | 项目构建之后(产生 WinMD 的类库) |
注意: 此缓存目录应位于
.gitignore中 — 它是生成的,不是源代码。
选择符合情况的路径:
用户用自己的话描述一个功能。您需要找到正确的 API。
0. 确保缓存存在
如果缓存尚未生成,请先运行 Update-WinMdCache.ps1 — 请参阅上面的缓存设置。
1. 将用户语言 → 搜索关键词
将用户的日常语言映射到编程术语。尝试多种变体:
| 用户说 | 尝试的搜索关键词(按顺序) |
|---|---|
| “拍照” | camera, capture, photo, MediaCapture |
| “从磁盘加载” | file open, picker, FileOpen, StorageFile |
| “描述其中的内容” | image description, Vision, Recognition |
| “显示弹窗” | dialog, flyout, popup, ContentDialog |
| “拖放” | drag, drop, DragDrop |
| “保存设置” | settings, ApplicationData, LocalSettings |
从简单的日常词汇开始。如果结果较弱或不相关,请尝试更技术性的变体。
2. 运行搜索
.\.github\skills\winmd-api-search\scripts\Invoke-WinMdQuery.ps1 -Action search -Query "<keyword>"
这将返回按排名排序的命名空间,其中包含最匹配的类型以及 JSON 文件路径。
如果结果 分数较低(低于 60)或不相关,则回退到搜索在线文档:
site:learn.microsoft.com/uwp/api <功能关键词> 用于 Windows.* APIsite:learn.microsoft.com/windows/windows-app-sdk/api/winrt <功能关键词> 用于 Microsoft.* WinAppSDK API-Action members 或 -Action enums 获取精确的本地签名。3. 阅读 JSON 以选择正确的 API
从顶部结果的路径读取文件。JSON 包含该命名空间中的所有类型 — 完整的成员、签名、参数、返回类型、枚举值。
阅读并决定哪些类型和成员符合用户的要求。
4. 查阅官方文档以获取上下文
缓存仅包含签名 — 没有描述或使用指南。对于解释、示例和备注,请在 Microsoft Learn 上查找该类型:
| 命名空间前缀 | 文档基础 URL |
|---|---|
Windows.* | https://learn.microsoft.com/uwp/api/{fully.qualified.typename} |
Microsoft.* (WinAppSDK) | https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/{fully.qualified.typename} |
例如,Microsoft.UI.Xaml.Controls.NavigationView 映射到:https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.controls.navigationview
5. 使用 API 知识来回答或编写代码
您已经知道(或怀疑)类型或命名空间名称。直接使用:
# 获取已知类型的所有成员
.\.github\skills\winmd-api-search\scripts\Invoke-WinMdQuery.ps1 -Action members -TypeName "Microsoft.UI.Xaml.Controls.NavigationView"
# 获取枚举值
.\.github\skills\winmd-api-search\scripts\Invoke-WinMdQuery.ps1 -Action enums -TypeName "Microsoft.UI.Xaml.Visibility"
# 列出命名空间中的所有类型
.\.github\skills\winmd-api-search\scripts\Invoke-WinMdQuery.ps1 -Action types -Namespace "Microsoft.UI.Xaml.Controls"
# 浏览命名空间
.\.github\skills\winmd-api-search\scripts\Invoke-WinMdQuery.ps1 -Action namespaces -Filter "Microsoft.UI"
如果您需要比 -Action members 显示的更完整的详细信息,请使用 -Action search 获取 JSON 文件路径,然后直接读取 JSON 文件。
# 列出缓存的项
.\.github\skills\winmd-api-search\scripts\Invoke-WinMdQuery.ps1 -Action projects
# 列出项目的包
.\.github\skills\winmd-api-search\scripts\Invoke-WinMdQuery.ps1 -Action packages
# 显示统计信息
.\.github\skills\winmd-api-search\scripts\Invoke-WinMdQuery.ps1 -Action stats
如果只缓存了一个项目,
-Project会自动选择。如果存在多个项目,请添加-Project <name>(使用-Action projects查看可用名称)。在扫描模式下,清单名称包含一个短哈希后缀以避免冲突;如果无歧义,您可以传递不带后缀的基础项目名称。
搜索根据您的查询对类型名称和成员名称进行排名:
| 分数 | 匹配类型 | 示例 |
|---|---|---|
| 100 | 精确名称 | Button → Button |
| 80 | 以...开头 | Navigation → NavigationView |
| 60 | 包含 | Dialog → ContentDialog |
| 50 | PascalCase 首字母 | ASB → AutoSuggestBox |
| 40 | 多关键词 AND | navigation item → NavigationViewItem |
| 20 | 模糊字符匹配 | NavVw → NavigationView |
结果按命名空间分组。分数较高的命名空间显示在前面。
| 问题 | 解决方法 |
|---|---|
| “未找到缓存” | 运行 Update-WinMdCache.ps1 |
| “缓存了多个项目” | 添加 -Project <name> |
| “未找到命名空间” | 使用 -Action namespaces 列出可用的命名空间 |
| “未找到类型” | 使用完全限定名称(例如,Microsoft.UI.Xaml.Controls.Button) |
| NuGet 更新后过时 | 重新运行 Update-WinMdCache.ps1 |
| 缓存出现在 git 历史记录中 | 将 Generated Files/ 添加到 .gitignore |
Windows.* 命名空间的文档Microsoft.* WinAppSDK 命名空间的文档每周安装量
4.3K
仓库
GitHub 星标数
26.7K
首次出现
2026年3月3日
安全审计
安装于
codex4.3K
gemini-cli4.3K
opencode4.2K
cursor4.2K
github-copilot4.2K
kimi-cli4.2K
This skill helps you find the right Windows API for any capability and get its full details. It searches a local cache of all WinMD metadata from:
Windows.* WinRT APIs (always available, no restore needed).winmd files.winmd as build outputEven on a fresh clone with no restore or build, you still get full Platform SDK + WinAppSDK coverage.
All query and search commands read from a local JSON cache. You must generate the cache before running any queries.
# All projects in the repo (recommended for first run)
.\.github\skills\winmd-api-search\scripts\Update-WinMdCache.ps1
# Single project
.\.github\skills\winmd-api-search\scripts\Update-WinMdCache.ps1 -ProjectDir <project-folder>
No project restore or build is needed for baseline coverage (Platform SDK + WinAppSDK). For additional NuGet packages, the project needs dotnet restore (which generates project.assets.json) or a packages.config file.
Cache is stored at Generated Files\winmd-cache\, deduplicated per-package+version.
| Source | When available |
|---|---|
| Windows Platform SDK | Always (reads from local SDK install) |
| WinAppSDK (latest) | Always (bundled as baseline in cache generator) |
| WinAppSDK Runtime | When installed on the system (detected via Get-AppxPackage) |
| Project NuGet packages | After dotnet restore or with packages.config |
Project-output .winmd | After project build (class libraries that produce WinMD) |
Note: This cache directory should be in
.gitignore— it's generated, not source.
Pick the path that matches the situation:
The user describes a capability in their own words. You need to find the right API.
0. Ensure the cache exists
If the cache hasn't been generated yet, run Update-WinMdCache.ps1 first — see Cache Setup above.
1. Translate user language → search keywords
Map the user's daily language to programming terms. Try multiple variations:
| User says | Search keywords to try (in order) |
|---|---|
| "take a picture" | camera, capture, photo, MediaCapture |
| "load from disk" | file open, picker, FileOpen, StorageFile |
| "describe what's in it" | image description, , |
Start with simple everyday words. If results are weak or irrelevant, try the more technical variation.
2. Run searches
.\.github\skills\winmd-api-search\scripts\Invoke-WinMdQuery.ps1 -Action search -Query "<keyword>"
This returns ranked namespaces with top matching types and the JSON file path.
If results have low scores (below 60) or are irrelevant , fall back to searching online documentation:
site:learn.microsoft.com/uwp/api <capability keywords> for Windows.* APIssite:learn.microsoft.com/windows/windows-app-sdk/api/winrt <capability keywords> for Microsoft.* WinAppSDK APIs-Action members or -Action enums to get the exact local signatures.3. Read the JSON to choose the right API
Read the file at the path(s) from the top results. The JSON has all types in that namespace — full members, signatures, parameters, return types, enumeration values.
Read and decide which types and members fit the user's requirement.
4. Look up official documentation for context
The cache contains only signatures — no descriptions or usage guidance. For explanations, examples, and remarks, look up the type on Microsoft Learn:
| Namespace prefix | Documentation base URL |
|---|---|
Windows.* | https://learn.microsoft.com/uwp/api/{fully.qualified.typename} |
Microsoft.* (WinAppSDK) | https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/{fully.qualified.typename} |
For example, Microsoft.UI.Xaml.Controls.NavigationView maps to: https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.controls.navigationview
5. Use the API knowledge to answer or write code
You already know (or suspect) the type or namespace name. Go direct:
# Get all members of a known type
.\.github\skills\winmd-api-search\scripts\Invoke-WinMdQuery.ps1 -Action members -TypeName "Microsoft.UI.Xaml.Controls.NavigationView"
# Get enum values
.\.github\skills\winmd-api-search\scripts\Invoke-WinMdQuery.ps1 -Action enums -TypeName "Microsoft.UI.Xaml.Visibility"
# List all types in a namespace
.\.github\skills\winmd-api-search\scripts\Invoke-WinMdQuery.ps1 -Action types -Namespace "Microsoft.UI.Xaml.Controls"
# Browse namespaces
.\.github\skills\winmd-api-search\scripts\Invoke-WinMdQuery.ps1 -Action namespaces -Filter "Microsoft.UI"
If you need full detail beyond what -Action members shows, use -Action search to get the JSON file path, then read the JSON file directly.
# List cached projects
.\.github\skills\winmd-api-search\scripts\Invoke-WinMdQuery.ps1 -Action projects
# List packages for a project
.\.github\skills\winmd-api-search\scripts\Invoke-WinMdQuery.ps1 -Action packages
# Show stats
.\.github\skills\winmd-api-search\scripts\Invoke-WinMdQuery.ps1 -Action stats
If only one project is cached,
-Projectis auto-selected. If multiple projects exist, add-Project <name>(use-Action projectsto see available names). In scan mode, manifest names include a short hash suffix to avoid collisions; you can pass the base project name without the suffix if it's unambiguous.
The search ranks type names and member names against your query:
| Score | Match type | Example |
|---|---|---|
| 100 | Exact name | Button → Button |
| 80 | Starts with | Navigation → NavigationView |
| 60 | Contains | Dialog → ContentDialog |
| 50 | PascalCase initials | → |
Results are grouped by namespace. Higher-scored namespaces appear first.
| Issue | Fix |
|---|---|
| "Cache not found" | Run Update-WinMdCache.ps1 |
| "Multiple projects cached" | Add -Project <name> |
| "Namespace not found" | Use -Action namespaces to list available ones |
| "Type not found" | Use fully qualified name (e.g., Microsoft.UI.Xaml.Controls.Button) |
| Stale after NuGet update | Re-run Update-WinMdCache.ps1 |
| Cache in git history | Add Generated Files/ to |
Windows.* namespacesMicrosoft.* WinAppSDK namespacesWeekly Installs
4.3K
Repository
GitHub Stars
26.7K
First Seen
Mar 3, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykWarn
Installed on
codex4.3K
gemini-cli4.3K
opencode4.2K
cursor4.2K
github-copilot4.2K
kimi-cli4.2K
97,600 周安装
VisionRecognition| "show a popup" | dialog, flyout, popup, ContentDialog |
| "drag and drop" | drag, drop, DragDrop |
| "save settings" | settings, ApplicationData, LocalSettings |
ASBAutoSuggestBox| 40 | Multi-keyword AND | navigation item → NavigationViewItem |
| 20 | Fuzzy character match | NavVw → NavigationView |
.gitignore