Back to Writing

Prompting Is a Programming Interface

May 12, 2026 · 2 min read

AI Engineering · LLMs

Most teams start writing prompts the way they'd write a quick script: a string literal buried in a function, tweaked until the output looks right, then forgotten. That works for a demo. It falls apart the moment a prompt needs to survive a model upgrade, a new teammate, or a regression six months later.

Prompts have callers

A prompt template has inputs, an expected output shape, and failure modes — the same things a function signature has. If you wouldn't accept an untyped, undocumented function into a codebase, the same standard should apply to the string that drives your model call.

In practice this means:

  • Naming prompt templates like you'd name a function, not a variable.
  • Versioning them, so a regression can be bisected instead of guessed at.
  • Writing down what "correct" looks like for a given input, even if the check is just a human reading a diff.

The interface is the contract, not the wording

Teams that treat every wording tweak as a free action end up with a prompt that's been "fixed" a dozen times, none of them tested against the cases the earlier fixes were solving. The wording is an implementation detail. The contract — what the prompt promises to do given a certain input — is what should stay stable across changes.

A small example

A summarisation prompt that promises "a two-sentence summary suitable for a notification" has a contract: length, tone, and audience. If a later edit produces four sentences because it reads better in isolation, it's violated the contract even though the new copy looks fine on its own.

Where this breaks down

None of this means prompts need the same rigor as a payments system. Most AI features tolerate more ambiguity than traditional code, and over-engineering a prompt pipeline before you have real usage data is its own failure mode. The goal isn't process for its own sake — it's making sure that when something breaks, there's a contract to check the behavior against, instead of just a feeling that "it used to work."

Prompting as an interface is a discipline, not a framework. It's mostly a matter of writing prompts down like you mean to keep them.