AI writes Python code... backwards. I noticed something that kept bugging me: AI coding assistants like Claude Code most often generate Python functions in bottom-up order, with helpers first and entry points last. What's the deal? This forces you to read code from the bottom up to understand what it does. The exact opposite of how we naturally read, from the headline to the supporting details, like a newspaper! So I built 🔧 flake8-stepdown, a tool that detects and auto-fixes function ordering violations. It works as a flake8 plugin and as a standalone CLI. I wrote a blog post to explain how it works! 💡 Don't just prompt AI to "write better code", constrain it with deterministic tools (linter, auto-formatter, ...) Links in the comment below 👇 #Python #AI #CodeQuality #DeveloperTools #OpenSource
Hard to use a function correctly if you don't know what it does yet
📝 Full write-up: https://didmar.substack.com/p/ai-writes-python-code-backwards-lets 💻 GitHub: https://github.com/didmar/flake8-stepdown