
- Updated
Build a small command-line tool
This prompt writes a friendly command-line tool, for example to rename or sort files. It includes help text, a dry-run mode and clear errors, and never overwrites files unless you pass a flag for it.
Act as a developer who writes friendly command-line tools in [LANGUAGE, e.g. Python]. The tool should: [WHAT IT DOES, e.g. rename photos by the date they were taken] Inputs and options: [e.g. folder path, --dry-run, --pattern] Write the complete tool with helpful --help text, a dry-run mode, clear error messages and a non-zero exit code on failure. Never delete or overwrite files without a flag that says so. Use only the standard library unless a package really helps. Show three example commands and their output.
Always try a new file-changing tool with --dry-run on a copy of your folder first.
Get a better result
A complete command-line tool in your language, with help text, a dry-run mode, clear errors, safe exit codes and three example commands showing what each does, using only the standard library where possible.
The tool changes or deletes files the first time you run it.
Fix: Follow the tip: run it with the dry-run option on a copy of your folder first, and keep the rule that nothing is overwritten without a flag.
- The options are not clear, so the code guesses what you meant. List each option with its default in the inputs line, for example “--pattern, default {date}_{name}”.
- It breaks on unusual file names or empty folders. Reply with “list the edge cases this tool does not handle, then handle spaces, missing folders and duplicate names”.
Ask for “a log of every change and an undo command that restores the original names from that log”. It makes the tool safer to use on real files.
Add a short test file that checks the dry-run mode and one failure case. Keep the tool itself unchanged.
Guides on this topic
More chat & writing prompts
See all 465 →More like this
- Build a simple Telegram or Discord botClaude · ChatGPT · Gemini
- Write a CLAUDE.md file for your projectClaude Code · Cursor
- Python script to automate a taskChatGPT · Gemini · Claude
- Automate Google Sheets with Apps ScriptClaude · ChatGPT · Gemini
- Clean a messy spreadsheet with PythonClaude · ChatGPT · Gemini



