A minimal TypeScript command line tool for agentic coding powered by Anthropic's Claude. Less than 200 lines of code.
For background on creating your own Agentic Coder, please see my Ottawa Forward JS talk Building an Agentic Coder from Scratch and my write-up of this experiment: What is the Most Minimal Agentic Coder You Can Write?
Note
If you are looking for a full-featured agentic coder, please see the full MyCoder project.
- Uses Anthropic Claude SDK with native tool calling support
- Provides two tools:
shellCommand
: the ability to run shell commandsfinished
: signals task completion
- Automatically stops when the agent calls the
finished
tool - 10-second timeout on shell commands to prevent hangs
- Displays Claude's thinking process and command execution in real-time
To get going using this:
# checkout and build
git checkout git@github.com:bhouston/mycoder-mini.git
npm install
npm run build
# install globally
npm link
# use anywhere!
mycoder-mini "Insert your prompt here"
- The tool takes your prompt and sends it to Claude
- Claude analyzes the task and decides what shell commands to run using native tool calling
- The tool executes the commands and returns the results to Claude
- Claude continues this loop until it determines the task is complete
- The agent stops when it calls the
finished
tool
The implementation uses Claude's native tool calling API, which provides a more structured way for the AI to invoke tools compared to parsing text responses. This results in a more reliable and cleaner interaction between the AI and the shell commands.
# clone repo
git checkout git@github.com:bhouston/mycoder-minimal.git
# install deps
npm install
# build
npm run build
# start cli tool
npm start "Insert your prompt here"
Set your Anthropic API key as an environment variable:
export ANTHROPIC_API_KEY=your_api_key_here
Then run the tool with a prompt:
# If you've linked the package globally
mycoder-mini "Write a simple hello world program in Python"
# Or run directly
npm start "Write a simple hello world program in Python"
# Or with Node directly
node dist/index.js "Write a simple hello world program in Python"
MIT