Claude Code MCP Servers, Hooks, and Custom Skills: A Practical Course Guide
Anthropic released a free course on Claude Code, and it covers more than most developers expect. MCP server integration, hooks for workflow guardrails, custom slash commands, and the skills system that turns repetitive prompts into reusable tools. This guide breaks down each advanced feature with practical examples so you can skip the basics and start building real workflows. Whether you are connecting external databases, enforcing code standards automatically, or packaging your best prompts into shareable skills, this is the reference you will keep coming back to.
1. What MCP Servers Actually Do in Claude Code
The Model Context Protocol (MCP) is an open standard that lets AI assistants connect to external tools and data sources through a consistent interface. In Claude Code, MCP servers are how you extend the agent beyond its default capabilities. Instead of copying and pasting context from your database, API docs, or monitoring tools, you connect them directly and Claude Code can query them in real time.
The practical impact is significant. An MCP server for your Postgres database means Claude Code can check schema, run read queries, and understand your data model without you explaining it every session. An MCP server for your deployment platform means it can check build logs, verify environment variables, and diagnose deploy failures.
Common MCP server categories that developers find useful:
- Database servers - Postgres, SQLite, Supabase. Let the agent understand your schema and write queries that match your actual data model.
- Browser and web servers - Playwright, Puppeteer. Give the agent the ability to navigate web UIs, fill forms, take screenshots, and verify frontend behavior.
- File system and search servers - Enhanced file operations, code search across repositories, grep with custom indexing.
- Platform servers - GitHub, Linear, Sentry, PostHog. Pull issues, check error rates, and link code changes to production impact.
- Custom internal servers - Your own APIs, internal tools, proprietary systems. This is where MCP becomes genuinely powerful for teams.
The key insight from the Anthropic course is that MCP is not about replacing your tools. It is about making them accessible to the AI agent so it can use them the same way you do, just faster and without context switching.
2. Setting Up Your First MCP Server
MCP configuration in Claude Code lives in .mcp.json at your project root or in your global settings. The file defines which servers to start, how to connect to them, and what permissions they have.
A minimal configuration for a filesystem MCP server looks like this:
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-filesystem",
"/path/to/your/project"
]
}
}
}For a Postgres connection, you would add environment variables for the connection string. The pattern is consistent: define the command to start the server, pass any required arguments, and optionally set environment variables for secrets.
Tips from developers who have set up multiple MCP servers:
- Start with one server and verify it works before adding more. Multiple broken servers make debugging harder.
- Use project-level
.mcp.jsonfor team-shared servers and global config for personal ones like browser automation. - Check Claude Code's
/mcpcommand to verify servers are connected and see which tools are available. - Be cautious with write permissions. Read-only MCP servers for databases are safer defaults, especially when the agent is still learning your codebase patterns.
3. Hooks: Automated Guardrails for Every Action
Hooks are one of the most underused features in Claude Code. They let you run shell commands automatically before or after specific agent actions, creating guardrails that enforce your workflow without manual intervention.
The hook system supports several trigger points:
- PreToolUse - Runs before the agent uses a tool. You can validate inputs, check permissions, or block dangerous operations.
- PostToolUse - Runs after a tool completes. Useful for logging, formatting output, or triggering follow-up actions.
- Notification - Fires when the agent wants to notify you. Route these to Slack, terminal notifications, or custom dashboards.
- Stop - Runs when the agent finishes a turn. Good for cleanup, summary generation, or auto-committing changes.
Practical hook examples that developers use daily:
// settings.json hook configuration
{
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "echo 'Bash command being executed'"
}
]
}
]
}
}A common pattern is a PreToolUse hook that blocks git push --force to main, or a PostToolUse hook that runs your linter after every file edit. These small automations compound into a workflow where the agent naturally follows your team's conventions because the guardrails are built into the environment.
The security implications of hooks deserve attention. Hooks run arbitrary shell commands with your user permissions. A malicious .mcp.json or settings file committed to a repository could execute code on your machine. Always review hook configurations in shared repositories before running Claude Code.
4. Custom Slash Commands and the Skills System
Skills in Claude Code are reusable prompts packaged as slash commands. If you find yourself typing the same instructions repeatedly, writing a skill turns that into a single command. The skill system reads a SKILL.md file that contains the instructions, and you invoke it with a slash command or through the Skill tool.
The file structure is straightforward. Create a directory with a SKILL.md file:
~/my-skill/SKILL.md # My Custom Skill ## When to use Describe when this skill should trigger. ## Steps 1. First, check the current git status 2. Run the test suite 3. Generate a summary of changes 4. Format the output as a changelog entry
Developers have built skills for everything from code review workflows to deployment checklists, database migration patterns, and even email composition. The key is that a skill encapsulates not just the task but the context, constraints, and preferred approach that you would normally explain manually.
Skills also compose well with MCP servers. A "deploy" skill might use the GitHub MCP server to create a PR, the Vercel MCP server to trigger a preview build, and the Slack MCP server to notify the team. The skill orchestrates these tools in a sequence that matches your team's actual deployment process.
CLAUDE.md files serve a related but different purpose. While skills are task-specific instructions you invoke explicitly, CLAUDE.md is always-on context that shapes every interaction. Your CLAUDE.md might specify coding conventions, architecture patterns, and project-specific constraints. Skills then build on top of that foundation for specific workflows.
5. Real Workflow Patterns That Ship Faster
The combination of MCP servers, hooks, and skills enables workflow patterns that dramatically reduce the gap between writing code and shipping it. Here are patterns that teams report as high-impact:
The "investigate and fix" pattern. Connect Sentry via MCP, create a skill called /investigate that pulls recent errors, traces them to source code, proposes a fix, writes a test, and opens a PR. What used to take 30 minutes of context-gathering now takes one command.
The "spec to ship" pattern. Write a spec in your ARCHITECTURE.md, invoke a skill that reads the spec, generates implementation code, runs the test suite, checks for regressions, and creates a commit with a descriptive message. The agent handles the mechanical work while you focus on the spec.
The "review and refactor" pattern. A PostToolUse hook that runs after every file write, checking the diff against your style guide and architectural constraints. If the agent introduces a pattern that violates your conventions, the hook catches it immediately rather than waiting for code review.
For developers working on macOS native apps, desktop automation agents like Fazm complement these coding workflows. Fazm is an AI computer agent for macOS, voice-first and open source, that uses accessibility APIs to control desktop applications. Where Claude Code automates your coding workflow, a tool like Fazm can automate the testing, deployment, and operational workflows that surround it.
6. Claude Code vs Other AI Coding Assistants
Understanding where Claude Code fits relative to other tools helps you choose the right setup for your workflow. Each tool makes different tradeoffs.
| Feature | Claude Code | Cursor | GitHub Copilot |
|---|---|---|---|
| Interface | Terminal CLI | VS Code fork | Editor extension |
| MCP support | Native, first-class | Supported | Limited |
| Hooks / guardrails | Built-in hook system | Rules files | Instructions files |
| Custom skills | SKILL.md system | Notepads | Custom instructions |
| Agentic execution | Full shell access | Sandboxed terminal | Workspace agent |
| Best for | Complex multi-step tasks | Editor-integrated flow | Autocomplete, quick edits |
Many developers use multiple tools. Claude Code for complex refactoring, architecture work, and multi-file changes. Cursor or Copilot for in-editor autocomplete and quick inline edits. The tools are not mutually exclusive, and the MCP ecosystem means they can share the same server connections.
7. Getting Started: First Week Checklist
If you are new to Claude Code or have been using it without MCP and hooks, here is a practical first-week plan to get the most value:
Day 1-2: CLAUDE.md foundation. Write a CLAUDE.md for your main project. Include your coding conventions, architecture patterns, testing requirements, and any common pitfalls. This alone will noticeably improve Claude Code's output quality.
Day 3-4: First MCP server. Pick one external tool you use daily. If you work with a database, set up the Postgres or SQLite MCP server. If you do frontend work, set up Playwright. One well-configured server is worth more than five half-working ones.
Day 5: First hook. Add a PreToolUse hook that enforces one rule you care about. Maybe it blocks force pushes, or maybe it runs your formatter after every file edit. Start small and expand.
Day 6-7: First skill. Take your most repetitive workflow and package it as a skill. Code review, deployment prep, changelog generation, whatever you do most often. The process of writing a SKILL.md forces you to articulate your workflow clearly, which itself improves it.
The Anthropic free course covers each of these topics in depth. This guide is meant to be a practical complement, giving you concrete patterns to implement as you work through the course material.
Automate Beyond Code with Fazm
Claude Code handles your coding workflow. Fazm handles everything else on your Mac, from testing to deployment to operational tasks, using voice commands and accessibility APIs.
Try Fazm Free