how-to-build-a-coding-agent
A workshop that teaches you how to build your own coding agent. Similar to Roo code, Cline, Amp, Cursor, Windsurf or OpenCode.
File Explorer
- 00-weather.md
- 01-read_file.md
- 02-list_files.md
- 03-bash_tool.md
- 04-edit_tool.md
- .envrc
- .gitignore
- AGENT.md
- bash_tool.go
- chat.go
- code_search_tool.go
- devenv.lock
- devenv.nix
- devenv.yaml
- edit_tool.go
- go.mod
- go.sum
- list_files.go
- Makefile
- read.go
- README.md
- renovate.json
- riddle.txt
# Installation Guide
go- Go 1.24.2+
- devenv
- Anthropic API Key
Setup Steps
devenv shell
Load the development environment using devenv.
go mod tidy
Tidy and download Go module dependencies.
export ANTHROPIC_API_KEY="your-api-key-here"
Set the Anthropic API key environment variable.
go run chat.go
Run the basic chat agent.
Key Commands
go mod tidy
Synchronize Go module dependencies for the project.
go run chat.go
Run the basic chatbot application.
go run read.go
Run the agent with file reading capabilities.
go run list_files.go
Run the agent with directory listing capabilities.
go run bash_tool.go
Run the agent with shell command execution capabilities.
go run edit_tool.go
Run the agent with file editing capabilities.
go run code_search_tool.go
Run the agent with code search capabilities.
# Use via CDN
jsDelivrjsDelivr serves any public GitHub repository as a CDN with zero setup. Pick a version and a file to get a ready-to-paste link and snippet.
Command Glossary
Commands referenced in this DOCs, explained below.
devenv
View Details ▼
devenv
Fast, declarative, reproducible, and composable developer environments using Nix.
devenv init
Initialize the environment:
devenv shell --impure
Enter the Development Environment with relaxed hermeticity (state of being airtight):
devenv info --verbose
Get detailed information about the current environment:
go mod
View Details ▼
go mod
Module maintenance.
go mod init {{module_name}}
Initialize new module in current directory:
go mod download
Download modules to local cache:
go mod tidy
Add missing and remove unused modules:
go run
View Details ▼
go run
Compile and run Go code without saving a binary.
go run {{path/to/file.go}}
Run a Go file:
go run {{path/to/package}}
Run a main Go package:
hello
View Details ▼
hello
Print "Hello, world!", "hello, world", or a customizable text.
hello
Print "Hello, world!":
hello {{[-t|--traditional]}}
Print "hello, world", the traditional type:
hello {{[-g|--greeting]}} "{{greeting_text}}"
Print a text message:
