Official agent skill

Microsoft Code Reference

by MicrosoftDocs in MicrosoftDocs/mcp

Find working code samples, verify API signatures, and fix Microsoft SDK errors using official docs.

OfficialCC-BY-4.0Auto-check passedDevelopment

Install Microsoft Code Reference

skills CLI
$ npx skills add MicrosoftDocs/mcp --skill microsoft-code-reference -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install MicrosoftDocs/mcp microsoft-code-reference --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/MicrosoftDocs/mcp.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/microsoft-code-reference .claude/skills/microsoft-code-reference && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
microsoft-code-reference
GitHub stars
1.9k
Used in
4 other repos
Token cost
~1.1k tokens
SKILL.md length
289 words
Files
1
Repo updated
First seen
Licence
CC-BY-4.0

At a glance

Find working code samples, verify API signatures, and fix Microsoft SDK errors using official docs.

  • Works in 3 steps: Confirm method or package exists —… → Fetch full details (for… → Find working sample —…
  • The user is writing
  • SKILL.md covers Tools, Finding Code Samples, API Lookups and Error Troubleshooting, plus 3 more sections
  • Calls npx and npm

What it does

Microsoft Code Reference is an agent skill from MicrosoftDocs/mcp, published by the product's own GitHub organization. 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.

Its SKILL.md is about 1.1k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts. Compatibility notes: Primarily uses the Microsoft Learn MCP Server (https://learn.microsoft.com/api/mcp); if that is unavailable, fall back to the mslearn CLI (npx…

It sits in Development. It works with Microsoft Azure and .NET. The repository describes itself as: Official Microsoft Learn MCP Server and CLI tool – powering LLMs and AI agents with real-time, trusted Microsoft docs & code samples. The licence is CC-BY-4.0.

When your agent uses it

  • The user is writing
  • Reviewing code that touches any Microsoft SDK
  • Azure client library
  • Microsoft API—even if they dont ask for a reference. Catches hallucinated methods

Example prompts

  • “t ask for a”
  • “/microsoft-code-reference”

Requirements

  • Node.js
  • Compatibility (from SKILL.md): 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`).

Workflow steps

3 steps, taken from the first numbered list in SKILL.md.

  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]")

What it can do on your machine

Read from SKILL.md and the folder at commit f8ffde1. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • npx
    • npm

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use npx and npm, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

  • Compatibility

    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`).

    From compatibility in the SKILL.md frontmatter.

Context cost

Microsoft Code Reference loads about 1.1k tokens when it runs. Until then it costs about 119 tokens; SKILL.md has 289 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~119
When it runs · the whole SKILL.md, loaded when a task matches
~1.1k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from MicrosoftDocs/mcp at commit f8ffde1, republished under its CC-BY-4.0 licence (© MicrosoftDocs). 289 words, ~1,076 tokens.

Download SKILL.mdSave it as .claude/skills/microsoft-code-reference/SKILL.md (or your agent's skills folder).
name
microsoft-code-reference
description
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.
compatibility
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`).
context
fork

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:

sh
# 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.

© MicrosoftDocs, CC-BY-4.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in skills/microsoft-code-reference of MicrosoftDocs/mcp.

Open the folder on GitHubat commit f8ffde1

Used in 4 other repositories

We found 9 copies of this SKILL.md (exact, near-identical or edited) in other folders, from 4 other GitHub owners. This page covers the copy in MicrosoftDocs/mcp, which our catalogue first saw on October 7, 2026.

Compare with similar skills

Microsoft Code Reference next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Microsoft Code Reference compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Microsoft Code Reference this skillMicrosoftDocs/mcp1.9k4 repos~1.1kAutomated safety check: PassCC-BY-4.0
Microsoft Foundry ToolsMicrosoftDocs/Agent-Skills777—~2.4kAutomated safety check: PassCC-BY-4.0
Microsoft Code ReferenceKilo-Org/kilo-marketplace189—~1.2kAutomated safety check: PassCustom licence
Azure Event HubsKilo-Org/kilo-marketplace189—~3.7kAutomated safety check: PassCustom licence
Aspiremicrosoft/aspire.dev1964 repos~1.1kAutomated safety check: PassMIT
Azure Identity Dotnetsickn33/agentic-awesome-skills47k—~2.5kAutomated safety check: PassMIT

Similar skills

  • Microsoft Foundry Tools

    MicrosoftDocs/Agent-Skills

    Official

    Expert knowledge for Microsoft Foundry Tools (aka Azure AI services, Azure Cognitive Services) development including troubleshooting, best practices, decision making, architecture & design patterns…

    777 GitHub stars~2.4k tokensUpdated yesterday
    DevelopmentAuto-check passed
  • Microsoft Code Reference

    Kilo-Org/kilo-marketplace

    Find working code samples, verify API signatures, and fix Microsoft SDK errors using official docs.

    189 GitHub stars~1.2k tokensUpdated 8 days ago
    DevelopmentAuto-check passed
  • Azure Event Hubs

    Kilo-Org/kilo-marketplace

    Expert knowledge for Azure Event Hubs development including troubleshooting, best practices, decision making, architecture & design patterns, limits & quotas, security, configuration, integrations &…

    189 GitHub stars~3.7k tokensUpdated 8 days ago
    DevelopmentAuto-check passed
  • Aspire

    microsoft/aspire.dev

    Official

    Orchestrates Aspire distributed applications using the Aspire CLI for running, debugging, and managing distributed apps.

    196 GitHub starsUsed in 4 repos~1.1k tokens
    DevOps & CloudAuto-check passed
  • Azure Identity Dotnet

    sickn33/agentic-awesome-skills

    Azure Identity SDK for .NET. An agent skill from sickn33/agentic-awesome-skills.

    47k GitHub stars~2.5k tokensUpdated today
    DevOps & CloudAuto-check passed
  • Azure Identity Dotnet

    microsoft/skills

    Official

    Azure Identity library for .NET. An agent skill from microsoft/skills.

    3.1k GitHub stars~2.5k tokensUpdated today
    DevOps & CloudAuto-check passed

More from MicrosoftDocs/mcp

  • Microsoft Skill Creator

    MicrosoftDocs/mcp

    Official

    Create agent skills for Microsoft technologies using official documentation.

    1.9k GitHub starsUsed in 3 repos~2.1k tokens
    Auto-check passed
  • Microsoft Docs

    MicrosoftDocs/mcp

    Official

    Understand Microsoft technologies by querying official documentation.

    1.9k GitHub starsUsed in 1 repo~723 tokens
    Auto-check passed
  • Microsoft Learn CLI

    MicrosoftDocs/mcp

    Official

    Use the Microsoft Learn CLI to retrieve current official Microsoft documentation and code samples when Microsoft Learn MCP tools are unavailable.

    1.9k GitHub stars~852 tokensUpdated 8 days ago
    Auto-check passed

Categories

Questions about Microsoft Code Reference

What does Microsoft Code Reference do?

Find working code samples, verify API signatures, and fix Microsoft SDK errors using official docs. Microsoft Code Reference is an agent skill from MicrosoftDocs/mcp, published by the product's own GitHub organization. Find working code samples, verify API signatures, and fix Microsoft SDK errors using official docs.

When should I use Microsoft Code Reference?

Microsoft Code Reference fits situations like: the user is writing; reviewing code that touches any Microsoft SDK; azure client library; microsoft API—even if they dont ask for a reference. Catches hallucinated methods.

How do I install Microsoft Code Reference in Claude Code?

Run `npx skills add MicrosoftDocs/mcp --skill microsoft-code-reference -a claude-code`. Or copy the skill folder (skills/microsoft-code-reference in MicrosoftDocs/mcp) into .claude/skills/microsoft-code-reference in your project. Claude Code loads it when a task matches its description.

How do I install Microsoft Code Reference in Codex?

Run `npx skills add MicrosoftDocs/mcp --skill microsoft-code-reference -a codex`. Or copy the skill folder (skills/microsoft-code-reference in MicrosoftDocs/mcp) into .agents/skills/microsoft-code-reference in your project. Codex loads it when a task matches its description.

Can I use Microsoft Code Reference in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add MicrosoftDocs/mcp --skill microsoft-code-reference -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/microsoft-code-reference, .gemini/skills/microsoft-code-reference, .github/skills/microsoft-code-reference and .opencode/skills/microsoft-code-reference in your project.

What does Microsoft Code Reference need to run?

Going by SKILL.md and its folder, Microsoft Code Reference needs the command-line tools its instructions call (npx and npm). Our summary lists: Node.js. Compatibility (from SKILL.md): 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`)..

Does Microsoft Code Reference access the network?

SKILL.md contains no URLs. Its commands use npx and npm, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Microsoft Code Reference safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Microsoft Code Reference use?

Microsoft Code Reference is published under the CC-BY-4.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Microsoft Code Reference use?

About 1.1k tokens (SKILL.md is roughly 4.3k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Microsoft Code Reference?

Skills that share tags, products or a category with Microsoft Code Reference: Microsoft Foundry Tools (MicrosoftDocs/Agent-Skills, 777 stars), Microsoft Code Reference (Kilo-Org/kilo-marketplace, 189 stars), Azure Event Hubs (Kilo-Org/kilo-marketplace, 189 stars) and Aspire (microsoft/aspire.dev, 196 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Microsoft Code Reference?

MicrosoftDocs (a GitHub organization, an official publisher) maintains it in MicrosoftDocs/mcp, which has 1,936 GitHub stars. The repository was last updated on September 29, 2026.

Source: MicrosoftDocs/mcp on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.