Agent Development Kit
5-layer model - understand the complete architecture
title: "Agent Development Kit" description: "5-layer model - understand the complete architecture" section: "Core" readTime: "15 min" badge: "POPULAR"
Agent Development Kit: The 5-Layer Model
"Claude Code isn't a coding assistant. It's an agent platform."
Most people are using 10% of it.
The key is understanding the 5-layer composition model that powers everything.
Layer 1: CLAUDE.md — Memory Layer
Your agent's constitution.
Think of it as an employee onboarding document, not a novel. Keep it under 200 lines.
## Tech Stack
- Node.js 20
- TypeScript
- React 19
## Conventions
- Kebab-case filenames
- camelCase variables
- ESLint strict mode
## Architecture
- /src/app (Next.js App Router)
- /src/components (React)
- /src/lib (utilities)
## Security
- No .env in git
- API keys environment-only
- Rate limiting on all endpointsWhat goes in CLAUDE.md:
- Tech stack (not installation instructions)
- Coding conventions (not tutorials)
- Architecture overview (not detailed design)
- Hard constraints (banned patterns, security rules)
- Key file locations (not every file)
What belongs in Skills instead:
- Multi-step workflows
- Complex procedures
- Decision trees
- Testing strategies
- Deployment procedures
Layer 2: Skills — Knowledge Layer
Extend your agent with reusable knowledge modules.
Skills use the Agent Skills open standard (agentskills.io).
Skill Anatomy
---
name: "Database Migration"
description: "Safe schema migrations with rollback"
user-invocable: true
disable-model-invocation: false
allowed-tools: ["bash", "file"]
model: "sonnet"
effort: "high"
context: "fork"
hooks:
- event: "post-tool-execution"
pattern: "ALTER TABLE"
action: "validate"
paths:
- "db/migrations/**"
- "prisma/schema.prisma"
---
# Database Migration Skill
Use this skill to create safe migrations...
## Usage
- /db-migrate "add users table"
- /db-migrate --rollback
## Behind the Scenes
\`\`\`bash
# Dynamic context injection
echo "Schema: $(cat prisma/schema.prisma | head -20)"
\`\`\`Skill Frontmatter Fields
| Field | Type | Purpose |
|---|---|---|
name | string | Skill identifier |
description | string | What it does |
user-invocable | bool | Can user run it? |
disable-model-invocation | bool | Model can't call it |
allowed-tools | string[] | Tool whitelist |
model | string | Force model (haiku/sonnet/opus) |
effort | string | Task difficulty (low/medium/high/max) |
context | string | fork = subagent isolation |
hooks | object[] | Trigger on events |
paths | string[] | File globs (scope) |
shell | object | Shell environment vars |
Dynamic Context: Code Injection
$ARGUMENTS[0] # First parameter
${CLAUDE_SESSION_ID} # Current session UUID
${CLAUDE_SKILL_DIR} # Skill directory path
!`git log -1 --oneline` # Shell output injectionSkill Scope Priority
- Enterprise (global across org)
- Personal (~/.claude/skills/)
- Project (.claude/skills/)
- Plugin (npm packages)
Layer 3: Hooks — Guardrail Layer
Hooks intercept Claude Code at specific points:
{
"hooks": [
{
"event": "PreToolUse",
"pattern": "bash.*rm.*-rf",
"action": "ask"
},
{
"event": "PostToolExecution",
"pattern": "git.*commit",
"action": "notify"
}
]
}Hook Events:
PreToolUse— Before shell commandPostToolExecution— After command runsPreCommit— Git commit safetyPreFileDeletion— File deletion warningMissingFile— File not foundNotification— Slack/webhook alerts
Layer 4: Subagents — Delegation Layer
Isolate context. Run agents in parallel.
---
context: fork # Runs in isolated subagent
---
This skill always runs in a fresh context
with its own memory and filesystem scope.Built-in Agent Types:
- Explore agent (search codebases, summarize)
- Plan agent (break tasks into steps)
- General-purpose agent (default)
Parallel Execution:
/batch \
"Implement auth module" \
"Set up database migrations" \
"Build API endpoints"Running 3 agents simultaneously = 3x token cost but saves wall-clock time.
Layer 5: Plugins — Distribution Layer
Bundle and share skills as npm packages.
{
"name": "@acme/claude-skills",
"version": "1.0.0",
"skills": {
"db-migrate": "./skills/db-migrate.md",
"deploy": "./skills/deploy.md"
}
}Install:
claude plugin add @acme/claude-skillsBundled Skills (Pre-Loaded)
| Skill | Command | Purpose |
|---|---|---|
| Batch | /batch | Parallel agents |
| Simplify | /simplify | 3-agent code review |
| Debug | /debug | Interactive debugger |
| Loop | /loop | Agentic loop for complex tasks |
| Claude API | /claude-api | API reference loader |
Putting It Together: A Real Example
Project Structure:
├── CLAUDE.md # Layer 1: Memory
├── .claude/
│ ├── skills/
│ │ ├── db-migrate.md # Layer 2: Skills
│ │ └── deploy.md
│ ├── settings.json # Layer 3: Hooks
│ └── .mcp.json # MCP config
├── .git/
└── src/
User runs: claude "Add user authentication"
Agent process:
- Reads CLAUDE.md (constraints, tech stack)
- Checks hooks (pre-tool safety rules)
- Searches for relevant Skills
- Creates plan (ask for approval)
- Forks subagent if using isolation
- Executes with fallback to Layer 2, 3 constraints
- Logs via Hooks (Layer 3)
Composition Benefits
✅ Reusable knowledge (Skills)
✅ Safety guardrails (Hooks)
✅ Scalability (Plugins)
✅ Isolation (Subagents)
✅ Governance (CLAUDE.md)
Next: Explore Architecture for runtime details.