Alex Michael’s Post

Yesterday I shared how I set up a ruff linting hook in Claude Code that auto-cleans Python files every time Claude writes or edits one. But why is that even necessary? Here's the honest answer: AI doesn't always write perfect code, and neither do you or I. A few real scenarios where the hook quietly saves you: ✅ You edited a file manually: introduced a small lint issue, then asked Claude to add a feature elsewhere. Claude's edit triggers the hook. Ruff scans the whole file, not just Claude's changes. Your error gets caught too. ✅ Claude made a mistake: it's good, not infallible. The hook is a safety net that runs regardless of who introduced the issue. ✅ Accumulated drift: a file picks up small style inconsistencies over time. Every time Claude touches it, ruff tidies the whole thing. The codebase gets cleaner over time, not messier. The underlying principle: don't rely on either human or AI discipline for code quality. Automate it. This is what hooks in Claude Code are really for - not just reacting to what Claude does, but encoding your standards into the workflow itself so they're enforced consistently, every time. What quality checks are you automating (or wish you were)? #ClaudeCode #AI #Python #CodeQuality #DeveloperTools #Automation

  • No alternative text description for this image

Oh this is pretty good !

Like
Reply

To view or add a comment, sign in

Explore content categories