oneie 3.6.20 → 3.6.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,160 @@
1
+ # Design Patterns
2
+
3
+ Reusable patterns for consistent, accessible, and performant UI design across the ONE Platform.
4
+
5
+ ## Overview
6
+
7
+ This directory contains proven design patterns that accelerate decision-making and reduce reinvention. Each pattern maps to specific use cases in the 6-dimension ontology.
8
+
9
+ ## Patterns
10
+
11
+ ### Wireframe Template
12
+
13
+ **Reference:** `wireframe-template.md`
14
+
15
+ Create visual representations of feature interfaces that satisfy user flows and acceptance criteria. Maps to:
16
+ - **Things:** Entities displayed in the interface
17
+ - **Connections:** Relationships shown between entities
18
+ - **Events:** Actions available to users
19
+ - **Knowledge:** Labels and categories for entities
20
+
21
+ **Use when:** Starting design work for a new feature, designing multiple screens, need to validate layout hierarchy.
22
+
23
+ ### Component Architecture
24
+
25
+ **Reference:** `component-architecture.md`
26
+
27
+ Compose React components from shadcn/ui primitives using a layered architecture:
28
+ 1. **Atoms:** Base shadcn/ui components (Button, Input, Card)
29
+ 2. **Patterns:** Combine atoms into domain-specific components (ProductCard, UserProfile)
30
+ 3. **Features:** Combine patterns into page layouts
31
+ 4. **Pages:** Astro pages with SSR data fetching
32
+
33
+ **Use when:** Designing reusable component libraries, defining component hierarchies, planning implementation structure.
34
+
35
+ ### Test-Driven Design Pattern
36
+
37
+ **Reference:** `test-driven-design-pattern.md`
38
+
39
+ Design interfaces driven by acceptance criteria, ensuring every design decision enables tests to pass.
40
+
41
+ **Process:**
42
+ 1. Read test thing (user flows, acceptance criteria)
43
+ 2. For each criterion, identify corresponding UI element
44
+ 3. Map wireframe screens to test flows
45
+ 4. Validate all criteria are satisfied
46
+
47
+ **Use when:** Starting from quality agent's test definitions, ensuring design-test alignment, validating completeness.
48
+
49
+ ## Design System Reference
50
+
51
+ **Comprehensive specification:** `one/knowledge/develop/design.md`
52
+
53
+ Contains:
54
+ - Design tokens (colors, spacing, typography, motion)
55
+ - Color modes (light/dark)
56
+ - Typography scale and best practices
57
+ - Spacing rhythm and grid system
58
+ - Button variants and states
59
+ - Component language principles
60
+ - Interaction rules and accessibility guidelines
61
+ - Implementation playbook
62
+ - QA checklist
63
+
64
+ ## Common Design Decisions
65
+
66
+ ### Question: What layout pattern should I use?
67
+
68
+ **Answer depends on:**
69
+ 1. **Primary user goal** - Create, read, update, delete, browse, search
70
+ 2. **Content type** - Article, table, grid, form, dashboard
71
+ 3. **Density** - Content-heavy, moderate, sparse
72
+ 4. **Entity types involved** - Things being displayed/edited
73
+
74
+ **Pattern recommendations:**
75
+ - **Form-based (create/edit):** Centered single column with max-w-2xl
76
+ - **List/browse:** Grid of cards with filters or table with pagination
77
+ - **Detail view:** Hero section + content sections + sidebar
78
+ - **Dashboard:** Sidebar + main area with card grid
79
+ - **Content-heavy:** 3-column [nav | content | meta]
80
+
81
+ ### Question: What components should I use?
82
+
83
+ **Start with shadcn/ui:**
84
+ - Card, Button, Badge, Avatar (structure)
85
+ - Input, Label, Select, Textarea (forms)
86
+ - Dialog, Drawer, Popover, Tooltip (overlays)
87
+ - Table, Pagination, Dropdown (data)
88
+ - Toast, Alert, Progress, Skeleton (feedback)
89
+
90
+ **Compose into domain patterns:**
91
+ - Don't create ProductCard, CourseCard, UserCard
92
+ - Create generic ThingCard that accepts a type prop
93
+ - Extract reusable patterns; minimize custom components
94
+
95
+ ### Question: How do I ensure accessibility?
96
+
97
+ **Checklist:**
98
+ - [ ] Contrast AA+ (4.5:1 body, 3:1 large)
99
+ - [ ] Keyboard navigation (Tab, Enter, Escape)
100
+ - [ ] Focus states visible (outline/ring)
101
+ - [ ] ARIA labels on interactive elements
102
+ - [ ] Form labels associated with inputs
103
+ - [ ] Error messages announced to screen readers
104
+ - [ ] Loading states communicated
105
+ - [ ] Motion respects prefers-reduced-motion
106
+
107
+ ### Question: What about responsive design?
108
+
109
+ **Mobile-first approach:**
110
+ 1. Design for 320px (mobile)
111
+ 2. Enhance at 768px (tablet)
112
+ 3. Optimize at 1024px+ (desktop)
113
+
114
+ **Use Tailwind responsive variants:**
115
+ - `sm:` (640px)
116
+ - `md:` (768px)
117
+ - `lg:` (1024px)
118
+ - `xl:` (1280px)
119
+ - `2xl:` (1536px)
120
+
121
+ ## Integration with Agent-Designer
122
+
123
+ The agent-designer uses these patterns to:
124
+ 1. **Create wireframes** - Maps user flows to screens using layout patterns
125
+ 2. **Define components** - Composes shadcn/ui into domain patterns
126
+ 3. **Set tokens** - Generates design tokens from group brand guidelines
127
+
128
+ **Agent uses these patterns as knowledge chunks for:**
129
+ - Layout recommendations
130
+ - Component composition advice
131
+ - Accessibility validation
132
+ - Performance optimization
133
+
134
+ ## Related Documentation
135
+
136
+ - **Design System:** `one/knowledge/develop/design.md` - Complete token and guideline specifications
137
+ - **Frontend Architecture:** `one/knowledge/architecture-frontend.md` - Astro + React implementation patterns
138
+ - **Agent-Designer:** `.claude/agents/agent-designer.md` - Design agent responsibilities and workflows
139
+ - **Quality Guidelines:** `one/knowledge/quality-loop.md` - Testing and validation patterns
140
+
141
+ ## Golden Rules
142
+
143
+ 1. **Design is not decoration** - Every element must enable a user flow or test
144
+ 2. **Use proven patterns** - Minimize custom components; compose existing ones
145
+ 3. **Accessibility first** - WCAG AA compliance is non-negotiable
146
+ 4. **Token-driven** - Pull colors/spacing from design system, never hard-code
147
+ 5. **Test-driven** - Map each acceptance criterion to a UI element
148
+ 6. **Responsive by default** - Mobile-first thinking in every design
149
+ 7. **Reusable knowledge** - Store patterns as knowledge chunks for future designs
150
+
151
+ ## Contributing to Design Patterns
152
+
153
+ When you discover a proven pattern:
154
+ 1. Document it with context (when to use, why it works)
155
+ 2. Create wireframe or component example
156
+ 3. Add accessibility notes
157
+ 4. Store as knowledge chunk for RAG
158
+ 5. Link to related patterns
159
+
160
+ Patterns evolve. Update them as the platform grows and user needs change.