Skip to content

Commit 822d040

Browse files
TianqiZhangCopilot
andauthored
Add Learn CLI option to microsoft-docs skills (#1003)
* Add Learn CLI option to microsoft-docs skills * avoid context fork * Apply suggestions from code review Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent 39a1a0c commit 822d040

4 files changed

Lines changed: 89 additions & 2 deletions

File tree

skills/microsoft-code-reference/SKILL.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
name: microsoft-code-reference
33
description: 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.
4-
compatibility: Requires Microsoft Learn MCP Server (https://learn.microsoft.com/api/mcp)
4+
compatibility: Works best with Microsoft Learn MCP Server (https://learn.microsoft.com/api/mcp). Can also use the mslearn CLI as a fallback.
55
---
66

77
# Microsoft Code Reference
@@ -76,3 +76,24 @@ Before generating code using Microsoft SDKs, verify it's correct:
7676
3. **Find working sample**`microsoft_code_sample_search(query: "[task]", language: "[lang]")`
7777

7878
For simple lookups, step 1 alone may suffice. For complex API usage, complete all three steps.
79+
80+
## CLI Alternative
81+
82+
If the Learn MCP server is not available, use the `mslearn` CLI from a terminal or shell (for example, Bash, PowerShell, or cmd) instead:
83+
84+
```sh
85+
# Run directly (no install needed)
86+
npx @microsoft/learn-cli search "BlobClient UploadAsync Azure.Storage.Blobs"
87+
88+
# Or install globally, then run
89+
npm install -g @microsoft/learn-cli
90+
mslearn search "BlobClient UploadAsync Azure.Storage.Blobs"
91+
```
92+
93+
| MCP Tool | CLI Command |
94+
|----------|-------------|
95+
| `microsoft_docs_search(query: "...")` | `mslearn search "..."` |
96+
| `microsoft_code_sample_search(query: "...", language: "...")` | `mslearn code-search "..." --language ...` |
97+
| `microsoft_docs_fetch(url: "...")` | `mslearn fetch "..."` |
98+
99+
Pass `--json` to `search` or `code-search` to get raw JSON output for further processing.

skills/microsoft-docs/SKILL.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,27 @@ Use these tools for **everything on learn.microsoft.com** — Azure, .NET, M365,
2121

2222
Use `microsoft_docs_fetch` after search when you need complete tutorials, all config options, or when search excerpts are truncated.
2323

24+
### CLI Alternative
25+
26+
If the Learn MCP server is not available, use the `mslearn` CLI from your terminal or shell (for example, Bash, PowerShell, or cmd) instead:
27+
28+
```bash
29+
# Run directly (no install needed)
30+
npx @microsoft/learn-cli search "BlobClient UploadAsync Azure.Storage.Blobs"
31+
32+
# Or install globally, then run
33+
npm install -g @microsoft/learn-cli
34+
mslearn search "BlobClient UploadAsync Azure.Storage.Blobs"
35+
```
36+
37+
| MCP Tool | CLI Command |
38+
|----------|-------------|
39+
| `microsoft_docs_search(query: "...")` | `mslearn search "..."` |
40+
| `microsoft_code_sample_search(query: "...", language: "...")` | `mslearn code-search "..." --language ...` |
41+
| `microsoft_docs_fetch(url: "...")` | `mslearn fetch "..."` |
42+
43+
Pass `--json` to `search` or `code-search` to get raw JSON output for further processing.
44+
2445
---
2546

2647
## Exceptions: When to Use Other Tools

skills/microsoft-skill-creator/SKILL.md

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name: microsoft-skill-creator
33
description: Create agent skills for Microsoft technologies using Learn MCP tools. Use when users want to create a skill that teaches agents about any Microsoft technology, library, framework, or service (Azure, .NET, M365, VS Code, Bicep, etc.). Investigates topics deeply, then generates a hybrid skill storing essential knowledge locally while enabling dynamic deeper investigation.
44
context: fork
5-
compatibility: Requires Microsoft Learn MCP Server (https://learn.microsoft.com/api/mcp)
5+
compatibility: Works best with Microsoft Learn MCP Server (https://learn.microsoft.com/api/mcp). Can also use the mslearn CLI as a fallback.
66
---
77

88
# Microsoft Skill Creator
@@ -37,6 +37,27 @@ skill-name/
3737
| `microsoft_docs_fetch` | Get full page content | Deep dive into important pages |
3838
| `microsoft_code_sample_search` | Find code examples | Get implementation patterns |
3939

40+
### CLI Alternative
41+
42+
If the Learn MCP server is not available, use the `mslearn` CLI from a terminal or shell (for example, Bash, PowerShell, or cmd) instead:
43+
44+
```bash
45+
# Run directly (no install needed)
46+
npx @microsoft/learn-cli search "semantic kernel overview"
47+
48+
# Or install globally, then run
49+
npm install -g @microsoft/learn-cli
50+
mslearn search "semantic kernel overview"
51+
```
52+
53+
| MCP Tool | CLI Command |
54+
|----------|-------------|
55+
| `microsoft_docs_search(query: "...")` | `mslearn search "..."` |
56+
| `microsoft_code_sample_search(query: "...", language: "...")` | `mslearn code-search "..." --language ...` |
57+
| `microsoft_docs_fetch(url: "...")` | `mslearn fetch "..."` |
58+
59+
Generated skills should include this same CLI fallback table so agents can use either path.
60+
4061
## Creation Process
4162

4263
### Step 1: Investigate the Topic
@@ -214,4 +235,16 @@ See [getting-started/hello-kernel.cs](sample_codes/getting-started/hello-kernel.
214235
| Plugin development | `microsoft_docs_search(query="semantic kernel plugins custom functions")` |
215236
| Planners | `microsoft_docs_search(query="semantic kernel planner")` |
216237
| Memory | `microsoft_docs_fetch(url="https://learn.microsoft.com/en-us/semantic-kernel/frameworks/agent/agent-memory")` |
238+
239+
## CLI Alternative
240+
241+
If the Learn MCP server is not available, use the `mslearn` CLI instead:
242+
243+
| MCP Tool | CLI Command |
244+
|----------|-------------|
245+
| `microsoft_docs_search(query: "...")` | `mslearn search "..."` |
246+
| `microsoft_code_sample_search(query: "...", language: "...")` | `mslearn code-search "..." --language ...` |
247+
| `microsoft_docs_fetch(url: "...")` | `mslearn fetch "..."` |
248+
249+
Run directly with `npx @microsoft/learn-cli <command>` or install globally with `npm install -g @microsoft/learn-cli`.
217250
```

skills/microsoft-skill-creator/references/skill-templates.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@
22

33
Ready-to-use templates for different types of Microsoft technologies.
44

5+
## CLI Alternative for MCP Tools
6+
7+
All templates below use MCP tool calls (e.g., `microsoft_docs_search`, `microsoft_docs_fetch`, `microsoft_code_sample_search`). If the Learn MCP server is not available, replace them with CLI equivalents:
8+
9+
| MCP Tool | CLI Command |
10+
|----------|-------------|
11+
| `microsoft_docs_search(query: "...")` | `mslearn search "..."` |
12+
| `microsoft_code_sample_search(query: "...", language: "...")` | `mslearn code-search "..." --language ...` |
13+
| `microsoft_docs_fetch(url: "...")` | `mslearn fetch "..."` |
14+
15+
Run directly with `npx @microsoft/learn-cli <command>` or install globally with `npm install -g @microsoft/learn-cli`.
16+
517
## Template 1: SDK/Library Skill
618

719
For client libraries, SDKs, and programming frameworks.

0 commit comments

Comments
 (0)