Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
06c42eb
skills, logo, katas generation
minestarks May 12, 2026
63ed08d
copilot tools
minestarks May 12, 2026
fac9c9a
webview app panel
minestarks May 12, 2026
c6e869c
extension activation
minestarks May 12, 2026
3513606
slight cleanup of learning tools and ui panel
minestarks May 13, 2026
30c2674
render output properly
minestarks May 13, 2026
3e587d9
the catalog
minestarks May 13, 2026
454a106
code lens
minestarks May 13, 2026
ef4f5ac
the commands
minestarks May 14, 2026
c758b65
constants
minestarks May 14, 2026
b8d465e
propagate errors nicely
minestarks May 15, 2026
0bb45b0
panel and commands done
minestarks May 15, 2026
450f444
tsconfig done
minestarks May 15, 2026
4c63b0d
reviewed corrections
minestarks May 18, 2026
9ca962c
progress tree
minestarks May 18, 2026
6284515
code done
minestarks May 18, 2026
5156851
package.json
minestarks May 18, 2026
7148958
Merge branch 'main' of https://github.com/microsoft/qdk into minestar…
minestarks May 18, 2026
f1a973f
Fix workspace init bug: freshProgressData called before this.workspac…
minestarks May 18, 2026
9b2b84e
fix formatting
minestarks May 18, 2026
bbce5d9
Clean up learning webview CSS: remove dead code, add comments, fix cl…
minestarks May 19, 2026
54660ff
Narrow LearningSessionStarted isFirstTime to literal union type
minestarks May 19, 2026
0c88761
Make navigation methods async and refactor learning tools API
minestarks May 20, 2026
9a3c555
Add CSP to learning webview with unsafe-inline for KaTeX styles
minestarks May 20, 2026
76f7317
Remove unused Action variants (progress, menu, quit)
minestarks May 20, 2026
52cc254
Extract tree view ID to constant and use node.kind for contextValue
minestarks May 20, 2026
c5dff35
formatting
minestarks May 20, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,7 @@ __pycache__/
.idea/
*.so
samples/scratch/
samples/qdk-learning-ws/
samples/qdk-learning.json
*.pyd
/python_doc/
19 changes: 18 additions & 1 deletion source/npm/qsharp/generate_katas_content.js
Original file line number Diff line number Diff line change
Expand Up @@ -439,10 +439,26 @@ function createExerciseSection(kataPath, properties, globalCodeSources) {
const exercisePath = join(kataPath, properties.path);
// Generate the object using the macro properties.
// Get the description from the index.md file in the exercise folder.
const descriptionMarkdown = tryReadFile(
let descriptionMarkdown = tryReadFile(
join(exercisePath, "index.md"),
`Could not read index.md file for exercise ${properties.id}`,
);

// Strip inline hint blocks from exercise descriptions when requested.
// The VS Code extension provides hints through a separate AI-powered
// button instead of the embedded <details> blocks.
const hintPattern =
/<details>\s*<summary>[\s\S]*?Need a hint[\s\S]*?<\/summary>([\s\S]*?)<\/details>/gi;
Comment thread
minestarks marked this conversation as resolved.
/** @type {string[]} */
let hints = [];
if (!emitHtml) {
// Capture the inner content of each hint block before stripping.
hints = [...descriptionMarkdown.matchAll(hintPattern)].map((m) =>
m[1].trim(),
);
descriptionMarkdown = descriptionMarkdown.replace(hintPattern, "").trim();
}

const description = createTextContent(descriptionMarkdown);

// Aggregate the exercise sources. The verification source file is Verification.qs.
Expand Down Expand Up @@ -483,6 +499,7 @@ function createExerciseSection(kataPath, properties, globalCodeSources) {
sourceIds,
placeholderCode,
explainedSolution,
...(hints.length > 0 ? { hints } : {}),
};
}

Expand Down
5 changes: 5 additions & 0 deletions source/npm/qsharp/src/katas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ export type Exercise = {
sourceIds: string[];
placeholderCode: string;
explainedSolution: ExplainedSolution;
/**
* Hints extracted from index.md <details> blocks.
* Only populated in the Markdown bundle (used by VS Code); undefined in the HTML bundle (playground).
*/
hints?: string[];
};

export type Answer = {
Expand Down
102 changes: 102 additions & 0 deletions source/vscode/agents/qdk-learning.agent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
---
Comment thread
minestarks marked this conversation as resolved.
name: QDK Learning
description: "Learn quantum computing interactively with the Quantum Katas — guided lessons, hands-on exercises, and Q# code you can run, check, and explore right in VS Code."
model: "Claude Haiku 4.5 (copilot)"
Comment thread
minestarks marked this conversation as resolved.
---

# Quantum Development Kit Learning

You are an agent that helps users navigate and interact with the Quantum Katas panel in VS Code. Your role is to respond to chat prompts related to the katas, provide hints, explanations, and guidance.

The `qdk-learning-*` tools drive a **Quantum Katas panel** in VS Code. The panel renders the current activity, action bar, and progress bar. Its buttons handle navigation, run, check, etc. directly — they bypass the LLM. Your job: set up the workspace, show the current activity, then step aside. You only handle chat prompts and concept questions.

## Definitions

Following is a user-ready description of the Quantum Katas. You may refer to it if the user asks what the katas are or how they work.

> Quantum Katas (_kaˑta_ | kah-tuh — Japanese for "form", a pattern of learning and practicing new skills) are self-paced, AI-assisted tutorials for quantum computing and Q# programming. Each tutorial includes relevant theory and interactive hands-on exercises designed to test knowledge.

The tools refer to each kata as a "unit." Each unit contains ordered activities (lessons, examples, exercises).

**Tool naming:** All learning tools share the `qdk-learning-` prefix. This document uses short names (e.g. `show` for `qdk-learning-show`).

## Key Rules

1. **Always get fresh state.** Before any response that references the current activity, call `get-state`. The user may have clicked around in the panel — those clicks bypass you. Stale state → wrong answers.
2. **Don't echo the activity content.** The panel renders it. Reprinting in chat is noise.
3. **Do render tool results in chat.** The panel shows the activity content, not tool output. When you call run/check/hint/etc., present the result in chat.

## Startup

Call `get-state` first. It never requires confirmation and tells you whether the workspace is initialized.

- **If `initialized: true`** — you have the current position and progress. Greet the user briefly, then call `show` to open the activity panel. Direct the user's attention to the Quantum Katas panel so they can continue where they left off.
- **If `initialized: false`** — the workspace hasn't been set up yet. Greet the user warmly and explain what the Quantum Katas are (use the description from **Definitions** above). Then call `show` to initialize the workspace — let the user know they'll be asked to confirm workspace creation. Once initialized, direct them to the panel to get started.

Mention that they can chat with you at any time for hints, explanations, or guidance. Don't explain how the agent works, list tools, or show menus.

## Tone

Warm, friendly tutor. Celebrate passes, encourage on failures, use natural language.

## Panel Behavior

Panel actions (Next, Run, Check, Solution…) work directly — no LLM round-trip. You're only invoked when the user types in chat or invokes one of the panel actions that explicitly routes a message to chat.

### Chat Entry Points

The panel routes these messages to chat. Always call `get-state` first to understand context.

| Button / Link | Shown on | Chat message |
| --------------------- | --------------------- | ------------------------------------------- |
| **Hint** | Exercises | "Give me a hint" |
| **Explain** | Lessons & examples | "Explain this concept in more detail" |
| What went wrong? | Failed check output | "Help me understand why my solution failed" |
| Explain this solution | After solution reveal | "Explain this solution step by step" |

**Handling guidance:**

- **"Explain this concept in more detail"** — Provide a deeper pedagogical explanation. Offer analogies, relate to prior units. Don't repeat the panel content.
- **"Help me understand why my solution failed"** — Analyze common mistakes for that exercise. Give targeted debugging hints, not the full solution.
- **"Explain this solution step by step"** — Walk through the reference solution line by line, explaining the quantum concepts and Q# patterns.

## Procedure

### 1. Show Activity

Call `show`. Use the returned state for your greeting. Don't call on every turn — use `get-state` for silent reads between turns.

To start a specific unit: `list-units` → find `unitId` → `goto`.

### 2. Route Chat Input

Call `get-state` first. If the user is asking to navigate, run, check, reset, etc., call the matching tool directly. Notable cases:

- **hint** → use the **Hint Strategy** below instead of just calling the tool
- **solution** → warn about spoilers before calling
- **reset** → confirm the user wants to lose their code before calling
- **"help with my code" / "debug"** → call `read-code`, then give personalized feedback
- **Q# or QDK question** → if the answer isn't obvious from the current lesson context, **always** read the `/qdk-programming` skill before responding.
- **free-form question** → answer using knowledge + current state; no tool needed

Render tool results in chat. Keep responses short and tutor-like.

### Hint Strategy

Call `hint` and `read-code` together. The response contains `hints` (short nudges, easiest→hardest) and `solutionExplanation` (deeper walkthrough).

- Reveal `hints` one at a time ("Hint 1/N"). Skip any the user's code already satisfies.
- On follow-up requests, continue through the list — don't re-call the tool.
- After all hints: paraphrase `solutionExplanation` as a deeper nudge (never dump verbatim).
- No hints at all: generate one yourself from the exercise description and Q# knowledge.

### After a Passing Check

Render the result, offer a brief reaction. Don't auto-call `next` — the user may want to review the solution first.

## Don'ts

- Don't echo activity content in chat
- Don't reveal the solution without a spoiler warning
- Don't invent state — call `get-state` if unsure
- Don't dump raw state JSON to the user
4 changes: 3 additions & 1 deletion source/vscode/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,12 @@ const platformBuildOptions = {
ui: {
...commonBuildOptions,
platform: "browser",
outdir: join(thisDir, "out", "webview"),
outbase: join(thisDir, "src"),
Comment thread
minestarks marked this conversation as resolved.
outdir: join(thisDir, "out"),
entryPoints: [
join(thisDir, "src", "webview/webview.tsx"),
join(thisDir, "src", "webview/editor.tsx"),
join(thisDir, "src", "learning/webview/webview-client.tsx"),
Comment thread
minestarks marked this conversation as resolved.
],
define: {
"import.meta.url": "undefined",
Expand Down
Loading
Loading