winmd-api-search

作者: github

搜尋並探索 Windows 桌面 API,包含完整的型別簽章與成員。索引 Windows Platform SDK、WinAppSDK、NuGet 套件以及專案輸出的 WinMD 檔案;Platform SDK 與 WinAppSDK 在全新複製後即可立即使用,無需還原或建置。兩種工作流程:探索模式可透過功能關鍵字尋找合適的 API,查閱模式則可擷取已知型別的確切方法、屬性、事件與列舉值。需要 .NET SDK 8.0 以上版本,並需一次性快取產生...

npx skills add https://github.com/github/awesome-copilot --skill winmd-api-search

WinMD API Search

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 Platform SDK — all Windows.* WinRT APIs (always available, no restore needed)
  • WinAppSDK / WinUI — bundled as a baseline in the cache generator (always available, no restore needed)
  • NuGet packages — any additional packages in restored projects that contain .winmd files
  • Project-output WinMD — class libraries (C++/WinRT, C#) that produce .winmd as build output

Even on a fresh clone with no restore or build, you still get full Platform SDK + WinAppSDK coverage.

When to Use This Skill

  • User wants to build a feature and you need to find which API provides that capability
  • User asks "how do I do X?" where X involves a platform feature (camera, files, notifications, sensors, AI, etc.)
  • You need the exact methods, properties, events, or enumeration values of a type before writing code
  • You're unsure which control, class, or interface to use for a UI or system task

Prerequisites

  • .NET SDK 8.0 or later — required to build the cache generator. Install from dotnet.microsoft.com if not available.

Cache Setup (Required Before First Use)

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.

What gets indexed

SourceWhen available
Windows Platform SDKAlways (reads from local SDK install)
WinAppSDK (latest)Always (bundled as baseline in cache generator)
WinAppSDK RuntimeWhen installed on the system (detected via Get-AppxPackage)
Project NuGet packagesAfter dotnet restore or with packages.config
Project-output .winmdAfter project build (class libraries that produce WinMD)

Note: This cache directory should be in .gitignore — it's generated, not source.

How to Use

Pick the path that matches the situation:


Discover — "I don't know which API to use"

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 saysSearch 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, Vision, Recognition
"show a popup"dialog, flyout, popup, ContentDialog
"drag and drop"drag, drop, DragDrop
"save settings"settings, ApplicationData, LocalSettings

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:

  1. Use web search to find the right API on Microsoft Learn, for example:
    • site:learn.microsoft.com/uwp/api <capability keywords> for Windows.* APIs
    • site:learn.microsoft.com/windows/windows-app-sdk/api/winrt <capability keywords> for Microsoft.* WinAppSDK APIs
  2. Read the documentation pages to identify which type matches the user's requirement.
  3. Once you know the type name, come back and use -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 prefixDocumentation 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


Lookup — "I know the API, show me the details"

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.


Other Commands

# 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, -Project is auto-selected. If multiple projects exist, add -Project <name> (use -Action projects to 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.

Search Scoring

The search ranks type names and member names against your query:

ScoreMatch typeExample
100Exact nameButtonButton
80Starts withNavigationNavigationView
60ContainsDialogContentDialog
50PascalCase initialsASBAutoSuggestBox
40Multi-keyword ANDnavigation itemNavigationViewItem
20Fuzzy character matchNavVwNavigationView

Results are grouped by namespace. Higher-scored namespaces appear first.

Troubleshooting

IssueFix
"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 updateRe-run Update-WinMdCache.ps1
Cache in git historyAdd Generated Files/ to .gitignore

References

來自 github 的更多技能

console-rendering
github
在 Go 中使用基於結構體標籤的控制台渲染系統的說明
official
acquire-codebase-knowledge
github
當使用者明確要求對現有程式碼庫進行映射、文件化或入門引導時,使用此技能。觸發詞如「映射此程式碼庫」、「文件化…」等提示。
official
acreadiness-assess
github
Run the AgentRC readiness assessment on the current repository and produce a static HTML dashboard at reports/index.html. Wraps `npx github:microsoft/agentrc…
official
acreadiness-generate-instructions
github
透過 AgentRC 指令命令生成量身打造的 AI 代理指令檔案。產生 .github/copilot-instructions.md(預設,建議用於 VS Code 中的 Copilot…
official
acreadiness-policy
github
幫助使用者選取、撰寫或套用 AgentRC 政策。政策可透過停用不相關的檢查、覆寫影響/等級、設定…來自訂整備度評分。
official
add-educational-comments
github
為程式碼檔案添加教育性註解,將其轉化為有效的學習資源。根據三個可設定的知識層級(初學者、中級、進階)調整解釋深度與語氣。若未提供檔案,會自動請求提供,並以編號清單對應以便快速選取。僅透過教育性註解將檔案擴充最多125%(嚴格上限:400行新註解;超過1,000行的檔案上限為300行)。保留檔案編碼、縮排風格、語法正確性及……
official
adobe-illustrator-scripting
github
使用 ExtendScript (JavaScript/JSX) 編寫、除錯及最佳化 Adobe Illustrator 自動化腳本。適用於建立或修改操控…的腳本時。
official
agent-governance
github
宣告式政策、意圖分類與稽核軌跡,用於控制AI代理工具存取與行為。可組合的治理政策定義允許/封鎖的工具、內容過濾器、速率限制與核准要求——以配置而非程式碼形式儲存。語意意圖分類在工具執行前,透過基於模式的訊號偵測危險提示(資料外洩、權限提升、提示注入)。工具層級治理裝飾器在函式層級強制執行政策……
official