By Kodelyth · updated · v2.30.0
The Claude Code Toolkit
Claude Code ships with six extension primitives: agents, skills, slash commands, hooks, rules, and MCP. A toolkit is what you get when you compose them. This page is the reference for what each primitive does, where Claude Code looks for them, how they layer, and when to extend each one.
The six primitives
1. Agents
Markdown files in ~/.claude/agents/ (or <project>/.claude/agents/) that
define a persona + methodology. When Claude recognises an agent
should take over (via intent routing or explicit use <agent>), it loads
that file and behaves as that specialist for the turn.
Shape:
---
name: debug-detective
description: Master-level root cause analyst. Traces every bug to its exact origin through evidence and logic.
tools: Read, Grep, Glob, Bash
model: sonnet
---
# Debug Detective
You are a decade-seasoned engineer who has debugged production incidents...
## Your methodology
1. Reproduce the bug deterministically...
2. Form hypotheses, then find evidence...
3. Never guess; never patch symptoms...Front-matter defines the API; the body is the behaviour. Keep agents focused — one job well, not a kitchen sink.
2. Skills
Markdown files in ~/.claude/skills/<name>/SKILL.md that teach Claude a
specific workflow. Unlike agents, skills are loaded on demand when the
task matches — the skill-matching layer sees the task and dispatches the
right skill into context.
Shape:
---
name: tdd-workflow
description: Write-tests-first methodology with red/green/refactor enforcement.
---
# TDD workflow
When to use: adding new behaviour, fixing a bug that lacks a test...
## Red
1. Write the failing test...Skills are composable — multiple skills can be loaded in one turn when multiple match. Agents are singular — one agent per turn.
3. Slash commands
Markdown files in ~/.claude/commands/ that turn into user-typed /name
triggers. A slash command bundles a predefined prompt + context + optional
agent dispatch.
Shape:
---
name: team-review
description: Parallel-fire code-reviewer + security-reviewer + performance-optimizer + api-guardian on current changes.
---
Dispatch the four reviewers in parallel against the current git diff...Slash commands are the UX layer for repeated operations. /tdd,
/team-review, /devil-mode, /debug-blitz — each one would be a 3-step
manual prompt otherwise.
4. Hooks
JSON config in ~/.claude/settings.json that runs commands around tool
use. Events: PreToolUse, PostToolUse, Stop, SessionStart,
UserPromptSubmit, and more.
Shape:
{
"hooks": {
"PostToolUse": [
{
"matcher": "Write|Edit",
"command": "node ~/.claude/hooks/format-after-edit.js"
}
]
}
}Hooks are how you automate behaviour Claude would otherwise need to remember.
A format-after-edit hook runs the formatter whether Claude asks or not. A
PreToolUse hook that rewrites git status → rtk git status is how
Kodelyth ECC gets its token savings.
5. Rules
Markdown files in ~/.claude/rules/common/ (or a language subdirectory)
that get loaded into every session as always-on context. Rules are
where your style guide, ban-list, and project conventions live.
Shape:
# Agent intent routing
When a user's message matches these patterns, route to the right specialist...Rules compose: all .md files in rules/common/ are concatenated into
context. Keep them short — every line is paid for on every turn.
6. MCP servers
External processes registered in ~/.claude.json (user-level) or
<project>/.mcp.json (project-level) that expose tools, resources, and
prompts to Claude over stdio JSON-RPC.
Shape:
{
"mcpServers": {
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": { "GITHUB_PERSONAL_ACCESS_TOKEN": "..." }
}
}
}MCP is how Claude reaches out of its sandbox — read your DB, list your PRs, search the web, run a local shell tool. See the MCP Server Guide for the full reference.
Directory layout
~/.claude/
├── agents/ # 71 ECC agent files + your own
│ ├── debug-detective.md
│ ├── code-reviewer.md
│ └── ...
├── skills/ # 196 ECC skill folders + your own
│ ├── tdd-workflow/
│ │ └── SKILL.md
│ └── ...
├── commands/ # 104 ECC slash commands + your own
│ ├── tdd.md
│ ├── team-review.md
│ └── ...
├── hooks/ # ECC's 9 hook scripts (44 entries across 8 events)
│ ├── format-after-edit.js
│ ├── pre-tool-use-rtk.js
│ └── ...
├── rules/
│ └── common/ # 15 ECC rules + your own
│ ├── agent-intent-routing.md
│ ├── self-improvement-workflow.md
│ └── ...
├── settings.json # Hooks config + model prefs
└── CLAUDE.md # Your personal always-on contextProject-level (in <project>/.claude/) has the same structure and
overrides user-level with the same name. A project agents/debug- detective.md replaces the user-level one for that project.
settings.json composition
Claude Code loads settings from three places, in order:
~/.claude/settings.json— user-level, applied in every session<project>/.claude/settings.json— project-level, overrides user- Environment variables + CLI flags — override everything
Hooks from user and project level concatenate (you get both), with project-level firing after user-level for the same event. MCP servers merge by name — same name at project level replaces user-level.
Intent routing — the glue layer
The rules/common/agent-intent-routing.md rule (ECC's default; you can
replace it) teaches Claude to read the user's message and route to the
right specialist before generating a response. The rule contains 10
priority tiers of signals:
- Crisis & emotional signals (
"I'm stuck","I don't know where to start") - Active pain (bug report, error message, "something broke")
- Quality & review (
"review this","before I merge") - Performance & scale (production down, slow, bottleneck)
- Planning & architecture
- Testing
- Code hygiene
- Documentation
- Specialized workflows
- Multi-agent patterns
When any trigger matches, Claude emits → Routing to <agent> and behaves as
that specialist for the response. No use <agent> syntax required.
This is the single highest-leverage part of a Claude Code toolkit: it eliminates the need to remember agent names, and makes the specialist catalog usable by anyone on the team.
How ECC's specific wiring works
ECC's 6 primitives, in one line each:
- 71 agents — specialists selectable by intent routing. Install: copied to
~/.claude/agents/. - 196 skills — workflows dispatched by skill-match. Install: copied to
~/.claude/skills/. - 104 slash commands —
/tdd,/team-review,/devil-mode, etc. Install: copied to~/.claude/commands/. - 44 hook entries across 8 events — memory capture, prompt-injection guard, token-budget enforcer, correction encoding. Install: hooks copied to
~/.claude/hooks/, entries added to~/.claude/settings.json. - 15 rules — intent routing, memory protocol, self-improvement workflow, coding style. Install: copied to
~/.claude/rules/. - MCP server — exposes the entire catalog + local Memory Core as 16 tools + 6 prompts + 389 resources. Install: ECC's MCP server auto-registered in
~/.claude.json.
Plus three layers you won't find in a hand-rolled CLAUDE.md:
- Memory Core — local BM25 memory keyed by git remote.
UserPromptSubmithook auto-recalls relevant past solutions;Stophook captures new ones on success signal. - RTK — PreToolUse hook rewrites noisy shell commands
(
git status,cargo test,docker ps, 100+ more) through the RTK filter. 60-90% input token reduction per command. - Terse mode — slash command
/terse [lite|full| ultra]activates output compression that preserves code byte-exact. 40-70% output token reduction.
When to extend each primitive
| Need | Extend |
|---|---|
| "I want Claude to act like a decade-seasoned Postgres specialist for schema design" | Agent |
| "I want Claude to follow TDD/red-green-refactor when adding features" | Skill |
"I want /ship to run tests + build + commit + push with my conventions" | Slash command |
| "I want my formatter to run every time Claude edits a file" | Hook |
| "I want Claude to always use pnpm, never npm" | Rule |
| "I want Claude to read my Postgres schema when reasoning about data" | MCP server |
A new primitive is almost always the right answer when the behaviour needs to persist across sessions. One-off prompting works for one task; a primitive earns its keep when you'd write the same instruction a tenth time.
Honest limits and costs
- Every rule is paid for on every turn. Rules are concatenated into system context on every message. A bloated rules directory is a quiet tax. ECC's 15 rules total about 60KB; your own additions should be similarly tight.
- Agent + skill matching is a prompt layer. Routing accuracy depends on the LLM. ECC's intent-routing rule is explicit about the 10-tier priority to minimise ambiguity; expect ~90% accuracy on clean signals, lower on mixed ones.
- Hooks block tool execution. A slow
PostToolUsehook (e.g., a full test suite) will feel sluggish. Keep hooks fast; useStopfor expensive verification instead. - MCP servers are external processes. Each adds startup time and a surface the model sees; keep the list curated.
Compared to a hand-written CLAUDE.md
A single CLAUDE.md is fine for small projects. Here's when it stops scaling:
| Symptom | Toolkit answer |
|---|---|
| CLAUDE.md is over 500 lines and growing | Split into rules in rules/common/ |
| You paste the same multi-step prompt weekly | Make it a slash command |
| You wish Claude knew to run the formatter | Add a PostToolUse hook |
| You keep forgetting which specialist to invoke | Install an intent-routing rule + agent catalog |
| You lose past solutions between sessions | Add a Memory layer (ECC's Memory Core) |
| Multiple AI tools, different configs | Standardise on the ECC catalog across all of them |
Related reading
- /docs/mcp-server-guide — the MCP primitive in depth.
- /docs/intent-routing — ECC's routing rule.
- /docs/reduce-claude-code-token-cost — how the toolkit's RTK + Terse + graph layers cut cost.
- /docs/autonomous-agent-orchestration — orchestration on top of the toolkit.
- /docs/ecc-vs-plain-claude-code — honest side-by-side.
One-command start
npm i -g kodelyth-ecc
kodelythecc --target claude-code --codebase-graphRestart Claude Code. The 6 primitives are now populated — 71 agents, 196 skills, 104 commands, 44 hook entries, 15 rules, and ECC's MCP server. Your own CLAUDE.md, agents, hooks, and MCP servers are untouched; ECC installs alongside, not instead.