Why not just tell the LLM in rules to strongly type and write guardrails and then:

[tool.ruff]

line-length = 88

select = ["E", "F", "W", "I", "N", "UP", "B", "C4"] # A good strict baseline

ignore = []

[tool.mypy]

python_version = "3.12"

warn_return_any = true

warn_unused_configs = true

disallow_untyped_defs = true

disallow_any_unimported = true

no_implicit_optional = true

check_untyped_defs = true

strict = true

Yep this is pretty much what I do. I also added a /check command to explcicitly runn all those checks + pyright and ruff format.