Skip to main content

Python CLI Tool with Click Framework

Generate a professional Python CLI tool using Click — subcommands, options, progress bars, colored output, and shell completion.

Fill in the placeholders

Edit the values, then copy your finished prompt.

Your Prompt
prompt.txt

                                

What this prompt does

This prompt asks the AI to build a polished Python CLI tool with the Click framework rather than a loose script. It specifies eight things: a tool named [tool_name] that fulfills [purpose], subcommands [subcommands], [option_count] configurable options with sensible defaults, progress bars, Rich-formatted colored output, a [config_format] config file, --verbose/--quiet flags, shell completion for bash/zsh/fish, and pyproject.toml packaging with entry points — plus tests per subcommand.

The structure works because it turns a throwaway script into a tool people actually use. The [purpose] variable drives the core logic, [subcommands] defines the command surface, and [config_format] plus shell completion make it feel installed and native. Rich output and progress bars are small touches that signal the tool is finished, while the entry-points packaging means it installs as a real command instead of python script.py.

When to use it

  • You're packaging internal tooling and want it to feel like a real CLI, not a script.
  • You need multiple [subcommands] under one tool with consistent options and help.
  • You want progress bars and colored output for long or multi-step operations.
  • You need a config file and shell completion so the tool is pleasant to use repeatedly.
  • You want the tool installable via pyproject.toml entry points with tests per command.

Example output

Expect a packaged CLI: a Click application defining each of [subcommands] as a command, [option_count] options with defaults, Rich-rendered output and progress bars, a loader for [config_format] config, --verbose/--quiet handling, and shell-completion setup. A pyproject.toml with entry points makes [tool_name] runnable as a command after install, and a test exists for each subcommand — a finished, distributable tool rather than a bare script.

Pro tips

  • Keep [subcommands] focused; a tight set (the default is init/generate/validate/serve) reads better than a sprawling command surface.
  • Set [option_count] to what each command genuinely needs — options without sensible defaults add friction, not power.
  • Match [config_format] to your ecosystem (TOML fits Python tooling well) so the config feels native.
  • Make [purpose] concrete; a vague purpose yields subcommands that don't quite hang together.
  • Test shell completion in your actual shell — generated completion setup often needs a small tweak per shell.
  • Build and pip-install the package locally early to confirm the [tool_name] entry point resolves before adding more commands.

Frequently Asked Questions

Why use Click instead of argparse for the CLI?
Click provides cleaner subcommand handling, decorators for options, and built-in support for features like shell completion that this prompt relies on. It scales to multi-command tools more gracefully than argparse, which is why the prompt standardizes on it.
Does the generated tool support a config file?
Yes. It reads configuration from the format you set in `[config_format]`, defaulting to TOML. This lets users set persistent defaults instead of passing every option on each invocation, which matters for a tool used repeatedly.
How are progress bars and colored output handled?
The prompt uses Click's progress bars for long operations and the Rich library for colored, formatted terminal output. These touches make multi-step commands readable and signal a finished tool rather than a bare script printing plain text.
Will it install as a real command?
Yes. It is packaged with `pyproject.toml` and entry points, so after installation the tool runs as `[tool_name]` from anywhere rather than as `python script.py`. Build and pip-install locally to confirm the entry point resolves correctly.
Does it include shell completion?
Yes. The prompt sets up shell completion for bash, zsh, and fish. Test it in your actual shell after install, since generated completion configuration sometimes needs a minor per-shell adjustment to activate properly.
Engr Mejba Ahmed

Need this built for real?

Engr Mejba Ahmed

AI Developer · Software Engineer

I'm Mejba — I design and ship production AI systems, automations, and full-stack apps. If you want this turned into a working solution for your team, let's talk.

More in Python & Automation Prompts

Engr Mejba Ahmed

Engr Mejba Ahmed

Claude Code Expert · Online

👋

Hey there!

Quick Actions

WhatsApp Instant reply

Chat on WhatsApp

+880 1723 741224 · Instant reply

Popular Questions

Engr Mejba Ahmed is connected
Engr Mejba Ahmed is typing...
Engr Mejba Ahmed avatar

✉ Want me to follow up? Drop your email

Engr Mejba Ahmed avatar

📞 Connect Directly

Choose how you'd like to reach me

WhatsApp

+880 1723 741224

Email

[email protected]

✓ Details sent! I'll get back to you shortly.

Powered by OpenAI

335+

Blog Posts

25

AI Courses

63

Projects

Services & Expertise

Pricing & Process

Learning & Resources

Connect & Support