The 4 key concepts of Claude Code that nobody explains clearly
Skills, sub-agents, hooks, commands: 4 distinct mechanisms most tutorials confuse. Complete guide with concrete examples and a real setup.
Why this guide exists
Most Claude Code tutorials cover Skills and stop there. Some mention sub-agents. Almost none clearly explain the difference between the 4 fundamental mechanisms, and more importantly, how they work together.
The result: developers using Claude Code at 20% of its potential. They know claude "do this" but don’t realize they could orchestrate a complete ecosystem of specialized agents, automatic scripts, and custom commands.
This guide covers the 4 distinct concepts:
| Concept | Role | Triggered by |
|---|---|---|
| Skills | Auto-invoked knowledge | Claude itself |
| Sub-agents | Isolated tasks, separate context | Claude or the user |
| Hooks | Automatic system reactions | Events (PreToolUse, etc.) |
| Commands | Manual custom prompts | The user (slash commands) |
Concept 1: Skills, embedded knowledge
What it is
A skill is a Markdown file that Claude Code loads automatically when it detects it’s needed. No need to call it manually. Claude finds and uses it on its own.
It’s contextual knowledge. You describe a process, conventions, a workflow, and Claude accesses it when the situation demands it.
How it works
Skills live in .claude/skills/ (project-local) or ~/.claude/skills/ (global). Each file has frontmatter describing when to invoke it:
---
name: infographic
description: Use when the user wants to create a visual infographic
---
## Process
1. Analyze the topic and identify key data points
2. Choose layout: vertical timeline, comparison grid, or flow diagram
3. Use brand colors: #E8915A (accent), #111113 (background)
4. Generate SVG with embedded data visualization
5. Export as PNG at 1080x1350 (Instagram) or 1200x628 (LinkedIn)
Concrete use cases
- Design system: skill that loads your colors, fonts, reference components
- Business process: skill describing your deployment flow or naming conventions
- Recurring instructions: skill reminding project rules (no console.log, always test, etc.)
What it is NOT
A skill doesn’t do anything by itself. It doesn’t execute code, doesn’t launch processes. It informs Claude. It’s an intelligent reference file, not an agent.
Concept 2: Sub-agents, isolated workers
What it is
A sub-agent is a task delegated in a separate context. Claude launches a subprocess that works on its own, with its own instructions and potentially a different model. Only the result comes back to the main conversation.
Why it’s powerful
The main context stays clean. And you can choose the model per task:
---
name: news-scraper
description: Scrape latest AI news from configured sources
model: haiku
---
Scrape the following sources for articles published in the last 24h:
- Hacker News (top 30)
- TechCrunch AI section
- Anthropic blog
For each article, extract: title, URL, date, 2-sentence summary.
Return as JSON array, sorted by relevance.
- Haiku for scraping and mechanical tasks (fast, cheap)
- Sonnet for common business tasks
- Opus for complex reasoning and architectural decisions
When to use a sub-agent vs. doing directly
| Situation | Do directly | Sub-agent |
|---|---|---|
| Modify a file | Yes | No |
| Analyze 50 files | No | Yes |
| Repetitive mechanical task | No | ✅ (Haiku) |
| Decision requiring current context | Yes | No |
| Deep web research | No | Yes |