Agent skill · software engineering · aradotso
collection-claude-code-source-code
collection-claude-code-source-code — an agent skill for coding agents.
Why this skill is useful
Provides a detailed analysis and executable TypeScript and Python code that can be directly used to replicate and understand the architecture of a production AI coding agent.
What it needs
Requires git, npm installed locally. Requires anthropic account access. About 6k 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 source (v2.1.88) │ └── src/ │ ├── main.tsx # CLI entry + REPL bootstrap (~4,683 lines) │ ├── query.ts # Core agent loop (~785KB) │ ├── QueryEngine.ts # SDK/Headless query lifecycle │ ├── Tool.ts # Tool interface + buildTool factory │ ├── commands.ts # Slash command definitions (~25K lines) │ ├── tools/ # 40+ tool implementations │ ├── components/ # React/Ink terminal UI │ ├── services/ # Business logic layer │ ├── coordinator/ # Multi-agent coordination │ ├── memdir/ # Long-term memory management │ └── plugins/ # Plugin system ├── claw-code/ # Clean-room Python rewrite (66 files) └── docs/ # Analysis docs (English + Chinese) ├── en/ └── zh/ bash Clone the collection git clone https://github.com/chauncygu/collection-claude-code-source-code.git cd collection-claude-code-source-code Install the actual Claude Code CLI (official) npm install -g @anthropic-ai/claude-code Or explore the TypeScript source directly cd claude-code-source-code npm install bash export ANTHROPICAPIKEY=yourkeyhere typescript // Simplified representation of the main agent loop pattern from query.ts async function query( input: UserInput, context: AgentContext ): AsyncGenerator<SDKMessage> { // 1. Assemble system prompt const systemPromptParts = await fetchSystemPromptParts(context); // 2. Stream Claude API response const stream = client.messages.stream({ model: context.model, system: systemPromptParts.join('\n'), messages: context.history, tools: context.tools, }); // 3. Execute tools in parallel as they arrive const executor = new StreamingToolExecutor(); for await (const event of stream) { if (event.type === 'tooluse') { yield executor.run(event, context); } else { yield event; } } // 4. …
How to use it
Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:
@skills aradotso/collection-claude-code-source-code