UX Layer Skill
Layer Number: 09
Specification: Metadata Model Spec v0.7.0
Purpose: Defines user experience using Three-Tier Architecture, specifying views, components, state machines, and interactions.
Layer Overview
The UX Layer captures user experience design:
- VIEWS - Routable screens/pages with layouts
- COMPONENTS - UI components (forms, tables, charts, cards)
- STATE MACHINES - Experience states and transitions
- ACTIONS - Interactive elements (buttons, links, voice commands)
- VALIDATION - Client-side validation rules
- LAYOUTS - Layout configurations (grid, flex, etc.)
This layer uses Three-Tier Architecture (v0.5.0+):
- Library Tier - Reusable design system components
- Application Tier - Application-wide configuration
- Experience Tier - Experience-specific views and flows
Central Entity: The View (routable screen) is the core modeling unit.
Entity Types
Three-Tier Architecture (26 entities)
Library Tier:
- UXLibrary - Container for library components
- LibraryComponent - Reusable component (form-field, table, chart, card)
- LibrarySubView - Reusable component groupings
- StatePattern - Reusable state machine patterns
- ActionPattern - Reusable action definitions
Application Tier:
- UXApplication - Application-wide UX configuration
Experience Tier:
- UXSpec - Container for experience specification
- View - Routable screen/page
- SubView - Component grouping within view
- ComponentInstance - Instance of library component
- ActionComponent - Interactive element
- ExperienceState - State in state machine
- StateAction - Action during state lifecycle
- StateTransition - Transition between states
- ValidationRule - Client-side validation
When to Use This Skill
Activate when the user:
- Mentions "UX", "UI", "view", "screen", "component", "form"
- Wants to define user interfaces or user experiences
- Asks about state machines, transitions, or user flows
- Needs to model screens, forms, or interactive elements
- Wants to link UX to navigation, APIs, or business processes
Cross-Layer Relationships
Outgoing (UX → Other Layers):
motivation.* → Motivation Layer (UX supports goals)
business.* → Business Layer (UX realizes business processes)
api.* → API Layer (API calls from components)
data.* → Data Model Layer (form validation rules)
navigation.* → Navigation Layer (routing to views)
Incoming (Other Layers → UX):
- Navigation Layer → UX (routes point to views)
- Business Layer → UX (business processes trigger UX flows)
Design Best Practices
- Reusability - Use library components for consistency
- State machines - Model complex flows with states/transitions
- Validation - Add client-side validation rules
- Accessibility - Consider accessibility requirements
- Responsive - Design for multiple screen sizes
- Performance - Set performance targets (load time, interaction latency)
- Error handling - Define error states and messages
Common Commands
# Add view
dr add ux view --name "User Profile" --property route=/profile
# Add component instance
dr add ux component-instance --name "Profile Form"
# List views
dr list ux view
# Validate UX layer
dr validate --layer ux
# Export UX documentation
dr export --layer ux --format markdown
Example: Login View
id: ux.view.login
name: "Login View"
type: view
properties:
route: /login
layout:
type: centered
maxWidth: 400px
components:
- id: login-form
componentRef: library.component.form-field
dataBinding:
source: api.operation.login
submitAction: POST /api/auth/login
fields:
- name: email
type: email
required: true
validation:
- type: email-format
- type: required
- name: password
type: password
required: true
validation:
- type: min-length
value: 8
actions:
- id: submit-button
type: button
label: "Login"
action: submit-form
target: login-form
- id: forgot-password
type: link
label: "Forgot password?"
navigation: /forgot-password
states:
- id: idle
initial: true
onEnter: []
- id: submitting
onEnter:
- action: disable-form
- action: show-spinner
- id: success
onEnter:
- action: navigate
target: /dashboard
- id: error
onEnter:
- action: show-error
- action: enable-form
transitions:
- from: idle
to: submitting
trigger: submit
- from: submitting
to: success
trigger: success
- from: submitting
to: error
trigger: failure
- from: error
to: idle
trigger: retry
motivation:
supports-goals:
- motivation.goal.user-authentication
api:
operationId: login
navigation:
route-ref: navigation.route.login
Pitfalls to Avoid
- ❌ Not using library components (inconsistent UX)
- ❌ Missing validation rules (poor user experience)
- ❌ Complex state machines without documentation
- ❌ Not linking to API operations or navigation routes
- ❌ Missing error states and handling
- ❌ No performance targets defined
1---2name: layer-09-ux3description: Expert knowledge for UX Layer modeling in Documentation Robotics4---5
6# UX Layer Skill
7
8**Layer Number:** 09
9**Specification:** Metadata Model Spec v0.7.0
10**Purpose:** Defines user experience using Three-Tier Architecture, specifying views, components, state machines, and interactions.
11
12---
13
14## Layer Overview
15
16The UX Layer captures **user experience design**:
17
18- **VIEWS** - Routable screens/pages with layouts
19- **COMPONENTS** - UI components (forms, tables, charts, cards)
20- **STATE MACHINES** - Experience states and transitions
21- **ACTIONS** - Interactive elements (buttons, links, voice commands)
22- **VALIDATION** - Client-side validation rules
23- **LAYOUTS** - Layout configurations (grid, flex, etc.)
24
25This layer uses **Three-Tier Architecture** (v0.5.0+):
26
271. **Library Tier** - Reusable design system components
282. **Application Tier** - Application-wide configuration
293. **Experience Tier** - Experience-specific views and flows
30
31**Central Entity:** The **View** (routable screen) is the core modeling unit.
32
33---
34
35## Entity Types
36
37### Three-Tier Architecture (26 entities)
38
39**Library Tier:**
40
41- **UXLibrary** - Container for library components
42- **LibraryComponent** - Reusable component (form-field, table, chart, card)
43- **LibrarySubView** - Reusable component groupings
44- **StatePattern** - Reusable state machine patterns
45- **ActionPattern** - Reusable action definitions
46
47**Application Tier:**
48
49- **UXApplication** - Application-wide UX configuration
50
51**Experience Tier:**
52
53- **UXSpec** - Container for experience specification
54- **View** - Routable screen/page
55- **SubView** - Component grouping within view
56- **ComponentInstance** - Instance of library component
57- **ActionComponent** - Interactive element
58- **ExperienceState** - State in state machine
59- **StateAction** - Action during state lifecycle
60- **StateTransition** - Transition between states
61- **ValidationRule** - Client-side validation
62
63---
64
65## When to Use This Skill
66
67Activate when the user:
68
69- Mentions "UX", "UI", "view", "screen", "component", "form"
70- Wants to define user interfaces or user experiences
71- Asks about state machines, transitions, or user flows
72- Needs to model screens, forms, or interactive elements
73- Wants to link UX to navigation, APIs, or business processes
74
75---
76
77## Cross-Layer Relationships
78
79**Outgoing (UX → Other Layers):**
80
81- `motivation.*` → Motivation Layer (UX supports goals)
82- `business.*` → Business Layer (UX realizes business processes)
83- `api.*` → API Layer (API calls from components)
84- `data.*` → Data Model Layer (form validation rules)
85- `navigation.*` → Navigation Layer (routing to views)
86
87**Incoming (Other Layers → UX):**
88
89- Navigation Layer → UX (routes point to views)
90- Business Layer → UX (business processes trigger UX flows)
91
92---
93
94## Design Best Practices
95
961. **Reusability** - Use library components for consistency
972. **State machines** - Model complex flows with states/transitions
983. **Validation** - Add client-side validation rules
994. **Accessibility** - Consider accessibility requirements
1005. **Responsive** - Design for multiple screen sizes
1016. **Performance** - Set performance targets (load time, interaction latency)
1027. **Error handling** - Define error states and messages
103
104---
105
106## Common Commands
107
108```bash
109# Add view
110dr add ux view --name "User Profile" --property route=/profile
111
112# Add component instance
113dr add ux component-instance --name "Profile Form"
114
115# List views
116dr list ux view
117
118# Validate UX layer
119dr validate --layer ux
120
121# Export UX documentation
122dr export --layer ux --format markdown
123```
124
125---
126
127## Example: Login View
128
129```yaml
130id: ux.view.login
131name: "Login View"
132type: view
133properties:
134 route: /login
135 layout:
136 type: centered
137 maxWidth: 400px
138 components:
139 - id: login-form
140 componentRef: library.component.form-field
141 dataBinding:
142 source: api.operation.login
143 submitAction: POST /api/auth/login
144 fields:
145 - name: email
146 type: email
147 required: true
148 validation:
149 - type: email-format
150 - type: required
151 - name: password
152 type: password
153 required: true
154 validation:
155 - type: min-length
156 value: 8
157 actions:
158 - id: submit-button
159 type: button
160 label: "Login"
161 action: submit-form
162 target: login-form
163 - id: forgot-password
164 type: link
165 label: "Forgot password?"
166 navigation: /forgot-password
167 states:
168 - id: idle
169 initial: true
170 onEnter: []
171 - id: submitting
172 onEnter:
173 - action: disable-form
174 - action: show-spinner
175 - id: success
176 onEnter:
177 - action: navigate
178 target: /dashboard
179 - id: error
180 onEnter:
181 - action: show-error
182 - action: enable-form
183 transitions:
184 - from: idle
185 to: submitting
186 trigger: submit
187 - from: submitting
188 to: success
189 trigger: success
190 - from: submitting
191 to: error
192 trigger: failure
193 - from: error
194 to: idle
195 trigger: retry
196 motivation:
197 supports-goals:
198 - motivation.goal.user-authentication
199 api:
200 operationId: login
201 navigation:
202 route-ref: navigation.route.login
203```
204
205---
206
207## Pitfalls to Avoid
208
209- ❌ Not using library components (inconsistent UX)
210- ❌ Missing validation rules (poor user experience)
211- ❌ Complex state machines without documentation
212- ❌ Not linking to API operations or navigation routes
213- ❌ Missing error states and handling
214- ❌ No performance targets defined