Topic 1 of 5 · 4 min read
Linters and type checkers as fast feedback
Goal: Choose lint and type-checker settings that catch a given class of agent mistake and turn the error into feedback for the agent.
A linter or type checker is the cheapest reviewer you have: it reads every line an agent writes, in seconds, and never gets tired. Run them on every change and let the agent read their errors.
Check yourself · 1 of 3
Why turn on strict type checking before an agent edits your code?
Why it matters
Agents such as Claude Code, Codex, Cursor and Copilot write fluent code that often calls a function that does not exist, passes the wrong type, or forgets a null case. A human reviewer can miss these. A type checker cannot. Each error it finds is one your reviewer does not have to find, and each one the agent can fix on its own is a round trip saved.
How to do it
- Turn strictness up before the agent starts. In TypeScript, set
"strict": true, and addnoUncheckedIndexedAccess. In Python, run mypy or pyright in strict mode on new code. Strict settings turn silent guesses into errors. - Pick lint rules that match agent habits. Useful ones: unused variables and imports, floating promises (a promise nobody awaits), no explicit
any, no empty catch blocks, and no console logging left in. - Use a formatter, and run it automatically. Prettier, Black or gofmt end style arguments and keep diffs small, so the review shows logic, not whitespace.
- Make errors readable. Output with a file, a line, a rule name and a short message is feedback the agent can act on. A wall of 4,000 warnings is noise. Fix or switch off noisy rules once, so every remaining error means something.
- Treat warnings as errors in CI. A warning nobody must fix is a warning the agent will ignore.
Before and after
Before, an agent writes a handler and the checks are loose:
async function getUser(id: string) {
const res = await fetch(`/api/users/${id}`);
return res.json(); // returns Promise<any>
}
saveUser(getUser("42")); // passes a Promise, no error
After turning on strict and the floating-promise and no-explicit-any rules, the checker reports a clear error on the last line: a Promise was passed where a User was expected. The agent reads it, adds await and a return type, and the bug never reaches review.
What goes wrong
- Strict on paper only. A config that allows
anyeverywhere checks almost nothing. - Noise. Thousands of old warnings teach everyone, agents included, to ignore output.
- Slow checks. If the type check takes ten minutes, nobody runs it per change. Check only the changed packages in the fast loop and run the full set in CI.
- Type-correct is not right. A checker proves the types line up, not that the logic does what was asked. It is a floor, not the review.
Examples
The invented method
An agent calls user.fullName() but the class only has a name property. In plain JavaScript this fails at runtime, maybe in production. With TypeScript the error appears at once: Property 'fullName' does not exist on type 'User'. The agent reads it and switches to user.name.
Tuning a noisy rule set
A repo has 2,300 lint warnings from legacy code, so agents see a long list on every run and stop reading it. The team fixes or baselines the old ones, sets the rest to errors, and the output on a new change is empty or three lines long. Now each line is news the agent acts on.
Key points
- Strict types and lint rules turn silent agent guesses into errors the agent can read and fix.
- Choose rules for what agents actually get wrong: unused code, floating promises, any, empty catch blocks.
- Run a formatter automatically so reviews show logic changes, not style changes.
- Keep output clean and specific: file, line, rule and message, with old noise fixed once.
- Passing types and lint is a floor for review, not proof that the change is correct.
Common mistakes
- Leaving strict mode off because the old code would not compile, so new agent code gets no checks either.
- Letting warnings pile up until nobody, human or agent, reads the output.
- Running the checks only in CI, so the agent never sees the errors while it can still fix them.
- Treating a green type check as proof the logic is right.
Check yourself · 2 of 3
A repo prints 2,000 old lint warnings on every run. What is the best fix for agent work?
Check yourself · 3 of 3
What does a green type check tell you about an agent change?
Practice items, not counted towards your mastery.
Start here
- ESLint documentation (opens in a new tab)DocsFree
Rule configuration, severity levels and inline disable comments.
- TSConfig reference (opens in a new tab)DocsFree
Every compiler option, including the strict family that agents often loosen.
- Semgrep documentation (opens in a new tab)DocsFree
How rules match code patterns, how to triage findings and how to write custom rules.