Claude Code setup guide
When to use Claude Code skills vs subagents, hooks, MCP and plugins
Use CLAUDE.md for conventions Claude should follow in every session. Put reusable instructions in a skill you can call with a slash command. Give a subagent work that would fill your conversation with file reads. Use MCP to reach an outside system, a hook for a check that must run every time, and a plugin to share the setup across repositories.
Last updated
By CWYN · Published · Feature behavior as of · See Anthropic’s Claude Code features overview and skills documentation
1. Compare Claude Code features
Context cost here means what enters your main conversation. A feature can load automatically and still leave the decision to Claude.
| Feature | What it is | When it loads | Context cost | Deterministic? | Best for | Example |
|---|---|---|---|---|---|---|
| CLAUDE.md | Persistent project instructions | Every session | The instructions occupy context every session | Loading is automatic. Claude interprets the text. | Project-wide conventions | Name files in snake_case. |
| Rules | Instruction files in .claude/rules/ | Every session, or when a matching file opens | The text of each loaded rule | Paths control loading. Claude interprets the rule. | Conventions for particular files | Use sentence case in docs headings. |
| Skill | Reusable instructions and reference material | Description each session, full text when used | The description, then the playbook if used here | No. Claude interprets the steps. | A repeatable task | A /deploy checklist |
| Subagent | A worker with its own context window | When Claude delegates the task | Only the returned summary | No. The worker uses judgment. | Parallel work or a review that reads many files | Check paths across project READMEs. |
| Hook | A handler for a lifecycle event | At every matching event | Zero unless it returns output | Yes for the trigger. A prompt or subagent can still use judgment. | A required check | Run ESLint after each edit. |
| MCP | A connection to external tools and data | Tools are available when connected. Results arrive on a call. | Depends on the tool and the data returned | Depends on the tool called. | Access to an outside system | Query a database. |
| Plugin | An installable bundle of features | Once installed, each part uses its own trigger | Depends on the features used | Each part keeps its own behavior. | Sharing a setup across repositories | Install a team’s /my-plugin:review skill. |
2. Skills vs subagents
Use a skill when you want to reuse the instructions. Use a subagent when you want the work to happen in a separate context.
Suppose you review the file paths in a README. A skill can teach Claude what counts as a broken link. If checking the links means opening files across the repository, give the review to a subagent. Its file reads stay in its own context, and you get a summary of the paths to fix. See how to give a project subagent a read-only review task.
You can use the same checklist either way. List it in a subagent’s skills: field to preload it for that worker. If you prefer to start the review with a slash command, set context: fork in the skill’s frontmatter to run the skill in isolation.
3. Skills vs hooks
Put guardrails in hooks. Use a skill for the decisions Claude should make after a check runs.
A PostToolUse hook can run ESLint after each matching edit. A /fix-lint skill can explain which fixes your project accepts. If an edit must be blocked before it happens, use a PreToolUse hook that checks the proposed edit.
A hook can run a script, send an HTTP request, call an MCP tool, or use a prompt or subagent. The event starts the hook without Claude deciding to run it. For a working file guard, see the Claude Code hook examples. If an expected check never runs, check the hook’s event and matcher.
4. Skills vs custom commands
Custom commands have been merged into skills. Prefer a skill for a new slash command.
Existing files in .claude/commands/ still work. Claude can invoke them even if you never type the command. When a command needs supporting files, give it a skill directory. For example, here is how to keep the name /deploy.
- Create the directory
.claude/skills/deploy/. The directory name supplies the command name. - Move
.claude/commands/deploy.mdto.claude/skills/deploy/SKILL.md. Put supporting files beside it and refer to them from the instructions. - If only you should start the workflow, add
disable-model-invocation: trueto the YAML frontmatter. You still invoke the skill with/deploy.
For a command you can try on a draft release note, create your first project skill.
5. Skills vs MCP
Use MCP to reach an external system. Use a skill to teach Claude how to work with the result.
If your weekly report starts with copying database rows into chat, connect the database through a Model Context Protocol (MCP) server. A skill can specify which records belong in the report and how to summarize them. To provide the connection, add an MCP server to Claude Code.
6. Skills vs plugins
Write a skill for the task. Package it in a plugin when another repository needs the same setup.
A plugin can deliver a review skill, its subagent, a lint hook and an MCP server in one installation. Plugin skills include the plugin name in their slash command, so a skill called review in my-plugin runs as /my-plugin:review. You can distribute that bundle through a marketplace.
7. CLAUDE.md vs skills vs rules
Keep project-wide conventions in CLAUDE.md, scope rules to the files they concern, and put occasional workflows in skills.
Aim to keep CLAUDE.md under 200 lines. If a convention only concerns documentation, move it into .claude/rules/ with paths frontmatter so it loads when a matching file opens. A rule without a path restriction loads every session.
Both CLAUDE.md and skills can import files with @path. If the material is a deployment playbook, a skill gives you a /deploy workflow and loads the full instructions only when you use it.
8. Pick by situation
- Claude gets the same convention wrong twice. Put the convention in
CLAUDE.md. - You keep typing the same prompt. Give it a slash command with a user-invocable skill.
- You paste the same playbook a third time. Move its steps and reference files into a skill.
- You keep copying data from a browser tab. Connect the source with an MCP server.
- A side task fills the conversation with file reads. Send it to a subagent and ask for the findings.
- A check should run even if you forget to ask. Attach a hook to the matching event.
- A second repository needs the same setup. Bundle the features in a plugin.
9. Claude Code feature FAQ
Are Claude Code custom commands deprecated?
Anthropic merged custom commands into skills. Existing .claude/commands/ files still work. You can keep a working command there and move it into a skill directory when you need supporting files.
Can a subagent use a skill?
Yes. List the skill in the subagent’s skills: field. The worker starts with those instructions in its own context and returns a summary to your conversation.
Which one costs the least context?
A hook that returns no output adds nothing to the main conversation. A subagent keeps the file reads in its own window but adds a summary. A skill Claude can invoke uses space for its description each session and for its instructions when used.
How do I make a rule that always holds?
Enforce it at the event where a violation could occur. For example, have a PreToolUse hook reject a matching tool call that would edit .env. An instruction in CLAUDE.md or a skill can explain why the file is protected. The hook blocks the edit.