All labsLab 05
Level 225 min+120 XP

MCP, Skills & Subagents

Three ways to extend the agent, one question that tells you which one you need, and the exact commands for all three.

After this module you can

add a working MCP server, write a project skill, delegate a review to a subagent, and prove what each one changed

You need
  • Lab 02 finished — a QAIRU Event Sign-up folder that is a git repo with at least one commit
  • Lab 03 finished — a CLAUDE.md in that folder
  • Claude Code installed and logged in (Pro, Max, Team, Enterprise or Console account)

By now your agent knows your project. It still does not know your tools, your repeated chores, or how to keep its own noise out of its own head. Three features fix exactly those three things — and they are not interchangeable.

Twenty-five minutes. One MCP server, one skill, one delegated review. After each, you check what actually changed — because “I installed a thing” is not a result.

Three problems, three tools, and the question that separates them

The ladder Claude Code is built on: CLAUDE.md is always loaded, skills load on demand, hooks fire deterministically, subagents get a separate context window, and MCP brings in external tools (features overview).

You are missing Reach for What it is
A system the agent cannot reach: issue tracker, database, browser, live docs MCP server An open standard for plugging external tools and data into the agent
A chore you re-explain every week: a review format, a release note Skill A folder with a SKILL.md; only its description sits in context
Work that would flood your conversation: logs, a big search, a diff review Subagent A helper with its own context window that hands back a summary

The question that sorts almost every case: is the missing thing outside your machine (MCP), inside your head (skill), or inside your context window (subagent)?

~100tokens a skill costs until you call itAnthropic, 16 Oct 2025 ↗
200lines: the size to keep CLAUDE.md underClaude Code docs · memory ↗
3–10xthe tokens a multi-agent run costsAnthropic, 23 Jan 2026 ↗

Add one MCP server: the Claude Code docs

One sentence first: an MCP server gives the agent a tool it did not have — here, a searchable copy of the current Claude Code documentation, so it stops answering from memory. Hosted over HTTP, no authentication, nothing to install.

  1. Add it from your normal shell, not from inside a session

    Exit Claude Code first (/exit). claude mcp add is a shell command.

    PowerShell / bash — same two lines
    claude mcp add --transport http claude-code-docs https://code.claude.com/docs/mcp
    claude mcp list

    The line for your server should end in Connected. If not, run claude mcp list again — the first handshake can be slow.

  2. Ask it something it can only answer from the docs

    Start claude, then run /mcp — you get status, reconnect, authenticate and disable for every server. Now prompt:

    Proof-of-tool promptClaude Code · after adding the server
    Use the claude-code-docs server to look up what MCP_TIMEOUT does
    and when I would need it. Quote the doc, do not guess.

    Approve the tool call. Watch the label: it carries the server name, so you can always see when an answer came through a tool instead of out of the model.

  3. Check what it cost you

    Run /context. The server barely registers — MCP tool definitions are deferred by default, so only the tool names and the server’s instructions load until a tool is used (costs). The caveat: a CLI tool you already have, such as gh, is still cheaper than an MCP server doing the same job. Add servers you use; disable the rest.

  4. Decide who else gets it

    Scope is a flag, and the default is narrow.

    • no flag → local: you, this project. Stored in ~/.claude.json (%USERPROFILE%\.claude.json on Windows).
    • --scope project → writes .mcp.json in the repo root; teammates get an approval prompt.
    • --scope user → you, every project.

    Claude Code does not read ~/.claude/mcp.json or any file like it, so do not invent one. To undo: claude mcp remove claude-code-docs.

  5. Stretch: a local server that drives a browser (needs Node.js 18+)

    bash
    claude mcp add playwright -- npx -y @playwright/mcp@latest

    Everything after -- is the command that starts a local server; forgetting -- is the classic mistake. Now ask the agent to open your sign-up page and tell you whether the form actually submits — that is self-verification through a real browser.

    The first start downloads packages and can time out. PowerShell: $env:MCP_TIMEOUT = "60000"; claude.

Write one skill: /cc-docs

One sentence: a skill is a folder with a SKILL.md that teaches the agent a procedure once, so you stop re-typing it — and it stays out of your context window until you call it.

In Lab 03 you wrote /preflight, a skill that takes no input. This one takes an argument and drives the server you just added, so the two halves of this lab wire together.

  1. Make the folder

    PowerShell
    New-Item -ItemType Directory -Force .claude\skills\cc-docs
    macOS / Linux
    mkdir -p .claude/skills/cc-docs
  2. Write SKILL.md

    Create .claude/skills/cc-docs/SKILL.md with exactly this:

    ---
    name: cc-docs
    description: Look up a Claude Code command or setting in the official docs and answer with a quote. Use whenever I ask how something in Claude Code works.
    argument-hint: what to look up
    ---
    Look up "$ARGUMENTS" using the claude-code-docs MCP server.
    
    Answer in exactly this shape:
    1. One sentence: what it is.
    2. The exact command or setting, in a code block.
    3. One sentence: when it does not apply, or how it breaks.
    
    Quote the docs. If the server does not answer, say so instead of
    answering from memory.

    $ARGUMENTS is whatever you type after the command name, so /cc-docs plan mode and /cc-docs Ctrl+B both run out of one file. argument-hint records what to type after the name. There is no disable-model-invocation line here on purpose: this skill only reads, so it is safe to let the agent reach for it on its own.

  3. Restart and confirm it loaded

    Skills are picked up at start, so exit and run claude again. Type / and find cc-docs in the list, or run /skills to see everything currently loaded.

  4. Run it, then ask the same thing in plain English

    in the Claude Code session
    /cc-docs plan mode

    You get three parts, in that order, pulled through the server you added ten minutes ago. Now type how does plan mode work? as a normal question and compare. The skill did not make the model smarter. It made the output the same shape every time, which is what lets you skim an answer instead of reading it.

  5. Or let the agent write the next one

    Skill-writing promptClaude Code · in your project folder
    Create a project skill in .claude/skills/ called release-note.
    It should read the last 5 commits and write a 4-line release note
    in Kazakh and English for a non-technical reader.
    Manual invocation only. Show me the SKILL.md before writing it.
Go deeperWhy not just put all of this in CLAUDE.md?

Because CLAUDE.md loads at the start of every session, so every line costs context every time — keep it under 200 lines. Skills use progressive disclosure instead: about 100 tokens of metadata are always loaded, the body (recommended under 5,000 tokens) only when relevant, referenced files only when needed (Agent Skills).

Skills are an open standard, not a Claude-only feature (agentskills.io). Custom slash commands are merged into them now: .claude/commands/deploy.md and .claude/skills/deploy/SKILL.md both give you /deploy.

A skill is executable instruction: install only from sources you trust, and read any bundled script before you run it.

Delegate one review to a subagent

One sentence: a subagent is a second Claude with its own context window, system prompt, tool list and permissions — it does the noisy work and returns a summary, so your main conversation stays clean.

Built-in ones are already there: Explore (read-only search), Plan (research during plan mode) and general-purpose. Now define your own.

  1. Commit first — this one matters

    PowerShell / bash
    git add -A
    git commit -m "before delegating to a subagent"

    Subagent edits are usually not restored by /rewind. Checkpoints are local undo; git is permanent undo. Commit before you delegate, every time.

  2. Write the subagent file

    Create .claude/agents/security-reviewer.md:

    ---
    name: security-reviewer
    description: Reviews code for security vulnerabilities
    tools: Read, Grep, Glob, Bash
    model: opus
    ---
    You are a senior security engineer. Look for injection, auth flaws,
    secrets in code, insecure data handling. Give line references and fixes.

    name and description are the only required fields. Everything else is a dial: tools, disallowedTools, model, permissionMode, maxTurns, isolation: worktree. For simple helpers, model: haiku cuts the bill.

    Note for anyone following an older tutorial: since v2.1.198 /agents no longer opens a management panel — it points you at these file locations.

  3. Hand it the diff

    Fresh-context review promptClaude Code · after the agent has written code
    Use the security-reviewer agent on the diff of my last commit.
    
    Check, in this order:
    1. Correctness: does it do what CLAUDE.md and the page require?
    2. Security: input validation, secrets in code, unsafe defaults.
    3. Scope: anything changed that the task did not require?
    
    Report only findings that affect correctness, security or the stated
    requirements. For each: file and line, what breaks, a concrete failing
    scenario, a suggested fix. Style preferences go in a separate list.
    If you find nothing serious, say so.

    You can force it with an @-mention of the agent name, or run a whole session as it with claude --agent security-reviewer.

  4. Watch where the work happened

    While it runs, /tasks lists running work and Ctrl+B sends it to the background. When it returns, run /context: it barely moved, because the grep output and the file reads lived in the subagent’s window, not yours. Then run /usage — on a subscription it attributes usage to skills, subagents and MCP servers separately, so today’s three additions all show up in one place.

The agent that wrote the code reviews the code. Its grep output fills your window, and it is defending work it produced ten minutes ago.

A separate context reviews a diff it did not write. The subagent absorbs the noise and returns findings — the writer/reviewer pattern from Anthropic’s best practices.
Go deeperWhen a subagent is the wrong answer

Anthropic’s January 2026 guidance is blunt about the cost: multi-agent work typically runs 3–10x the tokens of a single agent for the same task, so exhaust single-agent options first. Skip it when a better prompt or a /clear would fix the problem (when and how to use multi-agent systems).

The design rule from the same post is the one people get wrong: decompose by context, not by job title. The agent that builds a feature should also write its tests, because it already holds the context; planner / coder / tester creates handoff loss. Cognition makes it harder — actions carry implicit decisions, and two agents making conflicting ones produce a broken whole (Don’t Build Multi-Agents).

Default: one agent, subagents for research, a fresh-context reviewer. Parallel writers only when they own different files — that is Lab 07.

Quick check

Every Friday you paste the same six-line instruction asking the agent to summarise the week's commits for your team chat. What are you missing?

You have finished this lab when0/6 done
Take it with you · cheatsheetExtend-the-agent cheatsheet

Outside your machine → MCP server (claude mcp add). Inside your head → skill (.claude/skills/<name>/SKILL.md). Inside your context window → subagent (.claude/agents/<name>.md). Commit before you delegate.

You are done when

`claude mcp list` prints Connected, `/cc-docs` answers from the documentation instead of from memory, and a subagent hands you a review summary without filling your main context.