agentleFS
RBraga01RBraga01/builder-design/skills/ai-states-required/SKILL.md

ai-states-required

Skill2 starsChanged 6 months agoMITView on GitHub

Use before writing any code for an AI feature's UI. All 7 states must be designed and documented before implementation begins. Blocks "we'll add loading states later" completions.

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 3 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Every AI feature touchpoint must have a designed state for each:

    line 19
  2. Very specific:

    Create design/ai-states/<feature-name>.md with the state map:

    line 74
  3. Distinctive:

    Before sign-off, verify each of these works:

    line 93
  4. Distinctive:

    When ai-states-required is satisfied, state it like this:

    line 112

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

AI States Required

The Law

AN AI FEATURE WITHOUT DESIGNED STATES IS HALF A FEATURE.
"We'll add error states later" means users see broken UI in production.
"The happy path looks great" is not a UI design — it is a demo.
All 7 states designed, documented, and approved IS a complete AI feature design.

The 7 Required States

Every AI feature touchpoint must have a designed state for each:

StateWhen It AppearsWhat Users Need
LoadingRequest sent, waiting for first tokenProgress signal, estimated wait, cancel option
StreamingTokens arriving, response buildingReadable partial content, clear "generating" signal
SuccessGeneration complete, full response availableResult, confidence signal, actions (copy, retry, share)
ErrorAPI failure, timeout, server errorHuman error message, recovery action, no raw stack trace
PartialModel answered but incompletelyClear indication of incompleteness, option to continue
UncertainLow confidence, hedged responseUncertainty signal, source citation, human review option
EmptyNo input yet / no history / first runGuidance, examples, prompt suggestions — not a blank void

When to Use

Trigger before:

  • Any PR that adds a new AI-powered UI feature
  • Any PR that adds a new model call with user-visible output
  • Designing a new agent interface or chat UI
  • Adding AI capabilities to an existing feature

When NOT to Use

  • Background AI jobs with no user-facing output (batch processing, background classification)
  • Developer-only tooling where no end user sees the output

The Process

Step 1 — List Every AI Touchpoint

Map every place the user will see model output in this feature:

  • Main response area
  • Any inline predictions (autocomplete, suggestions)
  • Status indicators (sidebar, header badges)
  • Any secondary outputs (citations, related items, follow-up questions)

Each touchpoint needs its own 7-state design.

Step 2 — Design Each State

For each state, define:

  • Visual treatment — skeleton / spinner / streaming cursor / error icon / empty illustration
  • Copy — what the UI says in this state (not placeholder text, actual final copy)
  • Actions — what the user can do from this state
  • Transition — how it moves to the next state
State: Error
Visual: Red border on output area, error icon (⚠), inline message
Copy: "Something went wrong generating your response. Try again or refresh."
Actions: [Try again] [Dismiss]
Transition: Retry → Loading state; Dismiss → Empty state

Step 3 — Document in a State Map

Create design/ai-states/<feature-name>.md with the state map:

## Feature: <name>
### Touchpoint: <main output area>

| State | Visual | Copy | Actions | Transition |
|---|---|---|---|---|
| Loading | Skeleton (3 lines) | "Generating..." | [Cancel] | Cancel → Empty; First token → Streaming |
| Streaming | Streaming cursor, partial text | Live text | [Stop] | Complete → Success; Error → Error |
| Success | Full response | — | [Copy] [Retry] [👍 👎] | Retry → Loading |
| Error | Red border, inline message | "Something went wrong. Try again." | [Try again] | → Loading |
| Partial | Dashed border, "▾ Response cut off" | "Response was cut off. Continue?" | [Continue] [Accept] | Continue → Loading |
| Uncertain | Amber border, ⚠ badge | "Low confidence — verify this." | [Show sources] | — |
| Empty | Prompt suggestions, example queries | "Ask anything about X…" | [Example 1] [Example 2] | User types → Loading |

Step 4 — Review the Edge Cases

Before sign-off, verify each of these works:

  • What if the stream is interrupted mid-word?
  • What if the error message from the API is user-readable vs. a raw 500?
  • What if the model returns an empty string?
  • What if the response is extremely long (>2000 words)?
  • What if the user submits again before the first response finishes?

Rationalization Red Flags

These thoughts mean states were not designed — stop:

  • "We'll add error states in a follow-up" — follow-up PRs for error states ship 3 weeks late, after the first 3am incident
  • "The happy path is what matters for the demo" — users encounter every state; you only rehearsed one
  • "Just show a spinner" — a spinner with no copy, no cancel, and no timeout handling is not a loading state
  • "The streaming state is just the loading state with text" — streaming and loading have different affordances; conflating them produces UI that feels broken
  • "Empty state can be a blank screen with a text input" — blank screens communicate nothing; empty states are onboarding moments

Completion Statement Format

When ai-states-required is satisfied, state it like this:

AI states designed.
Feature: <name>
Touchpoints covered: <N>
State map: design/ai-states/<feature>.md ✓

All 7 states documented for each touchpoint (must match state map file — no vague descriptions):
  Loading: <named element: skeleton/spinner/pulse + exact copy text> ✓
  Streaming: <cursor type + exact copy text> ✓
  Success: <actions listed: Copy / Retry / 👍 👎 + copy text if any> ✓
  Error: <border colour + icon + exact error copy + recovery action label> ✓
  Partial: <dashed/truncated indicator + exact copy + continuation action label> ✓
  Uncertain: <amber bar / ⚠ badge + exact verify copy + next-action label> ✓
  Empty: <illustration type + exact heading copy + N example prompts listed> ✓

Edge cases reviewed: stream interruption, empty response, duplicate submit ✓

Why This Matters

AI features fail visually in ways deterministic software does not. A form either submits or fails. An LLM call can stream, stall, truncate, hallucinate, refuse, or produce an empty response — and users see all of these. Designing only the success state means every other state ships as broken UI.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.