Definition
A stub is a placeholder piece of code standing in for functionality that is not built yet, a button that does nothing or a function returning fake data.

Why it matters

The risk is the stub that is never replaced. It is sharper when an AI coding agent writes the code. A model will readily produce something that looks finished while quietly returning a fixed value or skipping the hard part. The screen loads, no error appears and the work is reported as done. A feature that appears to work while doing nothing is worse than one that visibly fails, because nobody knows to fix it. A stub found by a customer is a very expensive discovery.

How to apply it

  • Mark every stub clearly in the code, for example with a comment that says it is a placeholder, so it cannot pass for finished work.
  • Log each stub as a ticket the moment it is created, so it stays visible until replaced.
  • Never call a feature shipped just because it renders without an error. Run the real feature on the real surface.
  • Ask the AI agent directly which parts are stubbed or faked, and have it list them.
  • Treat a stub found late in review as a blocker for release, not a note for later.

What it is

When a developer builds a feature, some pieces are not ready. Rather than stop, a stub is put in their place. A stub of a payment function might always answer "success". A stub of a search page might show three fixed results. The surrounding code can then be written and tested without waiting.

Used on purpose, stubs are a normal and useful tool. They let a structure be sketched, a flow demonstrated or a part tested alone before every piece exists.

Worked example

Suppose a product team builds a quote tool for a ten-person consultancy. An AI coding agent produces the screen, and its price function returns a fixed 1,500 euros for every request. The screen loads, no error appears, and the feature is reported as done. The team's rule is that every stub is logged as a ticket in Linear the moment it is created, marked as a placeholder, so the fixed price stays visible until it is replaced.

A reviewer asks the agent which parts are faked, and the answer names the price function and a stored list of tax rates. Both tickets block the release. The team runs the real quote path on a staging build, where prices differ by project. The automated checks on GitHub include a case that compares the output with a known project, and the fixed value fails it. The tickets close only when the real output matches the spec.

Tools in the example

Some links are affiliate links: we may earn a commission at no cost to you. It never decides a ranking. How we work with partners

  1. Article

    Technical debt

    What an unfinished stub quietly becomes.

  2. Article

    Code review

    Where a hidden stub is most likely to be caught.

  3. Article

    Regression

    The risk a stub creates once it is mistaken for real code.

  4. Article

    Prototype

    A deliberate, disposable cousin of the stub that is never meant to ship.

Where it shows up

  • Writing copy that feels like conversation instead of marketing. How to sound like yourself.
    12 chapters