Build your own Command-Line Tool
A polished command-line tool (a grep, cowsay or fortune clone) with arguments, help text, exit codes, pipes and tests.
- Intro
- About 3–8 h
- 4 checkpoints
- 4 tutorials · Go, Node.js, Rust
Pick a tutorial, then check yourself at each checkpoint. Work in any language you like.
Choose a tutorialWhy build it
Good command-line tools follow conventions: stdin and stdout, exit codes, flags and helpful errors. Doing it well is the base for every script and automation you will write.
You will be able to
- Parse arguments and flags with a library and generate help text.
- Read from stdin or files and write to stdout so the tool works in pipes.
- Return meaningful exit codes and write errors to stderr.
- Test the tool end to end and package it for installation.
Skills it exercises
Recommended on DevOps Engineer and Operating Systems & Linux.
How you know you are there
Work in any language. Each checkpoint ends with something you can run or observe, so you can check it yourself.
- Checkpoint 1Self-check
Arguments
Done when:
mytool --helpdocuments every option, and an invalid flag prints a usage error to stderr with exit code 2. - Checkpoint 2Self-check
Pipes
Done when:
cat file | mytool patternandmytool pattern filebehave the same, and the output can be piped onward. - Checkpoint 3Self-check
Errors
Done when: A missing file gives a clear message and a non-zero exit code.
- Checkpoint 4Self-check
Tests and packaging
Done when: End-to-end tests run the tool on fixture files, and it installs with one command (cargo install, go install, npm i -g or pipx).
Stretch goals
- Coloured output that turns off when stdout is not a terminal.
- Shell completion scripts.
Step-by-step guides
Pick one in a language you know (tutorial languages: Go, Node.js, Rust). They open on the author’s site.
- Rust
Command line apps in Rust(external site)
Rust: the community book on command-line apps, from arguments to testing and packaging.
- Go
Building a cli command with Go: cowsay(external site)
Go: a cowsay clone that reads from pipes.
- Go
Build a command line app with Go: lolcat(external site)
Go: a lolcat clone.
- Node.js
Create a CLI tool in Javascript(external site)
Node.js: a CLI tool in JavaScript.
Practice builds are self-paced: Tech Atlas does not track them or count them as evidence. To show a skill, take its knowledge check from the skill page.
Tutorials come from codecrafters-io/build-your-own-x (CC0, snapshot of 2026-07-14, commit aa17439; links checked on 2026-10-19). Each tutorial belongs to its author and keeps its own licence; Tech Atlas links to it and does not host it. Briefs, checkpoints and the mapping to skills are Tech Atlas editorial drafts.