Understanding How Claude Code Works Better Than 99% of Users
Based on Mark's "How Claude Code Actually Works" Video
Extract every principle from Mark's video into actionable steps. Understand architecture, tooling, context management, and advanced techniques.
Goal: Understand foundational architecture and how components interact
beginner-friendly 15-20 minWhat makes Claude Code work:
Claude Code = Smart engineering + Open-source tools + Claude API. Anthropic didn't reinvent wheelsβthey connected existing tools to AI reasoning.
# View architecture in action /context # Shows: # - System prompt overhead # - claude.md impact # - Current token usage
Every Claude Code operation follows this pattern:
@claude_code_guide Explain the gather-act-verify loop with a real coding example
Goal: Master the most important constraintβyour 200k token "bucket"
must-master 30-35 minYour context window is a bucket:
After 50% context usage, Claude gets lazier, makes more errors, forgets earlier decisions. Manage your bucket aggressively.
Token consumption ranked (worst first):
Reading a 50-page economic report consumed 100% context in ONE operation. Solution: External API (Gemini) + markdown summary.
# Solution: Offload to Gemini 2.5 Flash "Create a skill that: 1. Uses Gemini API (1M context window) 2. Reads large PDF 3. Converts to markdown (strips metadata) 4. Returns summary only 5. Preserves my Claude context"
Use Gemini/GPT for large doc processing, return summary only
Virgin 200k context for exploration β report back summary
Terminal 1: Frontend | Terminal 2: Backend | Terminal 3: Testing
Keep under 2k tokens. Use as routing document, not knowledge dump.
Read my claude.md. Tell me: 1) Token count? 2) What's bloated? 3) How to compress under 2k tokens?
Goal: Master how Claude uses file tools efficiently
intermediate 25-30 minHow to avoid nuking context:
Reading a 50-page PDF = 1.8M tokens. Your bucket only holds 200k. Use external APIs instead.
# Bad: Direct PDF read β # This nukes your context instantly # Good: External API β "Create Python script: - Uses Gemini 2.5 Flash API - Reads PDF - Strips metadata - Returns markdown summary"
Glob: Pattern-based file finding
*.ts # All TypeScript files **/*.jsx # All JSX in any folder src/**/*.js # All JS under src/
Grep (ripgrep): Fast codebase search
Claude searches in phases: 1) Find files with keyword, 2) Search within files, 3) Read only relevant sections. This preserves context.
Goal: Understand bash power and risks
high-risk 20-25 minBash can nuke your laptop. Always use "Ask before edits" mode when starting out.
Three modes:
Start with "Ask" mode to learn patterns. After 10-20 sessions, enable YOLO for speed.
Goal: Master advanced customization
advanced 35-40 minWhy skills over MCPs?
Mark went from 10 MCPs to 1-3. If you're not using an MCP constantly, make it a skill to save context.
Use cases:
"Spin up sub-agent to explore backend: 1. All API endpoints 2. Database models 3. Key dependencies Report back summary only"
Goal: Master the persistent instruction file
leverage-point 25-30 minFirst thing Claude reads every session
A 10k token claude.md = 5% context usage at startup. Keep it under 2k tokens.
Use claude.md as index, not encyclopedia:
# In claude.md (routing): "For LinkedIn posts, read linkedin-playbook.md" "For API design, consult api-guidelines.md" "Database changes require db-schema.md first" # This keeps claude.md tiny # While preserving access to deep knowledge
Goal: Understand state, persistence, multi-terminal workflows
practical 20-25 minPersists:
Doesn't persist:
Why separate terminals?
# 3-terminal setup: Terminal 1: Frontend React work Terminal 2: Backend API Terminal 3: Testing & deployment # Each = independent 200k context
Goal: Balance safety with productivity
security 20-25 minSecurity rules:
ALWAYS use "Ask" mode or custom whitelists in production. YOLO = solo dev only.
Goal: Synthesize everything into production-grade workflows
mastery 30-35 minFull workflow:
# GATHER - Glob: Find *.tsx files - Grep: Search for "login" - Read: LoginButton.tsx only # ACT - Edit: Fix onClick typo (onClic β onClick) # VERIFY - Run: npm test - Bash: Start localhost:3000 - Verify: Click button (works!) - Git: Commit fix # Context impact: ~5,500 tokens (~3%)
Smart tool usage: Found issue with <10k tokens instead of reading entire 50k+ codebase.
Problem: 50,000-line codebase to understand
Solution: Multi-phase with sub-agents
# Phase 1: Overview (main session) "High-level folder structure and components?" # Phase 2: Parallel exploration (sub-agents) Terminal 2: Explore frontend/ β report components Terminal 3: Explore backend/ β list API endpoints Terminal 4: Explore tests/ β summarize coverage # Phase 3: Synthesize (main session) Each sub-agent reports SUMMARY only Main session builds mental model Create architecture.md for reference # Context preserved: Exploration in sub-agents!
For complex builds exceeding context:
# Session 1: Planning "Use Plan Mode to design auth system: - Email/password login - OAuth (Google, GitHub) - Password reset - Session management Create detailed plan" # After plan complete: /clear # Session 2: Execution (fresh context) "Execute the auth plan in plan.md"
Benefits of exploration WITHOUT context cost during execution. Start building with fresh bucket.
Before ending session:
# Checklist: 1. Update claude.md with learnings 2. Create playbook.md for complex workflows 3. Commit key files to git 4. Update TODO.md with next steps # Example prompt: "Before ending, create summary: 1. What we accomplished 2. Key decisions made 3. What to update in claude.md 4. Next steps"
Essential Links:
@claude_code_guide [question]