DEV Community

Lukas Rodrigo
Lukas Rodrigo

Posted on Edited on AI-assisted

Beyond the Prompt: Why Your AI Chose a Spinner Instead of a Skeleton

AI-assisted software development illustrating the engineering decisions behind generated code

The real work of an AI agent doesn’t necessarily begin when you press Enter.

"Create a loading component."

That's it.

One sentence.

No extra context.

No design guidelines.

No UX requirements.

No product description.

Yet an AI coding agent somehow returns a complete component.

Maybe it's a spinner.

Maybe it's a skeleton screen.

Maybe it's a progress bar.

Maybe it doesn't render anything at all.

At first glance, it feels like magic.

But the interesting part isn't the component that was generated.

The interesting part is everything the AI decided before writing the first line of code.

That's what this series is about.

Welcome to Beyond the Prompt.


The Prompt Is Only the Beginning

When people talk about AI-assisted development, they usually focus on prompts.

"Prompt engineering is the future."

"Just write better prompts."

But prompts are only inputs.

The real engineering happens after the model receives them.

An autonomous coding agent doesn't simply autocomplete code.

It starts making decisions.

Lots of them.

Some are obvious.

Most are invisible.

For something as simple as a loading component, the agent has to answer questions that the user never asked.

  • Is this page loading once or continuously?
  • Is there existing UI that should remain visible?
  • Is the loading duration expected to be milliseconds or several seconds?
  • Does the application already have a design system?
  • Is accessibility required?
  • Is the component reusable?
  • Is this mobile?
  • Desktop?
  • Dashboard?
  • Form?
  • Table?
  • Search results?

None of these questions were in the prompt.

Yet every answer changes the implementation.


The First Decision: What Kind of Loading Is This?

One of the earliest choices an AI agent makes is identifying what is actually loading.

Not every loading state represents the same user experience, which means not every situation deserves the same loading component.

Fetching an Entire Page

Skeleton screen showing placeholder content while an entire page loads

A Skeleton is usually the best choice.

The user is waiting for content that hasn't been rendered yet, so showing the page structure helps reduce uncertainty and makes the application feel faster.

Waiting for a Button Action

Button with an inline spinner indicating that an action is being processed

A Spinner inside the button is often enough.

The rest of the interface is already available. The user only needs confirmation that their action is being processed.

Uploading a File

Progress bar showing the progress of a file upload

A Progress Bar is the better option.

Unlike a spinner, it tells users how much work remains, which becomes increasingly important as the operation takes longer.

Streaming an AI Response

AI chat interface displaying a response as it is generated

In many cases, the best loading state is no traditional loader at all.

Displaying the content as it's generated creates a more natural experience than making users wait for the complete response.

Refreshing Data in the Background

Sometimes the best loading component is none.

If users can continue interacting with the application, a subtle indicator - or no indicator at all - often creates a smoother experience than interrupting the interface with a visible loader.

Notice something.

The loading component isn't chosen because it looks better.

It's chosen because it communicates a different kind of progress.

A spinner says:

Something is happening.

A skeleton says:

The content is coming, and this is roughly where it will appear.

A progress bar says:

We know how much work is left.

These aren't just different UI components.

They're different ways of communicating with the user.


Why Skeletons Often Feel Faster

One of the biggest UX discoveries over the last decade is that perceived performance matters almost as much as actual performance.

Imagine waiting three seconds.

Version A

Version A illustrating a loading experience without skeleton placeholders

Version B

Version B illustrating a loading experience with skeleton placeholders

Still three seconds.

Yet users consistently report the second experience as faster.

Nothing changed technically.

Everything changed psychologically.

Skeleton screens reduce uncertainty.

They tell users:

"The page already exists. We're just filling it in."

Why an Agent Might Ignore Skeletons

Now here's something interesting.

Many developers assume that skeletons are always better.

They're not.

Imagine clicking a button that triggers a network request lasting 400 milliseconds.

Rendering a complex skeleton for less than half a second creates unnecessary visual noise.

An AI agent evaluating this scenario might decide:

  • Spinner
  • No animation
  • Optimistic update
  • Keep previous content visible

instead of replacing the UI with placeholders.

Again, the decision isn't aesthetic.

It's contextual.


Context Changes Everything

Suppose the prompt is still exactly the same.

Create a loading component.

Now imagine four different applications.

Banking App

Banking application interface illustrating a loading state in a financial environment

Trust matters.

Aggressive animations can make financial operations feel unreliable.

A subtle progress indicator is usually preferable.


Social Media Feed

Social media feed displaying skeleton cards while content loads

Content is consumed continuously.

Skeleton cards preserve layout stability.


File Upload

File upload interface showing upload progress

Users care about completion.

A progress percentage is far more valuable than an infinite spinner.


AI Chat

AI chat interface illustrating token-by-token response streaming

The response is generated token by token.

The best loading state may be…

No loading state at all.

Streaming content often feels more natural than waiting for completion.

Same prompt.

Four different answers.


Invisible Constraints

Modern coding agents rarely work in an empty project.

They're usually analyzing an existing codebase.

That changes everything.

Before writing a loading component, an agent may inspect:

  • Existing design system
  • UI library
  • Component naming conventions
  • Theme tokens
  • Accessibility helpers
  • Animation utilities
  • Existing Loader component
  • Storybook documentation
  • ESLint rules
  • TypeScript configuration

If the project already contains:

<LoadingSpinner size="md" />
Enter fullscreen mode Exit fullscreen mode

creating another spinner component would actually be a bad decision.

The best code is often the code that isn't written.


The Accessibility Decision

Loading indicators aren't only visual.

Screen readers also need to understand what's happening.

An experienced engineer immediately thinks about:

aria-busy="true"
Enter fullscreen mode Exit fullscreen mode

or

role="status"
Enter fullscreen mode Exit fullscreen mode

or announcing completion once loading finishes.

An AI agent trained on production-quality patterns may include these automatically.

Not because the prompt requested accessibility.

Because accessibility is part of good engineering.


Performance Is Also a Design Decision

Performance Is Also a Design Decision

Suppose your skeleton consists of twenty animated placeholders.

Each uses gradients.

Each animates indefinitely.

Looks beautiful.

Now place fifty of them inside a virtualized table.

Suddenly your loading animation becomes one of the most expensive parts of the page.

Good loading components should disappear quickly.

That doesn't mean they should be expensive while they're alive.


Design Systems Change the Question

In mature engineering organizations, developers rarely ask:

"Should we use a spinner or a skeleton?"

That decision has often already been made.

A well-designed Design System defines when each feedback pattern should be used, creating consistency across the entire product.

For example, the guidelines might look something like this:

Component When to use
Spinner When the duration of an operation is unknown.
Skeleton When replacing content that hasn't loaded yet.
Progress Bar When the application can measure how much work remains.
Linear Progress For background operations that shouldn't interrupt the user.
Toast To communicate that an operation has completed successfully.

These aren't hard rules.

They're conventions that help every team build a consistent user experience.

An AI agent working inside an established codebase isn't inventing a loading pattern from scratch.

Instead, it's looking for the product's existing language.


If the Design System already defines that lists always use skeletons, generating a spinner would actually be the wrong decision - even if it technically works.

This is one of the biggest differences between writing code and building products.

The correct answer isn't always the one that solves the problem.

It's the one that solves the problem the same way the rest of the product does.

Understanding those conventions often matters more than understanding React itself.


What Actually Happened Inside the Agent?

From the outside, it looks like this:

Prompt
  ↓
Code
Enter fullscreen mode Exit fullscreen mode

Reality is much closer to this:

Prompt
  ↓
Understand intent
  ↓
Identify user experience
  ↓
Inspect project conventions
  ↓
Find reusable components
  ↓
Evaluate accessibility
  ↓
Evaluate performance
  ↓
Choose loading strategy
  ↓
Generate implementation
Enter fullscreen mode Exit fullscreen mode

The code is almost the final step.


The interesting work happened long before.


How to Apply This Today

The next time you ask an AI agent to build something, don't stop at the generated code.

Instead, ask questions like:

  • Why did you choose a spinner?
  • Why not a skeleton?
  • What alternatives did you consider?
  • What assumptions did you make?
  • What information was missing from my prompt?
  • How would this change for a mobile app?
  • Would your decision be different if this were a design system component?

These follow-up questions expose the reasoning behind the implementation.

And that's often more valuable than the code itself.

The goal isn't to make the AI justify every line.

It's to understand the trade-offs that led to the solution.

That's how you move from using AI as an autocomplete tool to collaborating with it as an engineering partner.


Final Thoughts

A loading component seems trivial.

It's one of the first things most frontend developers learn to build.

But it's also a perfect example of something larger.

The prompt may contain only seven words:

"Create a loading component."

Yet those seven words trigger dozens of engineering decisions.

Some relate to UX.

Others to accessibility.

Some to performance.

Others to consistency with an existing design system.

The component you see is only the visible result of those decisions.

The real work happened long before the first return ( appeared in the editor.

That's what Beyond the Prompt is really about.

Not the prompts we write.

But the engineering decisions that happen after them.

Because once you start seeing those invisible decisions, you'll realize something important:

Great AI-assisted development isn't about getting code faster. It's about understanding why that code was the right choice in the first place.

Top comments (0)