This repo contains solutions to CodeCrafters' "Build Your own Claude Code" challenge, implemented in two languages:
codecrafters-claude-code-go/— Go solutioncodecrafters-claude-code-python/— Python solution
The challenge is to build a minimal, working clone of Claude Code — an
LLM-powered coding assistant that can read files, write files, and run shell
commands on request. Each solution sends prompts to an LLM (via the
OpenRouter API, using an OpenAI-compatible
chat.completions interface) and drives an agent loop:
- Send the conversation history + available tool specs to the model.
- If the model responds with
tool_calls, execute the requested tool(s) locally (Read,Write,Bash) and feed the results back astoolmessages. - Repeat until the model replies with plain text instead of a tool call, then print that as the final answer.
Each solution directory is a self-contained CodeCrafters project with its own
app/ entry point, codecrafters.yml config, and your_program.sh runner:
| Directory | Entry point | Status |
|---|---|---|
codecrafters-claude-code-go |
app/main.go |
Early stage — first-stage response handling only |
codecrafters-claude-code-python |
app/main.py |
Further along — full agent loop with Read, Write, and Bash tools |
See codecrafters-claude-code-python/NOTES.md
for detailed notes on how tool calling and the agent loop are implemented.
Each subdirectory has its own your_program.sh. For example, from
codecrafters-claude-code-python:
export OPENROUTER_API_KEY=...
./your_program.sh -p "Summarize the README for me."Both solutions require an OPENROUTER_API_KEY environment variable (and
optionally OPENROUTER_BASE_URL, which defaults to OpenRouter's API).
Note: If you're viewing this on GitHub, head over to codecrafters.io to try the challenge yourself.