Agent skill · research science · aradotso

claude-code-source-analysis

claude-code-source-analysis — an agent skill for coding agents.

Why this skill is useful

Provides a comprehensive repository of decompiled source code and a Python reimplementation, enabling deep exploration and extension of Claude Code's architecture and functionality.

What it needs

Requires git, npm, pip installed locally. About 8k tokens when loaded. Last updated 2026-07-09. 70 stars on the source repository.

What this skill does

collection-claude-code-source-code/ ├── claude-code-source-code/ # Decompiled TypeScript (v2.1.88) │ └── src/ │ ├── main.tsx # CLI entry + REPL bootstrap │ ├── query.ts # Core agent loop (785KB) │ ├── QueryEngine.ts # SDK/Headless lifecycle engine │ ├── Tool.ts # Tool interface + buildTool factory │ ├── commands.ts # Slash command definitions │ ├── tools/ # 40+ tool implementations │ ├── commands/ # ~87 slash command handlers │ ├── components/ # React/Ink terminal UI │ ├── services/ # Business logic layer │ ├── coordinator/ # Multi-agent coordination │ ├── memdir/ # Long-term memory management │ └── plugins/ # Plugin system ├── claw-code/ # Python clean-room rewrite (66 files) └── docs/ # Bilingual analysis (en/ + zh/) bash Clone the repository git clone https://github.com/chauncygu/collection-claude-code-source-code.git cd collection-claude-code-source-code Explore the TypeScript source cd claude-code-source-code npm install # if package.json dependencies are needed for tooling Work with the Python rewrite cd ../claw-code pip install -r requirements.txt typescript // Simplified agent loop pattern from query.ts async function query( userMessage: string, context: ConversationContext, tools: Tool[], ): AsyncGenerator<SDKMessage> { // 1. Assemble system prompt from parts const systemPromptParts = await fetchSystemPromptParts(context); // 2. Run streaming tool executor with auto-compaction const executor = new StreamingToolExecutor(tools); while (true) { const response = await callClaude({ systemPromptParts, userMessage, tools }); // 3. Yield streamed messages back to consumer for await (const chunk of response) { yield chunk; } // 4. Execute tool calls in parallel const toolResults = await executor.runTools(response.toolCalls); // 5. …

How to use it

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

@skills aradotso/claude-code-source-analysis

View the source on GitHub

Browse the @skills marketplace