All courses

Workflow: building a small tool from scratch

Start a new tool in an empty git folder. Describe what it does with example inputs and outputs, ask for the simplest stack with few, checked dependencies, and get a runnable skeleton first. Add an instruction file with run and test commands, then grow the tool in planned, committed steps.

Builds on: Doing a bigger change plan-first, step by step, Unknown and invented packages, Project instruction files: purpose and contents

Read it card by card Start the whole course

An empty folder and a big wish

You want a small command that reads your bank's CSV export and prints spending per category. You make an empty folder, open the agent and type: `build me an expense tracker`. Ten minutes later there is a web app, a database setup, 14 packages and 30 files. Does it work? You can't tell, and you don't know where to start checking.

In an empty folder, every gap is a guess

In an empty folder the agent has nothing to go on: no code to copy the style from, no chosen language, no run command. It fills every gap with a guess, and its guesses tend to be big: a framework, a dozen packages, many files at once. You can't check a pile that size, and each package is a risk. A concrete example pins down what the tool should do. A tiny skeleton gives you something you can run and check right away.

Six steps from nothing to a growing tool

1. New folder, `git init`, add a `README.md`, then the first commit. 2. Describe the tool: its job, one real example input with the exact output, and what is out of scope. 3. Ask for the simplest stack. Prefer the standard library. Have it name and justify each package, and check each one yourself. 4. Skeleton first: one run command, one test. Run both yourself, then commit. 5. Instruction file with the run and test commands, then commit. 6. Grow the tool one feature at a time: plan, step, verify, commit.

A first prompt that pins the tool down

The input and output are exact, so you can check the result by running one command. The stack is limited and the scope is the skeleton only.
▸ You: Empty git repo. Build a command-line
tool `expsum` that sums a bank CSV by
category.
Input `sample.csv`:
date,amount,category
2024-03-01,12.50,food
2024-03-02,40.00,travel
2024-03-05,7.50,food
`python expsum.py sample.csv` prints:
food    20.00
travel  40.00
Use Python's standard library only. Plan
first: just a runnable skeleton and one
test. No other features yet.

From skeleton to the next feature

The agent plans three files: `expsum.py`, `test_expsum.py` and `sample.csv`, with no packages. You approve the plan. When it reports that everything works, you check anyway: `python expsum.py sample.csv` prints exactly the two lines your prompt asked for (food 20.00, travel 40.00, in aligned columns), and `python -m unittest` passes. Commit. Next, have it write `AGENTS.md` with both commands and the rule "standard library only". Commit. Each later feature, such as a `--month` filter, gets its own plan, step and commit.

Small, exact, runnable, then grow

Start from an empty, committed folder. Describe the tool with a real example input and its exact output, and ask for the smallest stack and a runnable skeleton first. Then put the run and test commands into the instruction file, and grow the tool one planned, committed step at a time.

On Bytewise this lesson comes in small steps with a check at the end, and the app brings it back right before you would forget it.