Plausible but wrong: the AI review problem

Free preview 2 min to read

Confident and wrong aren't opposites

An AI assistant suggests a validation, a query or a whole controller action, and every line reads like something a competent Rails developer would write: tidy indentation, the right method names, the usual Rails idioms. None of that tells you whether the code is correct. A language model's fluency comes from its training data, not from your specific requirement, and the two have no necessary connection.

Why this habit doesn't come naturally

Reading someone else's pull request, a developer expects mistakes and reads defensively. An AI suggestion inside your own editor, already in your conventions, feels more like your own code a minute after writing it. Developers skim their own code far less critically than a stranger's. The AI did nothing to trigger suspicion; it wrote clean, idiomatic Ruby. That's the problem.

Four questions, every time

This course builds one repeatable checklist, applied to every AI suggestion before you accept it:

  1. Does it do what was asked, or only look like an answer?
  2. Does it introduce a security issue, which a plausible-looking suggestion can easily hide?
  3. Does it duplicate logic that already exists somewhere in the app?
  4. Does it match this codebase's conventions, or invent a new one that happens to be valid Ruby?

None of the four requires running the code first. You can answer all of them by reading, the way a senior developer reviews a pull request before pulling the branch.

What this course covers

  1. Doing what was asked: a validation that reads right and checks the wrong thing.
  2. A security check, tied to mass assignment, the hole Controller params & security already closed once.
  3. A duplicate-logic check, using this app's architecture rules.
  4. A conventions check, against this codebase rather than "correct Rails" in general.
  5. One worked example, end to end: a plausible Article method, and the reasoning that catches what's wrong with it.
  6. A wrap-up: what the checklist means once it's a habit.

By the end, "it looks right" stops being a reason to accept a suggestion and becomes a reason to slow down and check it.

Lesson 1 of 7 · free

Keep going with lesson 2

Does it do what was asked?

An unscoped uniqueness validation blocks reused titles across authors; scoping it to author_id enforces the requested rule.

A free account also gives you the quizzes, your progress and notes, and the discussion.

Type to start searching...