The Agentic AI Builder's Playbook
Understanding Agent Skills Hooks Subagents and Plugins: The Complete Architecture
By Jason Newell · ~7 min read · Claude Code
Claude Code's extensibility architecture has four components that work together. Most people know one or two. Understanding all four — and how they relate — is what separates teams that get 2x productivity from teams that get 10x.
The Five-Layer Stack
Layer 1: CLAUDE.md (The Memory Layer)
Always loaded. Always active. The agent's constitution. Defines architecture rules, naming conventions, test expectations, and the repo map. Without it, every session starts from scratch.
Layer 2: Skills (The Knowledge Layer)
Reusable instruction modules loaded on-demand. When the agent's task description matches a skill's YAML frontmatter, the full skill is loaded — providing instructions, scripts, reference docs, and templates. Skills give agents domain-specific expertise without consuming context when that expertise isn't needed.
Structure:
.claude/skills/code-review/
SKILL.md # instructions (required)
scripts/lint.sh # executable code (optional)
references/ # docs, checklists (optional)
assets/ # templates (optional)
Layer 3: Hooks (The Guardrail Layer)
Deterministic code that runs at specific lifecycle events. The critical distinction: hooks run outside the agent loop. They're not controlled by the LLM. They fire every time, unconditionally.
Hook events:
- PreToolUse → runs before every tool call (validation, linting, security checks)
- PostToolUse → runs after every tool call (auto-format, auto-lint)
- SessionStart → load context on launch
- SessionEnd → save session summaries
- Stop → kill switches and final guardrails
If CLAUDE.md is guidance (followed ~70% of the time), hooks are enforcement (followed 100% of the time). Critical rules belong in hooks.
Layer 4: Subagents (The Delegation Layer)
Autonomous child agents spawned by the parent. Each operates with:
- Its own context window (doesn't inherit the parent's context bloat)
- Custom model (Opus for reasoning, Sonnet for speed, Haiku for simple tasks)
- Custom tools (only the permissions the task requires)
- Isolated execution
The pattern: parent decomposes task → spawns specialized subagents → collects outputs → returns unified result.
Key constraint: subagents can't spawn subagents. No infinite recursion. The parent is always the orchestrator.
Layer 5: Plugins (The Distribution Layer)
Bundles of skills + agents + hooks + commands into installable units. Think npm packages for agent capabilities. A plugin packages everything needed for a capability (e.g., a "code review" plugin includes the review skill, the lint hooks, the review command, and the reviewer subagent definition) and distributes it as a team install.
The Agent Extension Stack
The relationship between all components:
PLUGINS → package layer, bundles everything
SKILLS → knowledge & workflows
MCP + TOOLS → external connections + built-in capabilities
SUBAGENTS → isolated execution
HOOKS → deterministic automation
CLAUDE.md → always-on context
Each layer has a job. CLAUDE.md sets the context. Skills provide expertise. Hooks enforce quality. Subagents delegate complex work. MCP connects to external tools. Plugins distribute the whole configuration to the team.
When to Use What
The Real-World Example
"Analyze competitors and write a report":
- CLAUDE.md loads → project context, company info
- Skill activates → competitive-analysis framework
- MCP fires → searches Google Drive for past briefs
- Subagent spawns → market-researcher gathers data
- Second subagent → technical-analyst reviews repos
- Hook triggers → auto-formats output, runs linter
- Parent synthesizes → returns the final report
Every layer did its specific job. Remove any one of them and the system degrades.
Jason Newell is an AI practitioner, builder, and writer covering agentic systems, developer tooling, and the future of AI engineering.
Related
Related field notes
Keep reading
More field notes
This piece is part of the MAX Research Collective library. Browse the rest, or connect on LinkedIn.