$ recombobulate _
home / tips / write-python-click-cli-tools-with-claude
0

Write Python Click CLI Tools with Claude

bagwaa @bagwaa · Mar 26, 2026 · Workflows
write-python-click-cli-tools-with-claude

Click is Python's go-to library for building command-line tools, but getting the arguments, types, validation, and help text all right takes longer than it should. Claude can write a complete, production-ready CLI in one prompt.

Describe what you need:

Write a Python Click CLI tool that:
- Has a main command group called "db"
- Has a subcommand "export" that takes --format (csv or json), --output path, and --table name
- Has a subcommand "import" that takes a file path and --dry-run flag
- Validates that the output path's parent directory exists
- Shows a progress bar using Click's progressbar utility
- Has full --help output with examples

Claude will scaffold the full module with a proper if __name__ == "__main__" guard, type annotations, error handling with click.ClickException, and a pyproject.toml [project.scripts] entry so you can install it as a real CLI command.

For adding new subcommands to an existing CLI:

Add a "stats" subcommand to @cli/main.py that accepts an optional --since date 
argument (default: 7 days ago) and outputs a summary table using Click's echo formatting.

A Click CLI is only two dozen lines to get wrong and two hundred to get right — describing what you want is faster than reading the docs.

~/recombobulate $ tip --comments --count=0

Log in to leave a comment.

~/recombobulate $ tip --related --limit=3
0
Scan Pending Changes for Security Issues with /security-review

The /security-review command scans your uncommitted changes for injection vectors, auth gaps, hardcoded secrets, and other common vulnerabilities.

bagwaa @bagwaa · 1 hour ago
0
Run Setup Scripts on Every Session with the SessionStart Hook

The SessionStart hook fires when any session begins or resumes, making it ideal for loading environment variables and running one-time setup scripts.

bagwaa @bagwaa · 1 hour ago
0
Write Property-Based Tests with fast-check and Claude

Ask Claude to write property-based tests for your functions using fast-check — it identifies the mathematical invariants in your code and generates tests that cover inputs you'd never enumerate by hand.

bagwaa @bagwaa · 2 hours ago