Agent skill · research science · aradotso

how-claude-code-works

how-claude-code-works — an agent skill for coding agents.

Why this skill is useful

Provides deep insights into Claude Code's architecture and internals, including multi-agent coordination and security mechanisms, which are not commonly available in public documentation.

What it needs

About 8k tokens when loaded. Last updated 2026-07-09. 70 stars on the source repository.

What this skill does

bash git clone https://github.com/Windy3f3f3f3f/how-claude-code-works cd how-claude-code-works Open docs/ folder — plain Markdown, readable in any editor User Input │ ▼ QueryEngine (session management) │ ▼ query() main loop ◄──────────────────────┐ │ │ ▼ │ Claude API (streaming) │ │ │ ├─► Text tokens → stream to terminal │ │ │ └─► Tool calls → ToolExecutionEngine │ │ │ ├─ ReadFile │ ├─ EditFile │ ├─ Shell │ ├─ Search │ └─ MCP Tools │ │ │ └─ results ────────┘ Context Engineering layer feeds: System prompt Git status CLAUDE.md files Compression pipeline Level 1: TRUNCATE └─ Cut large tool outputs in older messages (fast, lossy for old data) Level 2: DEDUPLICATE └─ Remove repeated content (near-zero cost) Level 3: FOLD └─ Collapse inactive conversation segments (reversible, content intact) Level 4: SUMMARIZE └─ Launch sub-agent to summarize entire conversation (last resort) typescript interface Tool { name: string; description: string; inputSchema: ZodSchema; execute(input: unknown, context: ToolContext): Promise<ToolResult>; readonly: boolean; // true = can run in parallel requiresPermission: boolean; } Layer 1: Permission Mode └─ Trust level restricts available operation classes Layer 2: Rule Matching └─ Command pattern whitelist/blacklist Layer 3: Bash AST Analysis (tree-sitter) └─ 23 safety checks on parsed shell AST, not regex: Command injection detection Env variable leak detection Special character attacks Pipe chain analysis Layer 4: User Confirmation └─ Dangerous ops require explicit confirm 200ms debounce prevents accidental keypress confirmation Layer 5: Hook Validation └─ User-defined rules, can mutate tool inputs (e.g. …

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills aradotso/how-claude-code-works

View the source on GitHub

Browse the @skills marketplace