Type checking and linting: free mistakes caught
Two tools catch whole categories of errors with almost no effort on your part:
- Type checking (TypeScript,
mypy, etc.) catches "you passed a string where a number was expected" and "this value could be undefined." The AI loves to forget cases that types make impossible. - Linting (ESLint, Ruff, etc.) catches unused variables, unreachable code, and style drift. It keeps a codebase touched by AI from slowly turning to mush.
Set these up early and tell the AI to obey them: "Run the type checker and the linter, and fix anything they report before you call this done." Treat a clean type check as part of the definition of finished.
Watch for the lazy escape hatches, though. When the type checker complains, the genuinely correct fix is to handle the case it found — the undefined value, the wrong type. The fast fix is to silence the complaint with // @ts-ignore, any, or a # type: ignore comment, and the AI reaches for these constantly because they make the red text disappear. They also make the check worthless exactly where it was trying to help. If you see a suppression comment appear in a diff, treat it as a question, not a solution: "Why is this needed? Fix the underlying type instead of ignoring it."