Two essential resources for mastering Claude Code: a 45-tip practical guide (ykdojo) covering everything from custom status lines to containerized agents, and a deep engineering article (tw93) dissecting Claude Codeβs six-layer architecture, context management, and why most problems arenβt about the model being dumb β theyβre about feeding it the wrong context.
| *Source: 45 Claude Code Tips - ykdojo | Claude Code Architecture & Engineering - tw93 | BrightCoding: 45 Tricks for Terminal AI Mastery* |
The Six-Layer Architecture (tw93)
Most people treat Claude Code as a chatbot. Itβs actually a six-layer system β and strengthening only one layer while ignoring others causes the system to fail:
| Layer | Role | What It Controls |
|---|---|---|
CLAUDE.md / rules / memory |
Long-term context | βWhat Claude isβ β constraints, boundaries, project rules |
Tools / MCP |
Action capabilities | βWhat Claude can doβ β read files, run commands, access APIs |
Skills |
On-demand workflows | βHow Claude does itβ β loaded only when needed |
Hooks |
Forced execution | Deterministic rules that donβt depend on Claudeβs judgment |
Subagents |
Isolated workers | Separate context windows for contained tasks |
Verifiers |
Validation loop | Tests, lint, screenshots, CI β making output trustworthy |
Collect Context β Take Action β Verify Result β [Done or Loop Back]
β β
CLAUDE.md Hooks / Permissions
Skills Tools / MCP
Memory Subagents
Context Engineering β The Most Important Skill
The #1 insight from both resources: context problems are usually noise, not capacity. Your 200K window isnβt all available:
200K Total Context
βββ Fixed Overhead (~15-20K)
β βββ System prompt: ~2K
β βββ Skill descriptors: ~1-5K
β βββ MCP tool definitions: ~10-20K β BIGGEST HIDDEN COST
β βββ LSP state: ~2-5K
βββ Semi-fixed (~5-10K)
β βββ CLAUDE.md: ~2-5K
β βββ Memory: ~1-2K
βββ Dynamic (what you actually get: ~160-180K)
βββ Conversation history
βββ File contents
βββ Tool call results
Eye-opener: 5 MCP servers = ~25,000 tokens fixed overhead (12.5% of your context gone before you type anything).
Context Best Practices
| Practice | Why |
|---|---|
| Keep CLAUDE.md short, hard, executable | Anthropicβs own is ~2.5K tokens |
Use .claude/rules/ for path-specific rules |
Donβt bloat root CLAUDE.md |
| Write Compact Instructions in CLAUDE.md | Control what survives compression |
Use /clear on task switch, /compact within a task |
Fresh context > stale context |
| HANDOFF.md pattern for session transfers | Donβt rely on auto-compression quality |
Limit tool output with \| head -30 or RTK |
Tool output is a hidden context killer |
Top Practical Tips (from 45 Tips)
For Beginners
| Tip | What It Does |
|---|---|
| Custom status line | Shows model, git branch, token usage at bottom of terminal |
| Voice input | 2-3x faster than typing β use superwhisper or built-in voice mode |
| Break down problems | A β A1 β A2 β A3 β B instead of A β B directly |
| Git & GitHub CLI | Let Claude handle commits, branches, draft PRs |
/clear and /compact |
Fresh context performs better than long stale sessions |
For Intermediate Users
| Tip | What It Does |
|---|---|
| HANDOFF.md pattern | Write progress doc before switching sessions β next agent reads only this |
| Plan Mode | Separate exploration (read-only) from execution (changes) |
| Git worktrees | Parallel branch work β different features, different directories |
| TDD with Claude | Write tests first, then implementation β Claude excels at this |
| Containers | Run risky/long tasks in Docker β safe sandbox for experiments |
For Advanced Users
| Tip | What It Does |
|---|---|
| Slim system prompt | Cut system prompt by ~45% to free context for actual work |
| Subagents for isolation | Exploration tasks in subagents keep main context clean |
| Hooks for governance | Auto-format on edit, block protected files, notify on completion |
| Skill design patterns | Checklist, workflow, and domain-expert types with supporting files |
| Prompt caching awareness | Understand prefix-match caching to avoid breaking cache hits |
| dx plugin | Install with claude plugin install dx@ykdojo β adds /handoff, /clone, /gha |
Three-Layer Governance: CLAUDE.md + Skills + Hooks
This pattern from tw93 is critical β using only one layer leaves gaps:
CLAUDE.md β "Commits must pass tests and lint" (declaration)
β
Skill β "Run tests in this order, read (workflow)
failures, fix, re-run"
β
Hook β "After every Edit on *.rs, (enforcement)
run cargo check | head -30"
- CLAUDE.md alone: Claude often ignores rules
- Hooks alone: Canβt handle complex judgment calls
- All three together: Declarations + workflows + enforcement = stable system
Concept Boundaries β What Goes Where
| Concept | Use When | Common Mistake |
|---|---|---|
CLAUDE.md |
Project-level permanent rules | Writing a knowledge base instead of constraints |
.claude/rules/* |
Path/language-specific rules | Dumping everything in root CLAUDE.md |
Tools / MCP |
Need new action capability | Connecting too many servers (context bloat) |
Skills |
Need on-demand workflow/knowledge | Making skills that are encyclopedias |
Hooks |
Need deterministic enforcement | Using hooks for complex semantic judgment |
Subagents |
Need isolated context for a task | No boundary constraints (fan-out chaos) |
Plugins |
Need to distribute skills/hooks/MCP | Treating plugins as runtime primitives |
Real-World Use Cases
- Teaching students how to manage Claude Code context budgets during multi-file projects.
- Building class demos around hooks, skills, subagents, and verification loops.
- Creating team workflows for agent-assisted software engineering assignments.
How LearnAI Team Could Use This
These two resources are a masterclass in understanding how AI agent systems actually work β not just using them, but understanding the engineering behind them:
- Context engineering teaches resource management β understanding token budgets is like understanding memory management in systems programming
- The six-layer architecture maps directly to software architecture courses β separation of concerns, layered design, isolation patterns
- Hooks and verification teach the same principles as formal verification and program analysis β ensuring correctness through systematic enforcement rather than hoping the system behaves
- The HANDOFF.md pattern teaches documentation and knowledge transfer β a skill every engineer needs
- TDD with Claude (Tip 34) reinforces test-driven development in a context where students can see immediate results
- Skill design patterns (checklist, workflow, domain-expert) are the same design pattern thinking taught in software engineering courses
For AI education research: these resources demonstrate that effective AI tool usage requires engineering discipline, not just prompt writing. The gap between βusing Claude Code as a chatbotβ and βbuilding a governed AI development systemβ is exactly the kind of skill gap LAI research can help bridge.
Install the dx Plugin
claude plugin marketplace update ykdojo
claude plugin install dx@ykdojo
Adds /handoff, /clone, /half-clone, and /gha commands. See dx plugin details.