How to Build a CLI Tool with Claude Code (No Engineering Degree Required)

David IyaDavid Iya July 10, 2026 9 min read
Close-up of hands typing code on a keyboard beside a laptop showing a code editor
Photo via Pexels

What It Means to Build a CLI Tool with Claude Code

A CLI tool - short for command-line tool - is a small program you run by typing a short command in a terminal window. Instead of opening an app, clicking through menus, and repeating the same steps, you type one line and the job is done. That is the entire appeal.

When you build a cli tool with claude code, you describe what you want inside the Claude Code desktop app in plain English. Claude writes the code, sets up the file structure, and gets it running. Your job is to explain the problem clearly - not to know any particular programming language.

This guide builds one real tool from start to finish: a bulk file renamer that adds a date prefix to every file in a folder. It is small enough to finish in one session, useful enough to reach for regularly, and teaches every pattern you need for your next tool.

What Makes a Good First CLI Tool - The One-Job Rule

The best first CLI tools share one trait: they do exactly one job, and that job is something you have already done by hand more than twice. If you have ever renamed a folder of files one at a time, resized the same set of images before uploading them, or set up a new project folder by copying from an old one, you have a candidate.

CCC members call this the One-Job Rule: if your tool description has the word 'and' in it more than once, split it into two tools. A tool that does one thing well is faster to build, easier to test, and gets used. A tool that tries to do everything sits unused.

  • It replaces a task you already do manually on a regular basis
  • The task has a clear input (a folder, a list of files, a name) and a clear output (renamed files, resized images, a new folder)
  • You can describe success in one sentence - 'every file in this folder now has today's date as a prefix'
  • It has no irreversible side effects you cannot easily preview before committing
  • You will still want it in three months, not just this week

Describing What You Want to Claude Code

Open the Claude Code desktop app and start a new conversation. Do not paste in code or requirements documents. Just describe the tool the way you would explain it to a competent person who is ready to build it right now.

A description that works: 'Build me a Node.js command-line tool called rename-files. It should take a folder path as an argument and add today's date as a prefix to every file in that folder, in YYYY-MM-DD format. It needs a --dry-run flag that prints what the renames would be without actually doing them, and a --help flag that explains how to use it.'

That is enough. Claude will ask a clarifying question if something is genuinely ambiguous. Otherwise it will build the file, install any dependencies it needs, and show you the result. You do not need to specify the language unless you have a preference - Claude will pick something sensible.

Flags, Arguments, and a Help Message

A CLI tool without flags is a one-trick box. Flags are the options you pass when you run the tool that change its behavior. An argument is the main input - in our case, the folder path. A help message is what you see when you run the tool with --help, and it is what separates a tool you will actually use six months from now from one you forget how to run.

Ask Claude Code to add these to the rename-files tool by describing each flag in plain English. You do not need to write any of the flag-parsing code yourself.

Flags for the rename-files tool and what each one does

FlagShort formWhat it does
--dry-run-nPrints the planned renames to the terminal without changing any files
--prefix-pSets a custom prefix instead of today's date (e.g. --prefix project-x)
--extension-eLimits renaming to files with a specific extension (e.g. --extension .jpg)
--recursive-rAlso processes files in subfolders, not just the top-level folder
--help-hShows usage instructions and a list of all available flags

You do not need all of these on day one. Start with --dry-run and --help. Add the others later when you find yourself wishing for them. Claude Code can add a flag to an existing tool in seconds - describe what you want the new flag to do and it handles the rest.

Testing on Real Files - Dry-Run First, Always

Before you run any new tool on files you care about, run it on a folder of copies first. Make a test folder, drop in five or six files with different names and extensions, and run the tool there. Check that the output matches what you expected.

Once the test folder looks right, run the tool on your real folder with --dry-run. Read through the printed list. Confirm every line is what you intended. Only then run it without the flag.

If something looks wrong in the dry-run output, go back to Claude Code and describe what you see versus what you expected. Paste the terminal output directly into the chat. Claude will diagnose and fix it. This is the normal loop - describe, build, test, refine.

Installing the Tool So You Can Run It from Anywhere

Right now the tool only runs from its own folder. Installing it means you can type rename-files from any folder on your computer and it works. Ask Claude Code to handle this step: 'Make rename-files installable so I can run it by name from any directory.'

Claude will either add an install script, update a package.json with a bin field, or create a shell alias - whichever approach fits the tool it built. It will also give you the one command to run that does the installation. You run that once and you are done.

After installing, open a new terminal window, navigate to a completely different folder, and type rename-files --help. If you see the help message, the tool is installed correctly. If you see 'command not found', paste that error back into Claude Code and it will fix the path configuration.

What to Build Next - Extending the Pattern

Every CLI tool you build with Claude Code follows the same pattern: describe the job, add flags for flexibility, test with dry-run before touching real files, and install so you can use it from anywhere. The only thing that changes is the job.

  • Image resizer - takes a folder and a max width, outputs scaled copies to an /output subfolder
  • Project scaffolder - takes a project name and creates the standard folder structure you use every time
  • Markdown to PDF converter - takes a .md file and produces a formatted PDF alongside it
  • Duplicate file finder - scans a folder and lists files with identical content so you can review before deleting
  • Text find-and-replace - takes a folder path and two strings, replaces one with the other across all files with a preview mode

Each of these takes less than a session to build. The dry-run pattern applies to all of them. Once you have two or three tools installed, you start to see your work differently - every repetitive task becomes a candidate for a five-minute build session.

Join Claude Code Club to Build Faster

Claude Code Club is a community of everyday builders who are making real tools with Claude Code - automations, utilities, full web apps, and everything in between. Members share what they build, what broke, and what they learned, so you are not figuring it out alone.

Inside the club you will find a library of prompts, skills, and workflows you can use as starting points, plus a community that has seen most of the errors you are about to run into. If you are serious about making Claude Code a genuine part of how you work, that community shortens the learning curve considerably.

Come build with us at claudecodeclub.ai. Bring the idea for your first tool - the community will help you ship it.

Frequently asked questions

Do I need to know how to code to build a CLI tool with Claude Code?

No. You describe what you want in plain English inside the Claude Code desktop app and Claude writes the code. You will read the output and test it, but you are not writing syntax. That said, the more precisely you can describe what you want, the faster it gets built correctly.

What programming language does Claude Code use to build CLI tools?

Claude picks a language based on what fits the job and your environment. For most simple CLI tools it defaults to Node.js or Python because both are widely available and easy to extend. You can specify a preference in your description if you have one.

What if the tool works in testing but breaks on my real files?

Paste the exact error message and the command you ran back into Claude Code. Include a description of what the files look like (file names, extensions, whether there are subfolders). Claude will identify the edge case and fix it. This is a normal part of the build loop, not a sign something went wrong.

Can I share a CLI tool I built with someone else on a different computer?

Yes. Ask Claude Code to add a simple setup script or document the install steps. The other person runs the setup once and the tool works the same way on their machine. If the tool has dependencies, Claude can include them in a requirements file or package.json so everything installs together.

Last reviewed by David Iya on July 10, 2026

David Iya

Written by

David Iya

Forbes 30 Under 30 · Y Combinator

Keep reading

FreelancingBusiness

The Do's and Don'ts of Using AI on Client Work

AI on client work is normal now - but there is a right way and a fast way to lose a client. A clear, save-worthy list of the do's and don'ts that protect your quality, your reputation, and your relationship with the people paying you.

Duncan Rogoff 8 min
Read article

Ready to build it yourself?

Join Claude Code Club, the #1 community for learning claude code, for $9/month.

← Back to the blog