跳到正文
Skillpedia
通用编程40k · #7290

microsoft-code-reference

它能做什么

这个工具可以帮你查找 Azure SDK 和 .NET 类库等微软技术的相关资料与代码示例。它会检查你想用的命令或函数是否存在、写法是否正确,并给出使用示例。

适用场景

  • ✓当你不确定某个命令或函数是否存在时。
  • ✓当你想找一个微软工具的代码示例时。
  • ✓当你想确认代码使用的是正确且最新的命令时。

技能链接

https://github.com/github/awesome-copilot/blob/main/skills/microsoft-code-reference/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/github/awesome-copilot/blob/main/skills/microsoft-code-reference/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“帮我找一个用 Python 把文件上传到 Azure Blob Storage 的示例。”

每周 5 个新技能,1 分钟读完。

工作原理

你可以让它搜索某个具体方法,比如“BlobClient UploadAsync Azure.Storage.Blobs”,也可以让它查找某个任务的代码示例,比如“用 JavaScript 发送 Service Bus 消息”。该工具会参考微软官方文档,确保信息准确。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Microsoft Code Reference

Tools

Need Tool Example
API method/class lookup microsoft_docs_search "BlobClient UploadAsync Azure.Storage.Blobs"
Working code sample microsoft_code_sample_search query: "upload blob managed identity", language: "python"
Full API reference microsoft_docs_fetch Fetch URL from microsoft_docs_search (for overloads, full signatures)

Finding Code Samples

Use microsoft_code_sample_search to get official, working examples:

microsoft_code_sample_search(query: "upload file to blob storage", language: "csharp")
microsoft_code_sample_search(query: "authenticate with managed identity", language: "python")
microsoft_code_sample_search(query: "send message service bus", language: "javascript")

When to use:

  • Before writing code—find a working pattern to follow
  • After errors—compare your code against a known-good sample
  • Unsure of initialization/setup—samples show complete context

API Lookups

# Verify method exists (include namespace for precision)
"BlobClient UploadAsync Azure.Storage.Blobs"
"GraphServiceClient Users Microsoft.Graph"

# Find class/interface
"DefaultAzureCredential class Azure.Identity"

# Find correct package
"Azure Blob Storage NuGet package"
"azure-storage-blob pip package"

Fetch full page when method has multiple overloads or you need complete parameter details.

Error Troubleshooting

Use microsoft_code_sample_search to find working code samples and compare with your implementation. For specific errors, use microsoft_docs_search and microsoft_docs_fetch:

Error Type Query
Method not found "[ClassName] methods [Namespace]"
Type not found "[TypeName] NuGet package namespace"
Wrong signature "[ClassName] [MethodName] overloads" → fetch full page
Deprecated warning "[OldType] migration v12"
Auth failure "DefaultAzureCredential troubleshooting"
403 Forbidden "[ServiceName] RBAC permissions"

When to Verify

Always verify when:

  • Method name seems "too convenient" (UploadFile vs actual Upload)
  • Mixing SDK versions (v11 CloudBlobClient vs v12 BlobServiceClient)
  • Package name doesn't follow conventions (Azure.* for .NET, azure-* for Python)
  • Using an API for the first time

Validation Workflow

Before generating code using Microsoft SDKs, verify it's correct:

  1. Confirm method or package exists — microsoft_docs_search(query: "[ClassName] [MethodName] [Namespace]")
  2. Fetch full details (for overloads/complex params) — microsoft_docs_fetch(url: "...")
  3. Find working sample — microsoft_code_sample_search(query: "[task]", language: "[lang]")

For simple lookups, step 1 alone may suffice. For complex API usage, complete all three steps.

CLI Alternative

If the Learn MCP server is not available, use the mslearn CLI from a terminal or shell (for example, Bash, PowerShell, or cmd) instead:

# Run directly (no install needed)
npx @microsoft/learn-cli search "BlobClient UploadAsync Azure.Storage.Blobs"

# Or install globally, then run
npm install -g @microsoft/learn-cli
mslearn search "BlobClient UploadAsync Azure.Storage.Blobs"
MCP Tool CLI Command
microsoft_docs_search(query: "...") mslearn search "..."
microsoft_code_sample_search(query: "...", language: "...") mslearn code-search "..." --language ...
microsoft_docs_fetch(url: "...") mslearn fetch "..."

Pass --json to search or code-search to get raw JSON output for further processing.

常见问题

什么是“API”和“SDK”?

API(应用程序编程接口)就像一份菜单,让不同的程序之间可以互相通信。SDK(软件开发工具包)则是一套工具和说明,帮助开发者基于这些 API 构建应用。

“验证代码是否正确”是什么意思?

这意味着确保你写的命令确实存在,拼写和参数用法都正确,并且不是已经被新版本取代的旧版本。

这里说的“幻觉”是什么意思?

在 AI 领域,“幻觉”指的是 AI 编造出不真实的信息。这个工具可以帮助避免 AI 给出不存在或写错的命令和代码示例。

详情

作者的原始描述

Look up Microsoft API references, find working code samples, and verify SDK code is correct. Use when working with Azure SDKs, .NET libraries, or Microsoft APIs—to find the right method, check parameters, get working examples, or troubleshoot errors. Catches hallucinated methods, wrong signatures, and deprecated patterns by querying official docs.

repo: github/awesome-copilot

热度

GitHub 星标
40k
排名
#7290
许可证
MIT
更新时间
2026/10/15

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能