Files
bortstack-forge/skills/frontend-ui-design/SKILL.md
T

477 lines
21 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
name: frontend-ui-design
description: Specify implementation-level layout, information hierarchy, interactions, components, responsive behavior and UI states within an approved web design direction. Use existing design systems and component patterns, including React-Bootstrap when present. Route BortStack concept exploration, design approval and design handoff to bortstack-design, implementation to webapp-feature, and browser verification to frontend-visual-qa.
---
# Frontend UI Design
Version: **2.0**.
Design the user interface **before implementation interrupts the engineering flow**. Turn a feature/page requirement into an implementation-ready composition: information hierarchy, page regions, actions, responsive behavior, states, suitable reusable components, and accessibility/interaction expectations.
Use `bortstack-design` for BortStack concepts, approval and design handoff. Use `webapp-feature` for authorised implementation and `frontend-visual-qa` for independent browser verification. For project scaffolding, use `roborto-new-project` as the temporary route.
## Repository workflow
In a BortStack project, use `bortstack-context` with the applicable repository `AGENTS.md` before task work. They govern scope and authorisation, branch/worktree policy, lifecycle, manual acceptance, and handoff. Find the maintained overview, current state, decisions, task and handoff records through repository instructions and layout. Use the paths and task IDs the project already uses. Follow context's canonical discussion, mission and lifecycle guidance when interpreting authority or changing task status. If a required BortStack skill is unavailable, report the dependency. If an installed skill lacks a required reference, use the reference from a verified Forge package with a matching manifest. If the required guidance is unavailable, pause the affected action.
For edits, inspect Git status and worktrees, confirm authorised scope and the source candidate, and follow the current branch policy. Use direct integration-branch work where authorised and a dedicated branch/worktree where required. Preserve unrelated work. Read-only specialist work does not require a new worktree. When acting as an authorised contributor, use `bortstack-contributor` for contributor permissions, finalisation and submission. For ordinary specialist work, use the project's normal authority.
When manual testing is relevant, discover the documented commands, configuration and hooks in the target repository. Use its supported workflow, including an existing `testtask` wrapper and its project-specific config or hook where documented. Preserve a working adapter and its supported invocation. Before use, inspect its supported arguments, candidate handling, runtime and cleanup behavior. If no adapter is required, use the established development environment. Record candidate identity, actual checks, limitations and pending human acceptance in the project's handoff. Refresh stale candidates after edits and make fixes in the authoritative source. A source snapshot, wrapper, automated check or startup alone does not establish a manual pass. Follow context and repository rules for task transitions and closure.
Outside BortStack, follow the repository's own scope, branch, test and reporting conventions and proceed with the specialist workflow. BortStack skills and records are optional there.
## Core operating rule
Default to a read-only implementation specification. Start with the project's visual authority, such as approved design source/version, tokens, component and layout guides, and established screens. In BortStack, obtain the approved handoff or confirm a recorded, task-specific override through `bortstack-context` before design-dependent implementation. Route missing direction, material departures, concept alternatives and approval back to `bortstack-design`. A request to design and implement together still follows the project's approval and implementation gates.
Outside BortStack, use the project's design and approval process. If there is no design system, use restrained local component and layout defaults within the user's agreed direction and surface decisions that need agreement.
## Core rules
1. **Read repository instructions and UI context first.** Obey `AGENTS.md`, maintained project records, task scope, approved screenshots/mockups, design-system docs, component-library docs, layout guides, existing pages, and repository conventions.
2. **Design around the user's task, not visual novelty.** Optimize clarity, hierarchy, usability, consistency, responsiveness, and implementation practicality.
3. **Extend before redesigning.** If the application already has an approved visual language, compose the new UI from it. Do not modernize or restyle the application without explicit authorization.
4. **Resolve local defaults within the approved direction.** Use restrained, conventional UI/UX patterns when that direction leaves an implementation detail open.
5. **Prefer existing components.** Reuse shared components and existing React-Bootstrap patterns before proposing new primitives.
6. **React-Bootstrap is the preferred foundation when the repository uses it.** Prefer its layout/form/navigation/feedback primitives and Bootstrap responsive conventions rather than recreating generic UI controls from scratch.
7. **Do not force Bootstrap aesthetics.** React-Bootstrap provides structure and behavior; the project's visual tokens, SCSS/modules, typography, colors, spacing, and established components define the application's identity.
8. **Design all relevant states.** Do not specify only the ideal populated state. Consider loading, empty, error, validation, success, disabled, permission, destructive-confirmation, and responsive states as applicable.
9. **Design responsive behavior explicitly.** State what changes at broad desktop, intermediate/tablet, and narrow/mobile widths where relevant. Do not rely on “Bootstrap will handle it”.
10. **Use semantic interaction patterns.** Buttons should be actions, links should navigate, fields should be labelled, destructive actions should be clear, and clickable containers should not substitute for proper controls without a justified pattern.
11. **Keep cognitive load low.** Prioritize primary actions and information. Do not expose every secondary option at equal visual weight.
12. **Choose patterns based on content and workflow.** Do not default everything to cards, tables, modals, dashboards, tabs, or sidebars.
13. **Avoid premature custom components.** Introduce a reusable component when repeated semantics/behavior justify it, not merely to reduce a few lines of JSX.
14. **Do not invent product behavior.** When the design depends on unresolved business rules, surface the decision rather than encoding an assumption into the UI.
15. **Accessibility is part of design.** Account for labels, keyboard use, focus, semantics, error communication, touch targets, content order, and non-color-only state cues from the outset.
16. **Keep implementation cost visible.** Prefer a simple composition that solves the task over an elaborate design with little user benefit.
17. **Do not commit, push, deploy, switch branches, or perform production actions unless explicitly requested.**
18. **Do not claim the design was visually verified.** That is `frontend-visual-qa`'s job after implementation.
## Determine the design mode
Use one of these modes based on repository evidence.
### Extend mode
Use when the project already has an established or approved UI language.
Inspect and preserve:
- page shell/container widths;
- navigation/header/footer patterns;
- typography hierarchy;
- spacing rhythm;
- color/theme tokens;
- button hierarchy;
- form conventions;
- cards/tables/lists;
- modal/offcanvas patterns;
- empty/loading/error conventions;
- responsive behavior;
- existing reusable components.
The new page should look like it belongs to the same application.
### Local defaults mode
Use when the approved direction leaves component or layout details open.
Specify only the local defaults needed for coherent implementation:
- page container/gutter convention;
- heading hierarchy;
- primary/secondary/destructive action hierarchy;
- form treatment;
- content grouping;
- basic spacing rhythm;
- responsive composition;
- state-feedback conventions.
Do not attempt to create an exhaustive design system unless asked.
## 1. Understand the user's job-to-be-done
Before drawing a layout in prose, determine:
- who uses this page/feature;
- what they are trying to accomplish;
- the primary action;
- secondary actions;
- information required to make the action safely;
- information that is optional/contextual;
- frequency of use;
- whether users scan, compare, edit, create, monitor, or progress through a sequence;
- whether the flow is novice-oriented, expert/data-dense, or mixed;
- key constraints from task/decisions/backend domain.
Do not start by choosing `Card`, `Table`, or `Modal`. Start with the user task and information hierarchy.
## 2. Inspect the current frontend
Read the relevant repository evidence, such as:
- React routes and page components;
- shared `Layout`, header, nav, footer, page-header components;
- React-Bootstrap imports and usage patterns;
- SCSS/CSS modules and variables/tokens;
- `DESIGN_SYSTEM.md`, `COMPONENT_LIBRARY.md`, `LAYOUT_GUIDE.md`, `STYLING.md`, or equivalents;
- existing pages serving similar jobs;
- approved screenshots/mockups;
- frontend state/data/API contracts needed to understand what information exists.
Prefer adapting an existing strong pattern when one already solves most of the problem.
## 3. Define the information hierarchy
Write the page content in priority order before composing layout.
Classify content/actions roughly as:
- **Primary** — essential goal/action or key information;
- **Secondary** — commonly useful but not dominant;
- **Supporting** — explanation, metadata, help, context;
- **Exceptional** — destructive, uncommon, advanced, or error-recovery actions.
Use hierarchy to determine placement and visual emphasis. Avoid giving every action the same button weight.
## 4. Select the interaction pattern deliberately
Choose the simplest suitable pattern.
Examples:
### List vs table
Prefer a **table** when users need to compare repeated structured attributes across rows and desktop density matters.
Prefer a **list/card/list-group composition** when entries have heterogeneous content, primary actions, or need to adapt strongly on narrow screens.
If a table is necessary on desktop but becomes unusable on mobile, specify the mobile transformation rather than simply allowing horizontal scrolling by default.
### Inline form vs modal vs dedicated page
Prefer **inline** for short, contextual edits with low interruption cost.
Prefer a **modal** for short, self-contained create/edit actions where preserving page context matters.
Prefer a **dedicated page** for complex, multi-section, high-risk, or deep-linkable forms.
Do not put long workflows in a modal merely to avoid creating a route.
### Tabs
Use tabs when several peer views belong to the same object/context and users frequently switch among them.
Do not use tabs to hide unrelated page sections or create an artificial information architecture.
### Offcanvas
Use for secondary navigation/filter/control surfaces, especially where mobile screen space matters. Do not hide primary actions in an offcanvas without reason.
### Cards
Use cards to represent meaningful grouped units. Do not wrap every section in a card by habit.
See `references/pattern-selection.md` for the decision checklist.
## 5. Compose the page
Specify page regions in reading/task order.
A common structure might be:
```text
Application shell
└── Page container
├── Page heading / context
│ ├── title
│ ├── short supporting copy if useful
│ └── primary action
├── optional controls/filter/search
├── feedback/status region
└── primary content
├── empty/loading/error/populated state
└── secondary actions/details
```
This is a starting vocabulary, not a mandatory template.
For each region state:
- purpose;
- contents;
- action hierarchy;
- alignment/grouping;
- relevant React-Bootstrap primitive or existing project component;
- responsive transformation.
## 6. Use React-Bootstrap intentionally
When the project uses React-Bootstrap, prefer the existing library before custom equivalents.
Common foundations include:
- `Container` / existing page container — outer page width/gutters;
- `Row`, `Col` — breakpoint-dependent macro grids;
- `Stack` — simple flex composition and spacing;
- `Button`, `ButtonGroup` — action hierarchy;
- `Form`, `Form.Group`, `Form.Control`, `Form.Select`, validation feedback — forms;
- `Alert` — actionable status/error feedback;
- `Spinner`, `Placeholder` — loading indication where appropriate;
- `Table` — genuinely tabular data;
- `ListGroup` — repeated list content;
- `Card` — semantically grouped content;
- `Modal` — short contextual workflows/confirmations;
- `Offcanvas` — secondary responsive surfaces;
- `Dropdown` — secondary action menus;
- `Nav`, `Navbar`, `Tabs` — navigation only when semantically appropriate;
- `Badge` — compact status/category labels;
- `Pagination` — paginated datasets;
- `Accordion` — optional/repeated disclosure content.
Prefer project wrapper components over raw React-Bootstrap when they already encode the application's style/behavior.
Do not propose a library component merely because it exists.
## 7. Define responsive behavior
Design the transformation, not just three screenshots.
For relevant regions specify:
### Broad desktop
- maximum/content width;
- horizontal grouping;
- density;
- table/grid columns;
- placement of primary action and secondary controls.
### Intermediate/tablet
- what wraps;
- what stacks;
- columns that collapse;
- navigation/filter adaptations;
- labels/actions that need more space.
### Narrow/mobile
- reading order;
- full-width vs intrinsic controls;
- whether data presentation changes form;
- compact secondary-action patterns;
- touch-target spacing;
- long text/error behavior;
- modal/offcanvas viability.
Use Bootstrap breakpoints already present in the application when possible. Do not add custom breakpoint complexity without a demonstrated need.
## 8. Define the state matrix
For each important page/region, identify applicable states:
- initial/default;
- loading;
- empty;
- populated;
- partial data;
- validation error;
- server/network error;
- permission/authorization denial;
- success/confirmation;
- disabled/submitting;
- destructive confirmation;
- stale/conflict state if the domain requires it.
Describe what the user sees and what action remains available.
Do not design errors as generic red boxes with no recovery action when the application can provide a useful next step.
See `references/ui-state-checklist.md`.
## 9. Design forms around completion, not fields
For forms:
- group fields by user intent;
- use visible labels;
- distinguish required/optional fields clearly without clutter;
- place help text near the field it explains;
- choose appropriate input types;
- preserve entered data after recoverable validation failures;
- show field-level feedback for field errors and form-level feedback for broader failures;
- make submission state clear;
- prevent accidental duplicate submission where appropriate;
- place destructive actions away from the primary success path;
- use confirmation only when consequence warrants interruption.
Do not overuse multi-step wizards for short forms. Do not make complex workflows one giant undifferentiated form.
## 10. Design actions and feedback
Make the primary action obvious but not visually overwhelming.
Prefer:
- one clear primary action per local context;
- secondary buttons/links for secondary actions;
- dropdown/overflow for infrequent peer actions when density requires it;
- explicit destructive styling/confirmation for irreversible actions;
- feedback near the action/result it belongs to;
- persistent page state after successful minor actions where appropriate rather than unnecessary navigation.
Do not hide important actions behind hover-only behavior.
## 11. Accessibility-by-design checklist
Before approval ensure the specification accounts for:
- semantic controls;
- sensible heading/content order;
- visible labels/accessibility names;
- keyboard operation;
- focus movement for modal/navigation/state changes;
- error association and understandable recovery;
- non-color-only statuses;
- adequate control/touch target sizing;
- readable wrapping/zoom/narrow-width behavior;
- content order that remains logical after responsive stacking.
Do not claim WCAG compliance from design planning alone.
## 12. Decide what should become reusable
Recommend a shared component only when one or more are true:
- the same semantic pattern already appears repeatedly;
- the new pattern will appear on several pages;
- it carries important behavior/accessibility that should be centralized;
- project consistency would materially benefit.
Examples can include:
- `PageHeader`;
- `EmptyState`;
- `StatusBadge`;
- `ConfirmActionModal`;
- domain-specific row/card primitives.
Do not create generic wrappers around every React-Bootstrap primitive.
## 13. Present the implementation specification
For a design-only pass, output a concise implementation-ready specification with these sections:
### Design mode
Extend or local defaults, with the approved reference or project pattern used.
### User goal
Who is doing what and what is primary.
### Proposed composition
A short hierarchy/tree of page regions.
### Component plan
Map each region to existing project components / React-Bootstrap primitives.
### Responsive behavior
Desktop → intermediate → mobile transformations.
### State matrix
Relevant loading/empty/error/populated/success/etc. behavior.
### Interaction/accessibility notes
Important action, keyboard, focus, confirmation, form, and semantic expectations.
### Reuse/new components
What should be reused and any justified new shared component.
### Decisions needed
Only unresolved choices that materially affect UX/implementation.
### Implementation notes
A compact specification that supplements the approved handoff and that `webapp-feature` can use for authorised implementation.
Proceed to implementation only within authorised scope and after the applicable design gate is satisfied.
## 14. When alternatives are useful
If the approved direction leaves a material implementation choice open, offer at most two or three options within it. In BortStack, route options that change the approved concept, product flow or visual direction to `bortstack-design`.
Alternatives must differ in workflow/information architecture, for example:
- dense comparison table vs responsive item-list workflow;
- split master/detail vs dedicated detail route;
- inline management vs modal-based management.
Do not present arbitrary cosmetic variations such as three different card styles.
For each alternative state:
- best fit;
- tradeoff;
- implementation/maintenance complexity;
- mobile implications.
Recommend one when evidence supports a clear choice.
## 15. If implementation is explicitly requested too
When the user explicitly asks to **design and implement** in one request:
1. complete the design reasoning first;
2. record/confirm any required decisions;
3. use `webapp-feature` methodology for implementation;
4. preserve task scope;
5. run automated validation;
6. use/recommend `frontend-visual-qa` for actual visual verification.
Do not silently collapse design and implementation into ad hoc JSX construction.
## 16. Record decisions and evidence
Keep the specification within the authorised scope. Send durable UI decisions and changes in approval back through the project’s decision process. Use `bortstack-context` for task and handoff records in BortStack. Record the approved reference/version or explicit override, open implementation decisions and the evidence needed for later QA.
## 17. Stop conditions
Stop and ask/present a decision when:
- two interaction patterns have materially different product consequences;
- required business rules are unresolved;
- the existing design source of truth conflicts internally;
- a requested design would require removing/changing established functionality;
- a responsive transformation changes what information/actions users can access;
- implementation would require a backend/API capability that does not exist and is outside the task;
- the user requested design-only and the implementation-ready specification is complete.
Do not use uncertainty as an excuse to ask about minor spacing or conventional choices that can be resolved safely from project patterns.
## 18. Completion report
For a design-only task, report:
1. design mode and evidence inspected;
2. user goal and primary action;
3. proposed layout/composition;
4. component/React-Bootstrap plan;
5. responsive behavior;
6. UI state behavior;
7. interaction/accessibility expectations;
8. reusable components proposed;
9. unresolved decisions, if any;
10. recommended next skill: normally `webapp-feature`, followed by `frontend-visual-qa` after implementation.
Do not report code changes when none were requested.