Imperative

Dictate how the code should work: data structures, algorithm, control flow.

Draft: open for discussionAlso known as: implementation-oriented, step-by-step

Definition

You tell the model the implementation step by step: which structures to use, how data flows, what happens on each tick. The model becomes a fast typist for a design that already exists in your head. You get maximum control and an easy review, at the cost of speed and of ideas you would not have had on your own.

Example prompt

Imperative
Fetch the latest 5 images from the database into an array.Use setInterval every 5s. On each tick, shift the first item, push itto the end and prefetch the URL of the next image.Use IntersectionObserver for lazy loading.While an image loads, show a skeleton sized from its stored width and height.For the transition, toggle a CSS class twice with 150ms between toggles.

What it reveals

  • Technical depth: data structures, performance, platform APIs
  • Architecture and design ability
  • Capacity to guide and review generated code precisely

Use it when

  • Performance-sensitive or security-sensitive code
  • You already know the right design and want exactly that
  • Fixing a specific bug or refactoring a known hot spot

Watch out for

  • Micromanaging the model can be slower than typing the code yourself
  • It shuts out better approaches the model might have suggested
  • Prompts get long and brittle

In an interview

Look for

  • Are the dictated decisions correct, and can the candidate justify them?
  • Does the candidate know when to stop dictating and delegate?

Ask

  • Why setInterval here and not requestAnimationFrame or a CSS animation?
  • What did you dictate that you could have safely delegated?

Origin

Borrowed from imperative programming, which describes computation as a sequence of statements that change state. As with declarative, there is no single author for the prompt-style usage.

Sources