A 17-lesson Python tutorial that builds a Claude Code-like agent harness from scratch, starting with a single loop and bash.
ghuntley/how-to-build-a-coding-agent
A step-by-step Go workshop that teaches you to build a coding agent on the Claude API, adding file, shell and search tools one at a time.
- Stars
- 5,907
- Forks
- 668
- Open issues
- 8
- Last commit
- 3 days ago
What is it?
This is a hands-on workshop for building your own AI coding assistant in Go. It starts with a basic chatbot that talks to Claude through the Anthropic API, then adds tools one at a time: reading files, listing directories, running shell commands, editing files, and searching code with ripgrep.
Each stage is a standalone Go program such as chat.go, read.go or edit_tool.go, so you can run and compare every version. The workshop explains the core event loop, where user input goes to the model, tool calls are executed, and results are sent back until Claude gives a final answer. It also shows how tools are defined with a name, an input schema generated from Go structs, and a function.
The project is aimed at developers who want to understand how agents like Cline, Cursor or Claude Code work internally, and it requires an Anthropic API key to run.
Key features
- 01Builds six progressive versions of a coding agent in Go.
- 02Connects to the Anthropic Claude API with a basic chat loop.
- 03Provides file reading, directory listing, shell command, file editing and code search tools.
- 04Generates tool input schemas from Go structs.
- 05Includes a verbose mode for detailed logs and sample files to experiment with.
Use cases
- Learning how AI coding agents such as Cline or Cursor work internally.
- Building a custom local developer assistant with your own tools.
- Teaching Go developers the basics of LLM tool calling.
Quick start
- 1
Enter the devenv dev environment (recommended)
devenv shell - 2
Or install Go dependencies manually
go mod tidy - 3
Export your Anthropic API key
export ANTHROPIC_API_KEY="your-api-key-here" - 4
Run the basic chat program
go run chat.go
Things to know
- Requires a paid Anthropic API key to use Claude.
- The repository has no license specified.
Topics
FAQ
- What is how-to-build-a-coding-agent?
- A step-by-step Go workshop that teaches you to build a coding agent on the Claude API, adding file, shell and search tools one at a time. This is a hands-on workshop for building your own AI coding assistant in Go. It starts with a basic chatbot that talks to Claude through the Anthropic API, then adds tools one at a time: reading files, listing directories, running shell commands, editing files, and searching code with ripgrep.
- Is how-to-build-a-coding-agent free to use? What license does it have?
- how-to-build-a-coding-agent has no declared license. Its code is public, but without a license you have no explicit permission to reuse it; ask the author before relying on it.
- Is how-to-build-a-coding-agent still maintained?
- Actively maintained. The last commit to how-to-build-a-coding-agent was on Oct 17, 2026.
- What can I use how-to-build-a-coding-agent for?
- Learning how AI coding agents such as Cline or Cursor work internally. Building a custom local developer assistant with your own tools. Teaching Go developers the basics of LLM tool calling.
- How do I install how-to-build-a-coding-agent?
- Enter the devenv dev environment (recommended): devenv shell Or install Go dependencies manually: go mod tidy Export your Anthropic API key: export ANTHROPIC_API_KEY="your-api-key-here" Run the basic chat program: go run chat.go
- Where can I get how-to-build-a-coding-agent?
- The source code and installation instructions are on GitHub: https://github.com/ghuntley/how-to-build-a-coding-agent
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
A hands-on Vibe Coding course that teaches non-programmers and developers to build real AI-assisted products from idea to launch.
Self-hosted control center for running coding agents like OpenHands, Claude Code and Codex across local, remote and cloud backends.
A TypeScript coding agent CLI where a single 'ulw' or 'mass ulw' keyword in your prompt makes it plan, delegate to multiple models, and verify the work.
An open-source AI coding agent that runs in your terminal, with companion desktop, web, editor, and chat interfaces.
A Go framework for building LLM applications and AI agents, with composable components, graph orchestration, and human-in-the-loop interrupts.