Claude · Power features: skills, subagents, hooks, and settings
The difference between using Claude Code as a chat box in your terminal and running it as a configured engineering environment comes down to a handful of features: Skills and slash commands, subagents for parallel work, hooks that fire your scripts on events, MCPMCPAn open standard that lets AI assistants connect to your company's tools and data in a consistent, governed way, instead of one custom integration at a time.View full definition → servers wired into your project, and the settings.json that governs all of it. This lesson goes deep on each.
Skills and slash commands
You already know Claude Code ships with built-in slash commands like /clear and /init. The power move is writing your own, and today that means writing a Skill.
A Skill is a folder containing a SKILL.md file, plus any scripts, templates, or reference docs the task needs. Put it at .claude/skills/<name>/SKILL.md in your repo and it works in that project. Put it in ~/.claude/skills/ and it works everywhere. Every Skill can be used two ways. You can type /<name> to run it yourself, or Claude can load it on its own when the task matches the Skill's description.
Here is a review Skill that gives the team a consistent code review pass:
---
name: review
description: Review staged changes for bugs, security issues, and style
allowed-tools: Bash(git diff:*), Read
---
Review the staged diff below. Flag:
1. Logic bugs and edge cases
2. Security issues (injection, secrets, auth gaps)
3. Style deviations from CLAUDE.md
Be terse. Cite file:line. Skip praise.
Staged changes:
!`git diff --cached`Two things to notice. The ! prefix runs a shell command and injects its output into the prompt. The allowed-tools frontmatter scopes what the Skill may touch, so /review cannot wander off and edit files. You can also pass arguments with $ARGUMENTS.
If a Skill should only ever run when you ask for it (a deploy, say), set disable-model-invocation: true in the frontmatter so Claude never triggers it on its own.
The older format still works. A single Markdown file at .claude/commands/<name>.md becomes /<name>, which is handy for a quick one-off prompt. ReachReachThe number of unique people exposed to your message in a given period. Unlike impressions, reach counts each person once, no matter how often they see it.View full definition → for the folder format when the capability needs bundled files: "fill out our invoice template" or "generate a PDF from this data" with a helper script alongside. The same Skills format works across Claude Code, the Claude apps, and the APIAPIApplication Programming Interface: a standardised interface that lets applications communicate and exchange data without knowing each other's internal workings.View full definition →, so a Skill you build once travels with you. See code.claude.com/docs/en/skills.
Subagents for parallel work
A subagent is a separate Claude instance with its own context windowcontext windowThe context window is the maximum amount of text (measured in tokens) a language model can process at once, including both the input prompt and the generated output.View full definition →, its own system promptsystem promptThe hidden set of instructions that defines how an AI assistant behaves before any user types a question: its role, tone, limits and rules.View full definition →, and its own restricted tool set, spawned by your main session to handle a focused job. The point is isolation. The subagent burns through a noisy task (reading 40 files, running a test suite) and returns only the conclusion, so your main context stays clean.
You define subagents with Markdown files in .claude/agents/, or interactively with /agents. Each one declares a name, a description that tells Claude *when* to delegate to it, and the tools it is allowed to use.
---
name: test-runner
description: Runs the test suite and diagnoses failures. Use after code changes.
tools: Bash, Read, Grep
---
You are a test specialist. Run the project's test command, read failing
output, locate the root cause, and report a concise fix. Do not edit
files unless explicitly asked.Now your main session can hand off: "use the test-runner to check this." Claude reads the description, matches the task, and delegates. Because the subagent has its own window, a thousand lines of stack traces never pollute your main conversation.
The real payoff is parallelism. You can ask Claude to fan work out across several subagents at once: one auditing dependencies, one writing docs, one refactoring a module. They run independently and report back. This is the same delegation pattern the Claude Agent SDK exposes programmatically, just driven from the terminal. Keep tool grants tight per subagent. A docs writer has no business with Bash.
Hooks that run your scripts on events
Skills and subagents are things you invoke. Hooks are the opposite: shell commands that Claude Code runs *automatically* at defined points in its lifecycle, with no promptingpromptingPrompt engineering is the practice of designing and refining text inputs to guide large language models toward accurate, relevant, and reliable outputs.View full definition →. They are how you enforce rules instead of hoping Claude follows them.
The key lifecycle events:
PreToolUse: before a tool runs (you can block it)PostToolUse: after a tool succeedsUserPromptSubmit: when you hit enterStop: when Claude finishes respondingSessionStart: when a session opens
Each hook receives a JSON payload on stdin describing the event: the tool name, its input, the session ID, and so on. The classic use case is auto-formatting every file Claude edits. Add this to your settings.json:
{
"hooks": {
"PostToolUse": [
{
"matcher": "Edit|Write",
"hooks": [
{
"type": "command",
"command": "jq -r '.tool_input.file_path' | xargs prettier --write 2>/dev/null"
}
]
}
]
}
}After Claude edits or writes any file, jq pulls the path out of the payload and Prettier formats that file. Claude never has to remember your style rules because the hook makes them non-negotiable. The matcher is a regex against tool names.
PreToolUse goes further because it can block. Exit with code 2 and Claude Code cancels the tool call and shows your stderr message to Claude so it can adjust. Other non-zero exit codes count as non-blocking errors and the tool still runs, so a guardrailguardrailRules and controls that keep an AI system inside safe, legal and on-brand boundaries, blocking outputs and actions that cross the line.View full definition → must use 2 specifically. For finer control, a hook can print JSON with a permission decision of allow, deny, or ask. Teams use this to forbid edits to secrets/, block git push --force, or require a passing lint before a commit. The hook runs deterministically, outside the model's judgment.
One caution: hooks run real shell commands with your permissions. Read what you paste. A hook from an untrusted repo can do anything you can do. The full event reference and payload schemas live at code.claude.com/docs/en/hooks.
Claude Code Hooks: Automate Your Workflow
MCP servers inside Claude Code
You met the Model Context Protocol as a concept: a standard way to expose tools and data to any AI client. Claude Code is an MCP client, so you can plug the same servers you'd use in the Claude desktop app directly into your terminal sessions.
Add one with the CLI. GitHub hosts an official remote server:
claude mcp add --transport http github https://api.githubcopilot.com/mcp/Run /mcp inside a session to authenticate. Once connected, Claude can open issues, read PRs, and inspect repos as native tools, with no glue code. Local servers that run as a process on your machine use the -- form, for example claude mcp add myserver -- npx -y some-mcp-package. Servers can be scoped to a single project or made available globally. Project-scoped servers go in a .mcp.json file checked into the repo, so your whole team gets the same integrations.
MCP connects Claude Code to the wider ecosystem. The connectors you see in the Claude apps are MCP under the hood, and the protocol spec is documented at modelcontextprotocol.io. Build a server once and it works in Claude Code, the desktop app, and anything else that speaks MCP.
Knowledge check
1. What fundamentally is a custom slash command in Claude Code?
2. According to the lesson's rule of thumb, when should you build a Skill rather than a slash command?
3. Why does the example review.md include an `allowed-tools` entry in its frontmatter?
4. Select ALL statements that correctly describe how Skills differ from custom slash commands.
Select all the correct answers.
5. Select ALL correct statements about writing custom slash command files.
Select all the correct answers.
settings.json: the control plane
Everything above is configured through settings files, and understanding their layering separates a tidy setup from a confusing one. Claude Code reads settings from several locations, and the most specific wins:
~/.claude/settings.json: your personal defaults, all projects.claude/settings.json: project settings, checked into git, shared with the team.claude/settings.local.json: your personal project overrides, git-ignored
Put team-wide guardrails (the format hook, the permission rules) in the shared .claude/settings.json so everyone inherits them. Put your personal preferences and machine-specific paths in settings.local.json so you don't fight your teammates in version control. Organizations can also push managed settings that override all three.
The most important key is permissions, which controls what Claude can do without stopping to ask. You allow, ask, or deny tool patterns:
{
"permissions": {
"allow": [
"Bash(npm run test:*)",
"Read",
"Edit"
],
"deny": [
"Bash(rm -rf:*)",
"Read(./.env)",
"Read(./secrets/**)"
]
}
}This lets Claude run your test scripts and edit files freely, never read your `.env` or secrets, and refuse dangerous deletes. Tune this once and you stop babysitting confirmation prompts for safe operations while keeping a hard wall around the dangerous ones. Treat Bash deny patterns as a convenience, since a determined command can be phrased many ways. For hard guarantees, back them with a PreToolUse hook.
Other keys worth knowing: env injects environment variables into every session, model pins which Claude model the project uses, and hooks (above) lives here too. Keep the shared file minimal and intentional, because anyone who clones the repo inherits it. The full schemaschemaA schema is the formal blueprint that defines how data is structured, named, typed, and related within a database, file, or message.View full definition → is at code.claude.com/docs/en/settings.
How the pieces compose
These features stack. A real setup looks like this:
A SessionStart hook loads project conventions. Your permissions block green-lights the test command and walls off secrets. A /review Skill runs your standardized code review on demand. A test-runner subagent takes the noisy work of running and diagnosing the suite. A PostToolUse hook formats every file Claude touches. A GitHub MCP server lets Claude open the PR when you're done. All of it lives in files in the repo, so a new teammate clones it and gets the exact same configured Claude on day one.
That reproducibility is the whole game. You are shipping a configured engineering environment alongside your code.
Key Takeaways
- Skills are the main way to extend Claude Code. A folder at
.claude/skills/<name>/gives you a/<name>command that Claude can also invoke on its own. Single-file.claude/commands/prompts still work for quick cases. - Use subagents to protect your main context. Delegate noisy, focused jobs to isolated agents with tight tool grants, and fan them out in parallel for independent work.
- Hooks make rules deterministic. They read event JSON from stdin, and a
PreToolUsehook blocks only with exit code 2. They run real shell commands with your permissions, so audit anything you didn't write. - Treat MCP as your integration layer.
claude mcp addwires the same servers used across the Anthropic ecosystem into your terminal, and.mcp.jsonshares them with the team. - Commit your
settings.jsonand design the layering: shared guardrails in the team file, personal overrides insettings.local.json.
What to do, from this lesson
These actions are compiled in the role's Playbook.
- Write shareable slash commands for tasks you trigger repeatedly
- Enforce deterministic rules with PreToolUse and PostToolUse hooks
- Commit settings.json for shared guardrails, keeping personal overrides local