Claude Code · AI training guide

Claude Code Hooks, Skills, and Subagents: How to Customize and Scale It

The short answer

Use CLAUDE.md for guidance, skills for repeatable procedures, hooks for actions that must always run, subagents for parallel or isolated work, and MCP for connecting external tools. Choosing the right mechanism matters because only some of them enforce behavior; the others only suggest it.

How do the Claude Code customization options differ?

Each customization mechanism answers a different question, and mixing them up is the most common source of confusion.

MechanismAnswers the questionEnforces behavior?
CLAUDE.mdWhat should Claude know about this project?No, it guides
SkillsHow do we do this repeatable task?No, Claude chooses to apply it
HooksWhat must always happen before or after an action?Yes, they run as commands
SubagentsWho should handle this part of the work?Isolates context and scope
MCPWhat outside systems can Claude reach?Defines available tools

The Claude Code documentation describes each of these. The short version: if you need something to happen every time, regardless of what the model decides, use a hook.

What are hooks, and when should you use them?

Hooks let you run shell commands before or after Claude Code actions. The documentation’s examples are auto-formatting after every file edit and running lint before a commit.

Use a hook when the rule is deterministic and non-negotiable: formatting, linting, blocking edits to protected files, or logging. Because a hook is a command that runs, it does not depend on Claude remembering an instruction.

Keep hooks fast and narrow. A slow hook that runs on every action makes the tool miserable to use, and a hook that does too much is hard to debug. Review hook scripts like any code that executes on a developer’s machine, because that is what they are.

What are skills, and how do they fit?

Skills package repeatable workflows your team can share, such as a command for reviewing a pull request or deploying to staging. They are instructions plus optional supporting files that Claude loads when relevant.

Use a skill when you have a multi-step procedure that should be done the same way each time but still benefits from the model’s judgment. For example, a "release notes" skill can specify the format, the sources to read, and the tone, while leaving the actual summarizing to Claude. See our full Claude Skills guide.

What are subagents, and when are they worth it?

Subagents are separate Claude Code agents that work on parts of a task, with a lead agent coordinating, assigning subtasks, and merging results, as the documentation describes. They are useful for two reasons: parallelism and context isolation.

A subagent that investigates a question in a large codebase can report back a short conclusion without filling the main session with everything it read. That keeps the main conversation focused.

Do not reach for subagents by default. They add complexity and cost. Use them when work is genuinely separable, such as reviewing five independent modules, or when exploring would otherwise flood the main context.

How does MCP extend Claude Code?

MCP, the Model Context Protocol, is an open standard for connecting AI tools to external data sources. With it, Claude Code can read design docs in Google Drive, update tickets in Jira, pull data from Slack, or use custom tooling.

Treat each MCP server as a privilege grant. Approve a short list, give each an owner, prefer read access to write access where you can, and review them regularly. See Claude connectors and MCP for the governance side.

How do you teach this to a development team?

Teach it as a ladder, not a menu. First, get everyone comfortable with the basic loop and a good CLAUDE.md. Then introduce one hook that solves a real annoyance, such as auto-formatting. Then one shared skill that the team actually needs. Only then talk about subagents and MCP.

Each step should solve a problem the team already feels. If nobody feels the pain, nobody will adopt the feature. In our advanced tracks, participants build one skill or hook for their own team and present it, which both teaches the mechanism and seeds the team’s shared library.

How do Claude Code hooks work in practice, with a real example?

Hooks are handlers that run automatically at specific points in Claude Code’s lifecycle. Anthropic’s documentation says a handler can be a command, an HTTP endpoint, an MCP tool call, an LLM prompt, or a subagent, and that when an event fires and a matcher matches, Claude Code sends JSON about the event to the handler, which can optionally return a decision.

Where they live: in ~/.claude/settings.json for all your projects, .claude/settings.json for one project (commit it to share), .claude/settings.local.json for personal project settings, or managed policy settings for the whole organization.

Main events include SessionStart, UserPromptSubmit, PreToolUse, PostToolUse, and Stop. On events that can be blocked, exit code 2 blocks the action, and a PreToolUse hook can return allow, deny, or ask. A typical use is a script that runs before Bash commands and denies destructive ones; the script must be executable.

The takeaway for managers: a hook is the way to make a rule deterministic. Use it for formatting, blocking destructive commands, and logging. Because it runs code on developers’ machines, review hook scripts like any other code, and use managed settings to distribute approved hooks.

How do you define a subagent, and what are the built-in ones?

A subagent is a Markdown file with YAML frontmatter. Anthropic’s documentation says each subagent runs in its own context window with a custom system prompt, its own tool access, and independent permissions, and returns only a summary to the main conversation.

Where they live, in priority order: managed settings, a command-line flag for one session, .claude/agents/ for the project, ~/.claude/agents/ for all your projects, then plugins. Only name and description are required. Useful optional fields include tools (an allowlist), disallowedTools, model, permissionMode, skills, and memory.

---
name: code-reviewer
description: Reviews code for quality and best practices
tools: Read, Glob, Grep
model: sonnet
---
You are a code reviewer. Give specific, actionable feedback on
quality, security, and best practices.

Built-in subagents include Explore (fast, read-only codebase search), Plan (read-only research in plan mode), and a general-purpose agent. The documentation advises using a subagent when a side task would produce output you will not need again, when you want to enforce tool restrictions, or when the work is self-contained. It advises staying in the main conversation for tasks that need frequent back-and-forth. A read-only reviewer subagent is a safe first one to build.

Frequently asked questions

Should I use a hook or a CLAUDE.md rule?

If the rule must always be followed, use a hook or a permission setting. If it is guidance that benefits from judgment, use CLAUDE.md or a skill.

Are subagents the same as running multiple Claude Code sessions?

Not exactly. Subagents are coordinated by a lead agent within a task. The documentation also describes background agents for running several full sessions in parallel from one screen.

Can hooks be dangerous?

They execute commands on your machine, so review them like any script and keep them narrowly scoped.

Do I need all of these to get value from Claude Code?

No. Many teams get strong results from a good CLAUDE.md plus one or two hooks. Add mechanisms when a real problem calls for them.

Where do I configure Claude Code hooks?

In settings files: ~/.claude/settings.json, .claude/settings.json, .claude/settings.local.json, or managed policy settings, per Anthropic’s documentation.

Can a hook block a command?

Yes. On events that can be blocked, exit code 2 blocks the action, and a PreToolUse hook can return a deny decision with a reason.

Where do Claude Code subagents go?

In .claude/agents/ for a project or ~/.claude/agents/ for all your projects, as Markdown files with YAML frontmatter.

Product features, plans, and limits change often. This guide reflects the vendor documentation listed above as of November 2026. Check the vendor’s current documentation before you make purchasing or policy decisions. TechStack Consulting is an independent training firm and is not affiliated with Anthropic or OpenAI.

Want your team using Claude well, with governance in place?

Book my free Claude review

Free · 30 minutes

Free 30-Minute Claude Rollout Review

In 30 minutes, we’ll help you identify:

  • Highest-value business use cases
  • Governance and compliance requirements
  • Change-management considerations
  • Adoption risks
  • A practical rollout strategy

30 minutes · No pitch · Written recommendations