Generated banner for Microsoft Code Reference
Generated logo for Microsoft Code Reference

Microsoft Code Reference

GitHubOfficialFirst committed by TianqiZhangDistributed by GitHub

  • Skill
  • Tool integration
  • Software development
  • MIT
  • Low risk

From the author

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.
— the description by TianqiZhang

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

The Microsoft Code Reference skill provides a structured way to interact with official Microsoft documentation and code repositories. It helps developers avoid common pitfalls like hallucinated methods, deprecated patterns, or incorrect SDK signatures by querying official sources directly. By integrating with Microsoft Learn resources, it ensures that code generation and troubleshooting are grounded in accurate, up-to-date API specifications and working examples.

What it does

  • Searches official Microsoft API documentation for methods, classes, and namespaces.
  • Retrieves verified, working code samples for various programming languages.
  • Fetches full API reference pages to clarify complex method overloads and parameter requirements.
  • Assists in troubleshooting SDK-related errors and authentication issues.
  • Provides a validation workflow to confirm API existence before implementation.
  • Offers a CLI fallback for environments where the MCP server is unavailable.

When to use it

  • When you are unsure about the correct method name or signature for a Microsoft SDK.
  • Before writing code to ensure you are following current best practices and patterns.
  • When you encounter errors and need to compare your implementation against a known-good sample.
  • When working with multiple SDK versions to avoid mixing deprecated and modern patterns.
  • When you need to verify if a specific package or class exists in the Microsoft ecosystem.

Advantages

  • Reduces hallucinations by grounding code generation in official documentation.
  • Ensures usage of current, non-deprecated API patterns.
  • Provides context-rich examples for complex tasks like authentication or service integration.
  • Streamlines the debugging process by linking errors to official troubleshooting guides.

Usage examples

“Find a Python code sample for uploading a file to Azure Blob Storage using managed identity.”
The agent queries the Microsoft code sample database and returns a verified snippet demonstrating the correct BlobClient initialization and upload pattern.
“Verify if the method UploadAsync exists for BlobClient in the Azure.Storage.Blobs namespace.”
The agent performs an API lookup to confirm the method's existence and provides the correct signature details.

Install

  1. Download the skill as a ZIP:

    https://mp-staging.autogineer.com/agent-skills/github/microsoft-code-reference/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip microsoft-code-reference.zip -d .agents/skills

Documentation by TianqiZhang

Microsoft Code Reference

Tools

NeedToolExample
API method/class lookupmicrosoft_docs_search"BlobClient UploadAsync Azure.Storage.Blobs"
Working code samplemicrosoft_code_sample_searchquery: "upload blob managed identity", language: "python"
Full API referencemicrosoft_docs_fetchFetch 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 TypeQuery
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 ToolCLI 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.

Files

Requirements and compatibility

Written for: GitHub Copilot

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta

“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.

Needs: Needs an MCP server, Needs Python, Needs Node.js

The author says: Works best with Microsoft Learn MCP Server (https://learn.microsoft.com/api/mcp). Can also use the mslearn CLI as a fallback.

Security

What our scanner noticed· Low risk

  • Instructions that use the network

A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.

Attribution and licence

First committed by
GitHub avatar of TianqiZhangTianqiZhang
Publisher
GitHub (Official)
Distributed by
GitHub
Source
github/awesome-copilot · skills/microsoft-code-reference · commit 797337f
Licence
MIT License (redistribution allowed)
  • LICENSE (added by AutoGineer from LICENSE)
  • ATTRIBUTION.md (written by AutoGineer)
Synced
Contributors
TianqiZhang

AutoGineer is not affiliated with or endorsed by TianqiZhang or GitHub.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download microsoft-code-reference.zip