auriti-labs/agentwork/python-cli-tooling
Claude Code and agent skill by auriti-labs/agentwork
- community
Checking that the SKILL.md file is still in the repository.
Build, structure, and package Python CLI tools. Load when creating a CLI with Click/Typer, setting up pyproject.toml entry points, packaging for pip install, or fixing CLI startup/import issues.
Install
npx vskill@latest install auriti-labs/agentwork/python-cli-toolingSKILL.md
Python CLI Tooling
Scope
Building, structuring, testing, and packaging Python CLI tools for distribution.
Triggers
- "create a CLI tool" / "add a command to [tool]"
- "set up pyproject.toml" / "configure entry points"
- "package for pip install" / "publish to PyPI"
- "entry point not found" / "import error in CLI"
- "add --json output" / "add --verbose flag"
When NOT to Use
- Web APIs or HTTP servers
- Python libraries without CLI interface
- Non-Python CLIs (Rust, Go, Node)
- GUI applications
Goals
- Produce a CLI tool that installs cleanly via
pip installand runs via its entry point - Keep CLI layer thin — commands validate input, call core logic, format output
- Ensure the tool works in pipes, scripts, and CI (not just interactive terminals)
- Make every command self-documenting via
--help
Constraints
- Always use
src/layout withpyproject.toml(nosetup.py) - Separate CLI layer (
cli.py,commands/) from business logic (core/) — one-way dependency only - Config precedence: CLI flags > env vars > config file > defaults — never hardcode paths
- Use
sys.exit(1)for errors, never bareexit()or unhandled exceptions - Pin minimum dependency versions, not exact:
click>=8.0notclick==8.1.7 - Add
--verbose,--quiet,--jsonoutput flags from the start — retrofitting is painful
Input Minimi
- Tool purpose and target user
- Expected commands and subcommands
- Python version constraint (3.10+, 3.11+, etc.)
Check Before Acting
pyproject.toml— existing config, dependencies, entry points, build systemsrc/or package directory — existing code structure and namingREADME.md— current usage examples and install instructions.github/workflows/— existing CI/CD for testing and publishing
Checklist
New CLI Tool
- Choose framework: Typer for simple CLIs, Click for complex ones with plugins (see
examples/) - Create project structure (see
references/project-structure-patterns.md) - Define entry point in
pyproject.tomlunder[project.scripts] - Implement
__main__.pyforpython -m my_toolsupport - Test:
pip install -e .thenmy-tool --help
Adding a Command
- Create module in
commands/ - Register in
cli.pyvia decorator orapp.add_command() - Keep handler thin — validate, call core, format output
- Add
--helptext for every parameter
Testing
- Test CLI invocation with
CliRunner(Click) orrunner.invoke(Typer) - Test core logic independently (no CLI dependency)
- Test
--jsonoutput is valid JSON - Test exit codes: 0 for success, 1 for user error, 2 for system error
- See
references/testing-and-validation.mdfor patterns
Packaging
- See
references/packaging-and-release.mdfor full workflow - Quick check:
pip install -e . && which my-tool && my-tool --version
Gotchas
- Entry point not found after `pip install -e .` — The module path in
[project.scripts]doesn't match the actual package structure. If your package issrc/my_tool/, the entry point ismy_tool.cli:app, notsrc.my_tool.cli:app.
- Circular imports between CLI and core. CLI imports core, core imports CLI for type hints or decorators. Fix: core must never import from CLI. Use dependency injection or pass callbacks.
- `--help` shows no commands. Commands are defined but not registered. In Click: forgot
@cli.command()orcli.add_command(). In Typer: forgotapp.command()decorator or the module isn't imported.
- Rich output breaks when piped.
my-tool | grep somethingproduces ANSI garbage. Fix: checksys.stdout.isatty()and disable color/formatting in non-TTY mode. Or userich.console.Console(force_terminal=False).
- Config file not found on other machines. Hardcoded
~/.my-tool/config.yaml. Fix: usepathlib.Path.home() / ".config" / "my-tool"with XDG_CONFIG_HOME fallback, and always handle missing config gracefully.
- `python -m my_tool` works but `my-tool` command doesn't. The venv isn't activated, or
pip install -e .wasn't run after adding the entry point. Always test both invocation methods.
- Version string out of sync.
__version__in__init__.pysays 1.0 butpyproject.tomlsays 1.1. Fix: useimportlib.metadata.version("my-tool")as single source of truth, or usehatch-vcs/setuptools-scm.
- Subcommand added but tests don't cover it. New command works manually but CI doesn't test it. Fix: every command gets at least one
CliRunnertest that checks exit code 0 and expected output substring.
- Renaming or removing a CLI flag breaks downstream scripts. Users and CI pipelines depend on
--output-format, you rename it to--format. Fix: keep the old flag as a deprecated alias (@click.option("--output-format", "--format", ...)) and emit a warning. Never remove flags in minor versions.
Handoff
- After CLI structure built → kiro-qa for code review
- After packaging ready → kiro-docs for README and usage guide
- If CLI needs MCP integration → load
mcp-integrationskill - If preparing a release → load
release-docs-packagingskill
Memory Guidance
TotalRecall: Entry point configurations that worked, project structure decisions, dependency version choices, config precedence patterns Kore candidates: CLI project templates that work across projects, packaging configs that avoid pitfalls, testing patterns for CLI tools Never save: Standard Click/Typer boilerplate, obvious pip/venv commands, pyproject.toml syntax
When to Read Support Files
- Starting a new CLI? Read
references/project-structure-patterns.mdfor the recommended layout - Choosing Click vs Typer? Read
examples/click-cli-pattern.mdandexamples/typer-cli-pattern.mdto compare - Setting up pyproject.toml? Read
examples/pyproject-layout.mdfor a complete working config - Writing tests? Read
references/testing-and-validation.mdfor CliRunner patterns and exit code testing - Preparing to publish? Read
references/packaging-and-release.mdfor the build→check→upload workflow
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/python-cli-tooling/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/auriti-labs/agentwork/python-cli-tooling)