Prompt Library › ⚙️ Technical › Build a CLI Tool with AI
GPT-4o ⚙️ Technical Intermediate

Build a CLI Tool with AI

Design and generate a complete command-line tool for [TASK] in [LANGUAGE] — with subcommands, flags, help text, and error handling.

👁 4 views ⎘ 0 copies ♥ 0 likes

The Prompt

# Build a CLI Tool with AI

You are a developer building a command-line tool. Help me create [CLI_NAME] — a CLI for [TASK] written in [LANGUAGE].

## Command Structure

Design these commands:
- `[CLI_NAME] [COMMAND_1]` — [COMMAND_1_DESCRIPTION]
- `[CLI_NAME] [COMMAND_2] --[FLAG_1]` — [COMMAND_2_DESCRIPTION]
- `[CLI_NAME] [COMMAND_3] [ARG]` — [COMMAND_3_DESCRIPTION]

## Flags and Options

Global flags:
- `--config [PATH]` — path to config file (default: [DEFAULT_CONFIG_PATH])
- `--output [FORMAT]` — output format: [FORMAT_OPTIONS]
- `--verbose` — enable debug logging

## Error Handling

For each command, handle:
- Missing required arguments: print usage and exit 1
- Invalid [INPUT_TYPE]: print "[ERROR_MESSAGE]" and exit 2
- [SERVICE] connection failure: retry [RETRY_COUNT] times then exit 3

## Distribution

Package the CLI for [TARGET_OS] using [BUILD_TOOL]. Include an install script and a [PACKAGE_MANAGER] publish config.

Output the complete source code with a README install section.

📝 Fill in the blanks

Replace these placeholders with your own content:

[CLI_NAME]
[TASK]
[LANGUAGE]
[COMMAND_1]
[COMMAND_1_DESCRIPTION]
[COMMAND_2]
[FLAG_1]
[COMMAND_2_DESCRIPTION]
[COMMAND_3]
[ARG]
[COMMAND_3_DESCRIPTION]
[PATH]
[DEFAULT_CONFIG_PATH]
[FORMAT]
[FORMAT_OPTIONS]
[INPUT_TYPE]
[ERROR_MESSAGE]
[SERVICE]
[RETRY_COUNT]
[TARGET_OS]
[BUILD_TOOL]
[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.