Skip to content
Skills Library
Programming · Planning

ui-engineering

/ui-engineering

Use when the question is how interface should be BUILT — component boundaries, state that belongs in the URL vs the component, loading/empty/error states, forms, optimistic updates, build vs adopt. NOT the visual system (`design`), NOT framework mechanics (`react`/`nextjs`).

Repository
rsc-harness ↗
Licence
MIT
Last repository change
25.10.2026

Assessment and security

90/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content25 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
2
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 25.10.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Use when the question is how interface should be BUILT — component boundaries, state that belongs in the URL vs the component, loading/empty/error states, forms, optimistic updates, build vs adopt. NOT the visual system (`design`), NOT framework mechanics (`react`/`nextjs`).

Original author description

Use when the question is how interface should be BUILT — component boundaries, state that belongs in the URL vs the component, loading/empty/error states, forms, optimistic updates, build vs adopt. NOT the visual system (`design`), NOT framework mechanics (`react`/`nextjs`).

How it works

  1. The one rule
  2. Every state, not just the happy one
  3. Component boundaries
  4. Forms
  5. Optimistic updates
  6. Build or adopt
  7. Anti-patterns → STOP
  8. See Also
Original SKILL.md headings · 106 lines, 996 words
SKILL.md preview
---
name: ui-engineering
description: "Use when the question is how interface should be BUILT — component boundaries, state that belongs in the URL vs the component, loading/empty/error states, forms, optimistic updates, build vs adopt. NOT the visual system (`design`), NOT framework mechanics (`react`/`nextjs`)."
tags: [interface, frontend, architecture, components, state, craft]
recommends: [design]
profiles: [core, full]
origin: risco
---

# UI engineering — the decisions between the design and the framework

There is a layer that neither the design skill nor the framework skill owns. The design says what
the screen should be. The framework says how its API works. **In between sits every decision that
makes an interface either durable or a maintenance tax** — and it is where most interface work
actually goes wrong.

Nothing here is framework-specific. These decisions are the same in React, Vue, Svelte, SwiftUI and
plain HTML; only the syntax moves.

## The one rule

**State goes to the outermost place that still needs it, and no further.** Almost every interface
tangle is that rule broken in one of two directions: state hoarded in a component that others need,
or state hoisted into a global store that only one component ever reads.

| Where the state lives | When that is right |
| --- | --- |
| **The URL** | Anything a user would bookmark, share, or expect the back button to restore: filters, tabs, pagination, the open item |
| **The server** | Anything that outlives the session or belongs to more than one user |
| **A shared parent** | Two siblings genuinely need it, and it dies with the screen |
| **The component** | Nobody else reads it: hover, focus, an open menu, an in-flight draft |

The most common and most expensive mistake is the first row: state that belongs in the URL kept in a
component. It looks fine until someone reloads, shares a link, or presses back — and then the
interface silently loses what the user did.

## Every state, not just the happy one

An interface is not finished when it renders data. It is finished when it renders **all five**:

| State | The question it answers | The usual failure |
| --- | --- | --- |
| **Loading** | "Is it working?" | A spinner where the shape is already known — use the shape |
| **Empty** | "Is it broken, or is there nothing?" | Blank. It must say which, and what to do next |
| **Error** | "What now?" | A message with no action. Every denial carries its own way out |
| **Partial** | "Some of it failed" | Ignored entirely; the screen shows a half-truth |
| **Success** | "It worked" | Silence, so the user does it twice |

The empty state is the one that gets skipped, and it is the first state a new user ever sees.

## Component boundaries

A component earns its existence by **hiding a decision**, not by being reused. Splitting for reuse
alone produces the worst interfaces: a wrapper around a wrapper, each passing props through, none
owning anything.

Draw the boundary where:

- it owns a piece of state nothing outside needs;
- it can be described in one sentence without "and";
- swapping its internals changes nothing outside it.

Do **not** draw a boundary because a file is long. Long is not a defect; a file that does two
unrelated things is, and it is usually short.

## Forms

Forms are where interfaces most often insult people, and the rules are unglamorous:

- **Validate on blur, not on keystroke.** Telling someone their email is invalid while they are on
  the third character is scolding them for not having finished.
- **Never clear what they typed.** Not on error, not on refresh, not on navigation. Their input is
  theirs.
- **Disable the submit only while submitting**, never as a way of enforcing validity — a disabled
  button with no reason is a dead end.
- **The error goes next to the field**, and says what to do, not what is wrong.

## Optimistic updates

Show the result before the server confirms **only** when you can honestly undo it. That means: the
operation is idempotent, the failure is rare, and reverting it is visible and comprehensible.

Optimism on a destructive or an expensive action is a lie you will have to retract in front of the
user. Deleting, paying, sending — those wait.

## Build or adopt

Adopting a component costs bundle size, an API you did not design, and an upgrade you will owe
later. Building costs the accessibility work you will get wrong.

The split is not about difficulty, it is about **who is the authority on the behaviour**:

- **Adopt** for behaviour with a specification you would otherwise be reimplementing badly: focus
  trapping, combobox semantics, date handling, virtualisation.
- **Build** for anything that is your product's own logic wearing a UI, or where the library gives
  you 60% and you fight the remaining 40% forever.

## Anti-patterns → STOP

| If you're about to… | Reality / Fix |
| --- | --- |
| Put a filter or tab selection in component state | It belongs in the URL. Reload, share and back are part of the interface. |
| Add a global store because passing props feels tedious | Tedious is not broken. Global state that one component reads is a leak with ceremony. |
| Ship a screen with only the loaded state | Loading, empty, error and partial are not extras. The empty one is what a new user sees first. |
| Split a component because the file got long | Length is not the defect. Two unrelated responsibilities are, and they are usually short. |
| Show a delete as done before the server confirms | Optimism on a destructive action is a lie you will retract in public. |
| Reach here for how the framework's hooks work | That is `../react/SKILL.md` or `../nextjs/SKILL.md`. This skill decides what to build; those decide how to express it. |

## See Also

- `../design/SKILL.md` — the visual system these decisions serve, its motion layer, and the
  browser-measured critique that judges the result.
- `../accessibility/SKILL.md` — the ground under focus, semantics and forms.
Files in this package (2)
  • SKILL.md 6 KB
  • evals/cases.yaml 2 KB

Versions

The database has no other skills named ui-engineering.

Database snapshot: 13.11.2026 · package version 7cbaa138d362 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 1 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100crud-ui
    Use when a data-backed app needs a working interface — a list people can add to, edit, and delete from, with the states that make it feel finished. Pairs with data-modeling, which defines the entities; this covers the React side: optimistic updates, forms, loading / empty /…
  • 100react-development
    Use when implementing or reviewing React components, hooks, state ownership, forms, rendering performance, error boundaries, or component tests. Use nextjs-app-router for Next.js server boundaries and ux-content-strategy for product content systems.
  • 90react-nextjs
    Implement or review a React or Next.js feature in an existing codebase. Use when changing components, routing, rendering boundaries, data loading, forms, state, accessibility, or performance.
  • 100frontend-patterns
    Framework-neutral frontend architecture decisions - where state lives, server-state fetching and caching, loading/error/empty states, forms and validation, routing and URL state, styling approach, code splitting, client-side security. Use when planning, building or reviewing UI…
  • 90state-management
    Use when deciding where state lives, how it propagates, and how it composes: local component state vs lifted/shared state vs application state, server state vs client state, URL as state, persistent state, derived state, and the cross-cutting decision of who owns which piece.…
  • 100frontend-patterns
    Use when building Livewire/Blade/Alpine UI in a Laravel app — component composition, state placement, performance, forms, and loading/empty/error states.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.