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

Microsoft Code Reference

Microsoft LearnOfficialPublished by Microsoft Learn

  • Skill
  • Tool integration
  • Software development
  • CC-BY-4.0
  • Low risk

From the author

Find working code samples, verify API signatures, and fix Microsoft SDK errors using official docs. Use whenever the user is writing, debugging, or reviewing code that touches any Microsoft SDK, .NET library, Azure client library, or Microsoft API—even if they don't ask for a "reference." Catches hallucinated methods, wrong signatures, and deprecated patterns. If the task involves producing or fixing Microsoft-related code, this is the right skill.
— the description by Microsoft Learn

AutoGineer summary

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

The Microsoft Code Reference skill provides a structured approach to interacting with Microsoft SDKs, .NET libraries, and Azure APIs. By leveraging official documentation and verified code samples, it helps developers avoid common pitfalls such as hallucinated methods, incorrect API signatures, and the use of deprecated patterns. The skill acts as a bridge between the developer's code and official Microsoft resources, ensuring that implementations are accurate, modern, and follow established best practices.

What it does

  • Searches official Microsoft documentation for API methods, classes, and namespaces.
  • Retrieves verified, working code samples for various programming languages.
  • Validates API signatures and parameter details to prevent runtime errors.
  • Identifies deprecated patterns and suggests migration paths.
  • Troubleshoots common SDK errors, including authentication and permission issues.
  • Provides a fallback CLI interface for environments where the MCP server is unavailable.

When to use it

  • When writing code that utilizes any Microsoft SDK or Azure client library.
  • When debugging errors related to method signatures or missing types.
  • When you are unsure about the correct initialization or setup of a Microsoft service.
  • When migrating between different versions of a Microsoft library.
  • When you suspect a method name might be hallucinated or incorrect.

Advantages

  • Reduces development time by providing immediate access to official, working code examples.
  • Increases code reliability by verifying signatures against official documentation.
  • Helps maintain modern codebases by flagging deprecated patterns.
  • Provides a consistent workflow for troubleshooting complex API integrations.

Usage examples

“How do I upload a file to Azure Blob Storage using Python?”
The agent searches for official Python code samples for blob uploads, ensuring the use of current SDK methods rather than deprecated ones.
“I am getting a method not found error for BlobClient.UploadAsync in C#.”
The agent verifies the correct namespace and signature for the method in the current SDK version and suggests the appropriate implementation.

Install

  1. Download the skill as a ZIP:

    https://autogineer.com/agent-skills/microsoftdocs/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 Microsoft Learn

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 the command line 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: Claude Code

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: Claude Code frontmatter, Needs an MCP server, Needs Python, Needs Node.js

The author says: Primarily uses the Microsoft Learn MCP Server (https://learn.microsoft.com/api/mcp); if that is unavailable, fall back to the mslearn CLI (`npx @microsoft/learn-cli`).

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

Published by
Microsoft Learn
Publisher
Microsoft Learn (Official)
Source
MicrosoftDocs/mcp · skills/microsoft-code-reference · commit f0a9478
Licence
Creative Commons Attribution 4.0 International (redistribution allowed)
  • LICENSE (added by AutoGineer from LICENSE)
  • ATTRIBUTION.md (written by AutoGineer)
Synced

AutoGineer is not affiliated with or endorsed by Microsoft Learn or Microsoft Learn.

Download ZIP

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