Blueprint · intermediate · 8 steps

Build Your Own AI CLI Tool

Build a terminal assistant called "ask" — answer questions, explain files, generate shell commands, and pipe in data.

← All blueprints
STEP 01Step 1: What We're BuildingA terminal assistant called `ask` that answers questions, explains code, generates shell commands, and processes piped input — all powered by Claude from the command line.2 minSTEP 02Step 2: Project SetupInitialize the Node.js project, install all dependencies, configure TypeScript, and wire up the `bin` entry so the CLI runs as a global command.2 minSTEP 03Step 3: Basic Ask CommandCreate the core `ask "question"` command that sends a prompt to Claude and prints the response in the terminal.3 minSTEP 04Step 4: Streaming ResponsesReplace the batch API call with streaming so Claude's response appears word-by-word in the terminal — just like ChatGPT and Claude Code.3 minSTEP 05Step 5: Explain File CommandAdd an `ask explain <file>` subcommand that reads a source file from disk and asks Claude to explain what it does.3 minSTEP 06Step 6: Shell Command GeneratorAdd an `ask cmd "description"` subcommand that translates plain English into a shell command, shows it for review, and optionally executes it.3 minSTEP 07Step 7: Pipe and StdinAdd support for piped input so you can send any command's output to Claude — `git diff | ask "summarize"` and `cat file.py | ask "review this"`.3 minSTEP 08Step 8: What's NextInstall your CLI globally with npm link, then explore extensions — conversation history, config files, and publishing to npm.3 min