Skip to content

Commit e670723

Browse files
TianqiZhangclaude
andauthored
Add Learn CLI fallback to all skills (#123)
* Add Learn CLI alternative to all skills Add CLI fallback sections to microsoft-docs, microsoft-code-reference, and microsoft-skill-creator skills so agents can use the mslearn CLI via Bash when the Learn MCP server is not available. Each section maps MCP tools to their CLI equivalents and shows both npx and global install usage. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Update compatibility metadata, fix section order, and add CLI to templates - Update compatibility frontmatter in all 3 skills to reflect CLI fallback - Move "Why Use This" above "CLI Alternative" in microsoft-docs skill - Add CLI Alternative section to the example generated skill in skill-creator - Add CLI mapping table to the top of skill-templates.md so generated skills can reference CLI equivalents without duplicating in every template Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 45349c1 commit e670723

4 files changed

Lines changed: 89 additions & 3 deletions

File tree

‎skills/microsoft-code-reference/SKILL.md‎

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
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.
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 Code Reference
@@ -77,3 +77,24 @@ Before generating code using Microsoft SDKs, verify it's correct:
7777
3. **Find working sample** — `microsoft_code_sample_search(query: "[task]", language: "[lang]")`
7878

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

‎skills/microsoft-docs/SKILL.md‎

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name: microsoft-docs
33
description: Query official Microsoft documentation to understand concepts, find tutorials, and learn how services work. Use for Azure, .NET, Microsoft 365, Windows, Power Platform, and all Microsoft technologies. Get accurate, current information from learn.microsoft.com and other official Microsoft websites—architecture overviews, quickstarts, configuration guides, limits, and best practices.
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 Docs
@@ -55,3 +55,23 @@ Fetch after search when:
5555
- **Accuracy** — live docs, not training data that may be outdated
5656
- **Completeness** — tutorials have all steps, not fragments
5757
- **Authority** — official Microsoft documentation
58+
59+
## CLI Alternative
60+
61+
If the Learn MCP server is not available, use the `mslearn` CLI via Bash instead:
62+
63+
```bash
64+
# Run directly (no install needed)
65+
npx @microsoft/learn-cli search "azure functions timeout"
66+
67+
# Or install globally, then run
68+
npm install -g @microsoft/learn-cli
69+
mslearn search "azure functions timeout"
70+
```
71+
72+
| MCP Tool | CLI Command |
73+
|----------|-------------|
74+
| `microsoft_docs_search(query: "...")` | `mslearn search "..."` |
75+
| `microsoft_docs_fetch(url: "...")` | `mslearn fetch "..."` |
76+
77+
The `fetch` command also supports `--section <heading>` to extract a single section and `--max-chars <number>` to truncate output.

‎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 via Bash 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)