These pitfalls were found in real Python CLI projects during Genesis Architect research. The scaffold is built to avoid all of them from the first commit.
Seen in: pallets/click#2416
Frequency: Found in 4 of 5 analyzed repos as an anti-pattern
Root cause: Developers write transformation and validation logic directly inside
@click.command() decorated functions, making the logic impossible to unit test
without spawning a subprocess and capturing stdout.
Our mitigation: cli.py only parses arguments and calls core.process_file(). All
logic lives in core.py with no Click imports, tested directly in tests/test_core.py.
mitigation_file_path: src/python_cli/core.py
mitigation_symbol: process_file
Seen in: pallets/click#2558
Frequency: Found in 3 of 5 analyzed repos after Click 8.1.4 upgrade
Root cause: Click's internal type stubs changed in 8.1.4, causing mypy failures
on @click.option() decorators that previously passed type checking silently.
Our mitigation: Pin click>=8.1.7 in pyproject.toml and add # type: ignore[arg-type]
only where Click's own stubs are incomplete, documented with a comment referencing this issue.
Seen in: pallets/click#1846
Frequency: Found in 3 of 5 analyzed repos handling file arguments
Root cause: Accepting a raw file path from CLI args and passing it directly to
open() allows ../../../etc/passwd-style traversal outside the intended working directory.
Our mitigation: utils/security.py provides get_safe_path(base, user_input) that
resolves and validates every path stays within base before any file operation.
mitigation_file_path: src/python_cli/utils/security.py
mitigation_symbol: get_safe_path
mitigation_import: pathlib
Seen in: fastapi/typer#522
Frequency: Found in 5 of 5 analyzed repos at some point
Root cause: Passing invalid input directly to processing functions produces Python
tracebacks visible to end users instead of clean error messages.
Our mitigation: cli.py catches domain exceptions at the entry point and re-raises
as click.BadParameter with a human-readable message before any processing continues.
mitigation_file_path: src/python_cli/cli.py
mitigation_symbol: cli
mitigation_import: click
platform_risks:
- name: Windows console encoding (cp1252 vs utf-8) platform: windows mitigation_path: src/python_cli/utils/security.py
- name: Path separator differences (backslash vs forward-slash) platform: windows acknowledged: true