← All courses

AI Custom Skills, Commands, CLIs & MCP Servers

Twenty-one lessons on building the tooling layer around AI systems — the skills that shape behaviour, the commands and CLIs people invoke, and the MCP servers that connect models to real systems. Covers everything the 112-card quiz tests.

New to this? Start at Part 0 — five plain-English lessons on what a language model actually is, what "tooling" means here, and what a terminal, a CLI and an API are. No prior experience assumed.

Already building with AI tools? Skip to Part 1.

Part 0 Start here — no experience needed

0.1 What a language model actually does

Strip away the mystique and a large language model does one thing: given some text, it predicts what text should come next. Do that repeatedly and you get sentences, essays, code.

Three consequences follow, and they explain nearly everything in this course:

An agent is just a model that's been given tools and allowed to use them in a loop: think, act, look at the result, think again.

Key point: a model predicts text, has no memory and no hands. Everything in this course is about giving it context and capabilities.

0.2 Why AI needs tooling at all

If a model only produces text, why build anything around it? Because typing the same context into a chat box every time doesn't scale.

Say your team has a specific way of writing pull request descriptions. You could explain it in every conversation forever — or write it down once somewhere the AI reads automatically. That written-down instruction is a skill.

Say you run the same eight-step release process weekly. You could describe it each time — or save it as a slash command you invoke by name.

Say the AI needs your live order data. It can't reach your database — unless you build an MCP server that exposes exactly the operations you're willing to allow.

So "AI tooling" isn't a separate technology. It's the ordinary engineering discipline of taking something that works once, and making it work reliably, repeatedly, for everyone.

Key point: tooling turns a one-off conversation into something repeatable and shareable — that's the whole point.

0.3 The terminal and the command line

The terminal is a window where you type commands instead of clicking. A CLI (command-line interface) is any program you run that way.

ls              # list files here
cd projects     # go into the projects folder
git status      # ask git what has changed

Each is a program name, then arguments (what to act on) and flags (options, usually starting with -):

ls -la projects
│  │   └── argument: which folder
│  └────── flags: long format, include hidden
└───────── the program

The one genuinely important idea is the pipe (|), which feeds one program's output into the next:

cat notes.txt | grep "TODO" | sort

Read the file → keep only lines containing TODO → sort them. Nobody built a "find-and-sort-todos" program; three small tools combined to make one. That composability is why Part 3 cares so much about how a CLI reads input and writes output.

Key point: CLIs are programs you type. Flags and arguments configure them, and pipes chain them together.

0.4 APIs, protocols and servers

Three words used constantly, all simpler than they sound.

A server is a program that waits for requests and answers them. Nothing more exotic than that — it can run on a machine in a data centre or on your laptop.

An API (application programming interface) is the menu of things a program will let another program ask it to do. A restaurant menu is a good analogy: it lists what you can order, and you don't get to see the kitchen.

A protocol is the agreed format for those requests, so both sides understand each other. If everyone invents their own, nothing connects; agree one, and everything connects to everything.

That last point is exactly why MCP exists. Before it, every AI application needed custom code for every tool — ten apps and ten tools meant a hundred integrations. With a shared protocol you build a tool server once, and any AI app that speaks MCP can use it.

Key point: a server answers requests, an API is what it will answer, a protocol is the shared format — and MCP is that shared format for AI tools.

0.5 The four things this course builds

Everything ahead is one of four things, and they differ mainly in who starts it:

One theme runs through all four, so watch for it: a description is an interface. Whether a skill loads, or a tool gets called, depends almost entirely on how well you described it — which is a writing problem as much as a coding one.

How to use this course: read a part, then use the topic filter to quiz just that topic. Every question explains the reasoning, so wrong answers still teach you something.

Key point: skills are AI-triggered, commands are user-triggered, CLIs are deterministic programs, MCP servers connect to real systems.

Part 1 Custom skills

1 What a skill is, and how it gets chosen

A skill is a packaged set of instructions the model loads when it judges them relevant. That last clause is the whole design problem: the body is only read after the skill has been selected, so the description is the most important field in the file. A brilliant skill with a vague description never runs.

Selection is a matching problem, exactly like search:

Weak "Handles tax stuff."
Strong "Generate and validate UK VAT returns from a CSV of invoices. Use for VAT, MTD submissions, or quarterly returns."

The strong version names the concrete task, the inputs, and — critically — the words a user would actually type.

Say when not to use it too. Two skills with overlapping descriptions make selection unpredictable; "use for Word .docx files, not PDFs" resolves the ambiguity explicitly instead of leaving it to chance. Over-broad triggers are the mirror failure: "use for all Python work" fires constantly, costs context every time, and gets ignored.

How to test it: triggering is empirical. Run realistic prompts that should fire it and near-miss prompts that shouldn't. False positives are as damaging as false negatives.

Key point: the description is a routing decision, not a summary. Name the task, the user's vocabulary, and the boundaries.

2 Structure and progressive disclosure

Everything in a loaded skill competes with the user's actual problem for attention and context. A 3,000-line SKILL.md isn't thorough, it's expensive — and it dilutes the instructions that matter.

Progressive disclosure is the fix: keep the always-loaded entry point short, and link to reference.md or examples.md that the model reads only when it needs them. The depth stays available; the cost is paid on demand.

The discipline for deciding what stays: what must be present to do this job correctly? Everything else moves out.

For a multi-step procedure, use numbered steps in order, with the decision criteria and failure handling at each one. That maps onto how the work is actually performed. A wall of prose containing the same facts is measurably harder to follow.

Keep paths relative to the repository root. A skill is shared code; /Users/alex/project breaks for everyone else on the team.

Key point: short entry point, linked detail. Ordered steps with decision criteria beat prose.

3 Writing instructions that get followed

The model already knows a great deal. What it lacks is your specifics — which tool, what order, what to check, what never to do. So encode the workflow, not a textbook. A skill explaining basic Python syntax teaches nothing and costs context on every load.

Three techniques that move the needle:

For preferences with exceptions, state the default and the exceptions: "default to X; use Y when the file is over 10MB". "Always use X" invites either blind application or quiet abandonment when it doesn't fit.

Key point: encode your workflow with worked examples and reasons — reasons are what let a model generalise correctly.

4 Scoping, safety and maintenance

One skill per coherent job. A sprawling "dev-helper" covering testing, deploying and reviewing triggers constantly and does none of them precisely.

Prefer scripts for deterministic work. If every step is mechanical, a bundled script is exact, repeatable and cheaper than spending tokens and risking variance. Reserve model reasoning for judgement.

Set the trust boundary explicitly. Content a skill fetches — a web page, a document, a ticket — is data to consider, never instructions to obey. That's prompt injection at the skill level, and a well-written skill says so.

Check prerequisites. A skill that ploughs ahead without the CLI it needs produces a baffling downstream error; naming the missing piece turns a mystery into a one-line fix.

Keep them in version control with the code they describe. A deploy skill describing a pipeline that changed last month is worse than none — it confidently instructs the wrong thing. Living in the repo puts it in the same review loop as the code.

And remember the hierarchy: a skill is a sensible default, not an override. A user's explicit instruction wins, because they have context the author didn't.

Key point: narrow scope, scripts for mechanical work, fetched content as data, and version them with the code they describe.

Part 2 Slash commands

5 Commands vs skills

One distinction drives everything: a skill is model-triggered, a command is user-invoked. The command needs no trigger-matching description, which removes the hardest part of skill design — and shifts the effort onto a memorable name and clear arguments.

A slash command is fundamentally a reusable prompt template, expanded into the conversation when invoked. Understanding that explains the rules: it should read as instructions to the model, and arguments are placeholders substituted before the model sees it.

Name commands with verbs — /deploy, /review, /summarise read as instructions; /deployment leaves the user guessing whether it acts or reports.

When is it worth writing? When a workflow is repeated often enough and stable enough to be worth encoding. The real value is consistency — everyone gets the same procedure. Encoding something still in flux means constant updates or, worse, a stale command people follow anyway.

Key point: commands are user-invoked prompt templates. Name them with verbs; write them when a workflow is both repeated and stable.

6 Arguments and composability

Handle missing arguments gracefully. Users forget them constantly. /review with no target might sensibly default to the current diff — what it must not do is silently pick something and leave the user unsure what was reviewed.

Sensible defaults with overrides. Defaults make the common case a single word; flags handle exceptions. Requiring every argument each time is exactly the friction the command was meant to remove.

Document arguments in the command itself, with an example invocation. /deploy staging --skip-tests communicates the interface instantly; nobody reads a wiki mid-task.

Composability means doing one well-defined thing and leaving the result in a state other steps can build on. A command that fetches, transforms, commits and posts can't be reused partway. Small commands chain into workflows you didn't anticipate — the same argument as Unix tools.

Prefer several named commands over one /do --mode=review. Separate commands are self-documenting in a listing; a mode flag hides everything behind knowledge of the flag values. When two commands share instructions, factor the shared part into a referenced file rather than duplicating — duplication drifts.

Key point: defaults plus documented overrides, one job per command, and shared instructions factored out rather than copied.

7 Safety, and when to write a script

Commands are easy to fire by accident — mistyped, auto-completed, half-remembered. Anything that deletes, force-pushes or touches production should state what it's about to do and require a deliberate yes.

Related habits that build trust:

When to graduate to a script or CLI: when the logic is fully deterministic and needs no model reasoning. A script is faster, cheaper, testable and runnable in CI. Often the best answer is both — the command sequences the steps and handles judgement, calling scripts for the mechanical parts.

Key point: confirm before irreversible actions, report what actually happened, and move deterministic logic into scripts.

Part 3 CLI tools

8 The Unix philosophy in practice

Do one thing well, and work with text streams so you compose. That's why grep | sort | uniq solves problems nobody designed for, while a monolith can only do what its author anticipated.

Composability has concrete requirements:

Once a tool does several distinct things, use subcommands (tool db migrate). One flat namespace of mutually exclusive flags becomes unreadable — git, docker and kubectl all took this path.

Key point: one job, stdin-capable, streaming, idempotent — that's what makes a tool composable rather than a dead end.

9 Streams, exit codes and TTYs

Three conventions that every script depends on.

stdout is the data channel; stderr is for humans. Errors, warnings and progress all go to stderr — a warning in the stdout stream corrupts mytool | jq .. The split also lets a user redirect them separately: mytool > out.json 2> errors.log.

Exit 0 means success; anything else is failure. This is what cmd && next and every CI pipeline branch on. A tool that exits 0 after failing breaks automation in the worst possible way — silently.

Detect whether stdout is a TTY. Colour codes and progress bars are lovely interactively and become garbage in a pipe or log file. Check isatty, and provide --no-color and --json as explicit overrides.

A --json mode matters more than it looks: human-readable output should be free to improve, and scraped text breaks when it does. A JSON mode separates the pretty format from the machine contract so both can evolve.

In bash scripts, open with set -euo pipefail. Bash's defaults continue after errors and mask a failing pipeline stage behind a successful last one.

Key point: data on stdout, messages on stderr, meaningful exit codes, and adapt output to whether a human is watching.

10 Arguments, config and errors

Configuration precedence runs most-specific-wins: command-line flags override environment variables, which override config files, which override defaults. That lets a user set a project default once and override it for a single run.

Support long flags as well as short ones — scripts are read far more than written, and someone must understand -rf six months later. Support -- as end-of-options, so a file literally named -rf is handled. Ship shell completions: tab completion is how most people learn a CLI's surface.

Validate arguments before doing any work. Discovering an invalid output path after processing 10,000 records wastes the run and may leave partial state.

Error messages need three things: what failed, why, and what to do:

Useless Error: invalid config
Useful Config error at line 12: "timeout" must be a number, got "30s". Use 30 for seconds.

Keep stack traces behind --verbose. And --help should carry usage, each option with its default, and at least one realistic example — the example is the highest-value line in it.

Key point: flags > env > config > defaults; validate up front; make every error say what to do next.

11 Safety and packaging

Make the default the safe one. People run tools without reading docs, so deletion should require --delete and overwriting --force. A tool whose bare invocation destroys something gets used once, then avoided. --dry-run is the cheapest safety feature there is: it turns "I hope this is right" into "I can see this is right".

Never build shell commands by string concatenation with user input. A filename of ; rm -rf ~ becomes a command. Pass an argument array to the process API and skip the shell entirely.

Never accept credentials as command-line arguments — they land in shell history and are visible in the process list. Read them from the environment or a secure store.

Don't hang in CI. An interactive prompt with no way to skip blocks forever where nobody can answer. Provide flags supplying the answers and a --yes mode; detecting a non-TTY stdin and failing fast beats hanging until timeout.

Handle SIGINT so Ctrl-C cleans up temp files and stale locks, exiting 130 to signal interruption rather than failure.

Distribution is where adoption dies. A single self-contained binary sidesteps runtime and dependency installation entirely — the reason Go and Rust tools spread so easily. For Node, npx-style execution gives first-time users one command and CI a pinned version. Always support --version.

Key point: safe defaults, dry-run, no shells or secrets on the command line, and an install story with no steps.

Part 4 MCP servers

12 What MCP is and why it exists

Before the Model Context Protocol, every integration was bespoke per client: M clients × N services meant M×N pieces of work. A shared protocol turns that into M+N — write the server once, and any MCP-capable client can use it.

That's the entire value proposition, and it explains the design priorities. Your server isn't talking to one application you control; it's publishing an interface to clients and models you don't. So the same discipline applies as to any public API: stable names, clear contracts, careful versioning. Add optional parameters rather than repurposing existing ones, and deprecate before removing — saved workflows and other people's prompts depend on what you shipped.

Keep the server stateless between tool calls where you can. The model may retry after a timeout or interleave calls; hidden state means a retry behaves differently from the first attempt. Pass what a call needs in its arguments.

Key point: MCP standardises client↔tool integration, turning M×N into M+N. Treat your tool surface as a public API.

13 Tools, resources and prompts

Three primitives, distinguished by who initiates:

Getting this mapping right matters: exposing a mutating operation as a resource is a design error clients won't expect, because they may fetch resources freely for context.

Key point: tools are model-invoked actions, resources are client-read data addressed by URI, prompts are user-selected templates.

14 Designing tools models actually call

The model sees only name, description and schema. Nothing else about your implementation exists to it. So the description determines both whether a tool is chosen and whether it's called correctly:

Weak "Searches the database." / "Calls the /orders endpoint with the given parameters."
Strong "Search customer orders by email, date range or status. Returns up to 50 matching orders with line items."

Describe it from the caller's perspective, say what the arguments mean, what comes back, and the limits. Silently returning the first 50 of 4,000 invites confidently wrong conclusions.

Shape tools around tasks, not endpoints. A one-tool-per-REST-endpoint wrapper gives you forty CRUD tools that overwhelm selection and force the model to orchestrate low-level calls. A few task-shaped tools — "find an available slot and book it" — are chosen more reliably and fail less.

Use enums for known values. status: 'open' | 'closed' | 'pending' makes an invalid value structurally impossible rather than relying on the model to guess your vocabulary.

If a tool is never called, the usual cause is a description that doesn't match how users phrase the task. If they say "what did we invoice Acme last month" and your tool says "Retrieves billing records", the connection may never be made.

Key point: the description is the interface. Task-shaped tools, caller's vocabulary, explicit limits, enums for known values.

15 Transports, auth and context budget

stdio runs the server as a local subprocess — no ports, no auth, lifecycle managed by the client. Simple, and it inherits the local user's access. HTTP lets the server run remotely and serve many clients, which changes the security picture completely.

A hosted server must authenticate callers and scope every tool call to that caller's permissions. Otherwise it's a confused deputy: a server holding database credentials, happily answering anyone who asks.

Two specific traps:

Tool results consume context directly. Returning 50,000 rows floods the window and crowds out the actual task. Paginate, cap, and return a total count alongside a page. For long-running work, return promptly with a handle the model can poll rather than blocking the conversation for ten minutes.

Gate destructive tools. Tool calls happen without a human reviewing each one, so either the client gates them or you split the action into preview and commit steps.

Key point: remote means real auth scoped per user; stdout is sacred on stdio; cap result sizes; gate anything irreversible.

16 Testing and failure modes

Test in both directions, because they catch different failures. Direct invocation with known inputs catches broken logic. Running through a real client catches descriptions the model misreads — a tool can be flawless and still never get chosen. The MCP Inspector shortens this loop: list and invoke tools manually to see exactly what the server advertises and returns, separating server bugs from selection issues.

The three failure modes worth memorising:

Finally, the security one that ties this course together: a tool fetching web pages or user-submitted tickets returns text someone else wrote. That's a prompt-injection channel, and results should be framed as data to consider rather than commands to obey — the same trust boundary as lesson 4.

Key point: test the logic and the selection separately. Schema mismatch, ambiguous descriptions and unstructured errors are the three classic failures.

▶ Going further

  • modelcontextprotocol.io — the specification and SDK docs. This field is young enough that the spec is the primary source; secondary material dates quickly.
  • Anthropic — sessions on MCP, skills and agent design.
  • Recent MCP tutorials — recency matters more than usual here.
  • Best practice: build a small MCP server for an API you already use, then watch a model try to use it. Nothing teaches tool-description design faster than seeing your own tool get ignored.

That's the course. Now test it:

Take the AI Skills, CLIs & MCP quiz →

Pick AI Skills, CLIs & MCP under Pro Dev — 112 questions, filterable by topic.