GPT-4o
⚙️ Technical
Intermediate
Build a Command-Line Tool from Scratch
Build a fully functional CLI tool with argument parsing, help text, error handling, and cross-platform support.
The Prompt
# Build a Command-Line Tool from Scratch You are a senior developer building a well-designed command-line tool. ## Tool Specification Tool name: [TOOL_NAME] Language: [LANGUAGE] What it does: [TOOL_PURPOSE] Primary users: [TARGET_USERS] Commands to implement: 1. [COMMAND_1]: [DESCRIPTION] 2. [COMMAND_2]: [DESCRIPTION] 3. [COMMAND_3]: [DESCRIPTION] ## Implementation Build [TOOL_NAME] with: **1. Argument parsing** Use [LANGUAGE]'s standard or best-practice argument parsing library. Implement: - Subcommands for each of the 3 commands - Required and optional flags with sensible defaults - Short and long flag variants (-v / --verbose) **2. Help text** Write the help output for `[TOOL_NAME] --help` and each subcommand. It should be clear enough that a new user can figure out the tool without reading docs. **3. Core logic** Implement each of the 3 commands fully. **4. Error handling** Handle: missing required arguments, invalid inputs, file not found, permission errors, and network failures (if applicable). Exit with appropriate codes (0 = success, non-zero = error). **5. Output formatting** Support: plain text output (default), --json flag for machine-readable output, --quiet flag to suppress non-essential output. **6. Cross-platform support** Flag any platform-specific considerations for Windows / macOS / Linux. ## Complete Code Write the complete, runnable implementation. ## Packaging Show how to package [TOOL_NAME] for distribution via [PACKAGE_MANAGER].
📝 Fill in the blanks
Replace these placeholders with your own content:
[TOOL_NAME]
[LANGUAGE]
[TOOL_PURPOSE]
[TARGET_USERS]
[COMMAND_1]
[DESCRIPTION]
[COMMAND_2]
[COMMAND_3]
[PACKAGE_MANAGER]
How to use this prompt
1
Copy the prompt
Click "Copy Prompt" above to copy the full prompt text to your clipboard.
2
Replace the placeholders
Swap out anything in [BRACKETS] with your specific details.
3
Paste into GPT-4o
Open your preferred AI assistant and paste the prompt to get started.