Compare commits
211 Commits
0d42db7111
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| d7888071b8 | |||
| 5040b9a9fd | |||
| c778d79aec | |||
| 28d2ae61ff | |||
| c651f0ed44 | |||
| d478276c3b | |||
| 46c049def0 | |||
| 98442c0f9f | |||
| 82fcd6bc94 | |||
| 9d153e95d1 | |||
| e452b66a7f | |||
| edc1327987 | |||
| 72d159484f | |||
| cb1c958f68 | |||
| 6bf5a6b6b2 | |||
| 3ddd4ecdbd | |||
| d403e96d34 | |||
| 3773268706 | |||
| b13252be71 | |||
| 3ae4abeb9f | |||
| 1fc2ba2385 | |||
| 30511cac81 | |||
| 95ea088a00 | |||
| a1f7088b48 | |||
| 012c905c90 | |||
| 5806f7a134 | |||
| 9f2be70fd6 | |||
| 9186be7e3e | |||
| 9baa6e605b | |||
| 8b79f7b273 | |||
| 134e41f4f9 | |||
| 62c0d2ea19 | |||
| 836305e2a3 | |||
| d51efb535d | |||
| 025f860815 | |||
| 06ca2a2b46 | |||
| 851d62fcbb | |||
| 0a337b41c2 | |||
| 47b52b5a93 | |||
| 82db5fda54 | |||
| 38e40d36c0 | |||
| 841c1869d6 | |||
| a867c75e9b | |||
| 150b452bb5 | |||
| b266f1f149 | |||
| 0fc7985a7c | |||
| 49bddeaa45 | |||
| e2ba2575b6 | |||
| 61299100d9 | |||
| abb4fcd909 | |||
| 0fba10d469 | |||
| 3c5f9a506c | |||
| de5b5939d6 | |||
| 661dba4b75 | |||
| 9e31843fc9 | |||
| f7469f487f | |||
| 9a58b3c312 | |||
| 01a48ce691 | |||
| 5eb46b02d8 | |||
| 1b19087782 | |||
| 49c9e0cecf | |||
| 7528935d2b | |||
| 8f4ddc454a | |||
| 296b18f025 | |||
| 45b87466be | |||
| bbe7900968 | |||
| 0ee7b5d44c | |||
| 83b327d58e | |||
| 6605966fab | |||
| 8178d03cb2 | |||
| e9a7581aa5 | |||
| aca57714e4 | |||
| 9276955fa8 | |||
| 8b674ffe14 | |||
| 7d7628c8a7 | |||
| 65b265733e | |||
| b34ecb89e2 | |||
| 4dfb1607c1 | |||
| 2e242a650a | |||
| 683275416e | |||
| 18d2704677 | |||
| c3a72d0bee | |||
| 5a657c4aac | |||
| 78e994ec5e | |||
| 68f92fb9a0 | |||
| be7a65ef8a | |||
| 5fa01b8d66 | |||
| 98d767fa7f | |||
| a6df900605 | |||
| 5637d56e02 | |||
| 24ffe03c0f | |||
| e5c7d9bb41 | |||
| 960c9b7729 | |||
| dad638e68e | |||
| b67c3b041f | |||
| ab80d65958 | |||
| 2306d2ec2e | |||
| b418338cd7 | |||
| c9dd93ac70 | |||
| a258706bf3 | |||
| 67fe5567a9 | |||
| f3e9b58e8d | |||
| 76692682da | |||
| f3e6f6670b | |||
| 354096fd70 | |||
| f48d98b7fc | |||
| 408cd9573c | |||
| 622baeb449 | |||
| 21233c98bb | |||
| 89d778b2df | |||
| 13b341abcd | |||
| 752f1c2947 | |||
| 743fb625d5 | |||
| 52238c5662 | |||
| 46cc22500b | |||
| 832c904376 | |||
| 8c8329f6e3 | |||
| 634eb10b2c | |||
| 5fcc59414f | |||
| 68b293dc6d | |||
| c9c69d2417 | |||
| b41a422cf0 | |||
| d2efc7030a | |||
| c9cc832382 | |||
| f0870cf320 | |||
| 194f83f490 | |||
| 8cc7038942 | |||
| 4bab9b369c | |||
| 7f3428184f | |||
| be443907ee | |||
| 0bcdc89427 | |||
| 0fbbf9e46f | |||
| 4580ca9c84 | |||
| 667e5b249c | |||
| 9e9dd1ae4b | |||
| ab5444ee94 | |||
| 657d2f299e | |||
| 5f3e0db712 | |||
| 29e1728e11 | |||
| 273c143d5e | |||
| 7ee1a2d9de | |||
| 2fca61b43a | |||
| c4480d7c99 | |||
| ae15ccf961 | |||
| 91f8dac261 | |||
| aa1774320a | |||
| 219a3f04be | |||
| 384e393963 | |||
| 489e306b0a | |||
| 19a4360a8c | |||
| 0e450c4b17 | |||
| 4fe68aa1b2 | |||
| 526ee7dd90 | |||
| 615198b080 | |||
| fc1581a9ff | |||
| 274188b6aa | |||
| cd7184cfd4 | |||
| 42293c5336 | |||
| 49f0f1aaf8 | |||
| c8eb38f083 | |||
| a56a4dd848 | |||
| e5be969308 | |||
| 83b941262e | |||
| 7fbf1dcb95 | |||
| 598b1c11f6 | |||
| c4d73f970d | |||
| 1bd735e90a | |||
| 939b2cddf2 | |||
| 73a390ce76 | |||
| cfc1c5797d | |||
| 8c04e517bc | |||
| 09af29f32d | |||
| 3f6ac5ef8d | |||
| 0ffacf8a0a | |||
| 38fdb6fa27 | |||
| f28693b0ad | |||
| 05b48b995e | |||
| 962729ae92 | |||
| 6e66cd631b | |||
| c5b0f7da43 | |||
| 649f4d7c68 | |||
| b515b3d70c | |||
| 2d7ff7e77a | |||
| f88cbf6e08 | |||
| daabfb7fd2 | |||
| 3f026a0701 | |||
| cf1f466452 | |||
| 64973176fb | |||
| 364efb8805 | |||
| a7537083e6 | |||
| 645088bbc1 | |||
| f6463cc4b1 | |||
| 5ef7cdb259 | |||
| a961518ebf | |||
| 1ca6175b93 | |||
| f9b4062dd5 | |||
| 6bd12dd776 | |||
| 9e9962f114 | |||
| b90706a3f6 | |||
| fcc1232d9b | |||
| 9ffed8d153 | |||
| b5de609cd5 | |||
| 0e7bef0206 | |||
| 7285ea8f45 | |||
| c86b252629 | |||
| 9be2fb9017 | |||
| 4bfc4de956 | |||
| 80d4cc9d7a | |||
| 13131e4c3e | |||
| 1a3d3515f8 | |||
| fa64c98406 |
@@ -1,111 +0,0 @@
|
||||
# Accessibility Essentials
|
||||
|
||||
Accessibility enables creativity - it's a foundation, not a limitation. WCAG 2.1 AA compliance.
|
||||
|
||||
## Core Principles (POUR)
|
||||
|
||||
- **Perceivable**: Content must be perceivable (alt text, contrast, captions)
|
||||
- **Operable**: UI must be keyboard/touch accessible
|
||||
- **Understandable**: Clear, predictable behavior
|
||||
- **Robust**: Works with assistive technologies
|
||||
|
||||
## Contrast Requirements
|
||||
|
||||
| Element | Minimum Ratio |
|
||||
|---------|---------------|
|
||||
| Normal text | 4.5:1 |
|
||||
| Large text (18pt+) | 3:1 |
|
||||
| UI components | 3:1 |
|
||||
|
||||
**Tools**: Chrome DevTools Accessibility tab, WebAIM Contrast Checker
|
||||
|
||||
## Keyboard Navigation
|
||||
|
||||
```tsx
|
||||
// All interactive elements need focus states
|
||||
<button className="focus:ring-4 focus:ring-blue-500 focus:outline-none">
|
||||
Accessible
|
||||
</button>
|
||||
|
||||
// Custom elements need tabindex and key handlers
|
||||
<div
|
||||
role="button"
|
||||
tabIndex={0}
|
||||
onKeyDown={(e) => (e.key === 'Enter' || e.key === ' ') && handleClick()}
|
||||
>
|
||||
Custom Button
|
||||
</div>
|
||||
```
|
||||
|
||||
**Essentials:**
|
||||
- Tab through entire interface
|
||||
- Enter/Space activates elements
|
||||
- Escape closes modals
|
||||
- Visible focus indicators always
|
||||
|
||||
## Essential ARIA
|
||||
|
||||
```tsx
|
||||
// Buttons without text
|
||||
<button aria-label="Close dialog"><X /></button>
|
||||
|
||||
// Expandable elements
|
||||
<button aria-expanded={isOpen} aria-controls="menu">Menu</button>
|
||||
|
||||
// Live regions for dynamic content
|
||||
<div role="status" aria-live="polite">{statusMessage}</div>
|
||||
<div role="alert" aria-live="assertive">{errorMessage}</div>
|
||||
|
||||
// Form errors
|
||||
<input aria-invalid={hasError} aria-describedby="error-msg" />
|
||||
{hasError && <p id="error-msg" role="alert">Error text</p>}
|
||||
```
|
||||
|
||||
## Semantic HTML
|
||||
|
||||
```tsx
|
||||
// Use semantic elements, not divs
|
||||
<header><nav>...</nav></header>
|
||||
<main><article><h1>...</h1></article></main>
|
||||
<footer>...</footer>
|
||||
|
||||
// Heading hierarchy (never skip levels)
|
||||
<h1>Page Title</h1>
|
||||
<h2>Section</h2>
|
||||
<h3>Subsection</h3>
|
||||
```
|
||||
|
||||
## Touch Targets
|
||||
|
||||
- Minimum **44x44px** for all interactive elements
|
||||
- Adequate spacing between targets
|
||||
- `touch-manipulation` CSS for responsive touch
|
||||
|
||||
## Screen Reader Content
|
||||
|
||||
```tsx
|
||||
// Hidden but announced
|
||||
<span className="sr-only">Additional context</span>
|
||||
|
||||
// Skip link
|
||||
<a href="#main" className="sr-only focus:not-sr-only">
|
||||
Skip to main content
|
||||
</a>
|
||||
```
|
||||
|
||||
## Quick Checklist
|
||||
|
||||
- [ ] Keyboard: Can tab through everything
|
||||
- [ ] Focus: Visible focus indicators
|
||||
- [ ] Contrast: 4.5:1 for text
|
||||
- [ ] Alt text: All images have appropriate alt
|
||||
- [ ] Headings: Logical h1-h6 hierarchy
|
||||
- [ ] Forms: Labels associated with inputs
|
||||
- [ ] Errors: Announced to screen readers
|
||||
- [ ] Touch: 44px minimum targets
|
||||
|
||||
## Resources
|
||||
|
||||
- [WCAG 2.1 Quick Reference](https://www.w3.org/WAI/WCAG21/quickref/)
|
||||
- [WebAIM Contrast Checker](https://webaim.org/resources/contrastchecker/)
|
||||
- [ARIA Authoring Practices](https://www.w3.org/WAI/ARIA/apg/)
|
||||
@@ -1,577 +0,0 @@
|
||||
# Design System Template
|
||||
|
||||
Meta-framework for understanding what's fixed, project-specific, and adaptable in your design system.
|
||||
|
||||
## Purpose
|
||||
|
||||
This template helps you distinguish between:
|
||||
- **Fixed Elements**: Universal rules that never change
|
||||
- **Project-Specific Elements**: Filled in for each project based on brand
|
||||
- **Adaptable Elements**: Context-dependent implementations
|
||||
|
||||
---
|
||||
|
||||
## I. FIXED ELEMENTS
|
||||
|
||||
These foundations remain consistent across all projects, regardless of brand or context.
|
||||
|
||||
### 1. Spacing Scale
|
||||
|
||||
**Fixed System:**
|
||||
```
|
||||
4px, 8px, 12px, 16px, 24px, 32px, 48px, 64px, 96px
|
||||
```
|
||||
|
||||
**Usage:**
|
||||
- Margins, padding, gaps between elements
|
||||
- Mathematical relationships ensure visual harmony
|
||||
- Use multipliers of base unit (4px)
|
||||
|
||||
**Why Fixed:**
|
||||
Consistent spacing creates visual rhythm regardless of brand personality.
|
||||
|
||||
### 2. Grid System
|
||||
|
||||
**Fixed Structure:**
|
||||
- **12-column grid** for most layouts (divisible by 2, 3, 4, 6)
|
||||
- **16-column grid** for data-heavy interfaces
|
||||
- **Gutters**: 16px (mobile), 24px (tablet), 32px (desktop)
|
||||
|
||||
**Why Fixed:**
|
||||
Grid provides structural order. Brand personality shows through color, typography, content—not grid structure.
|
||||
|
||||
### 3. Accessibility Standards
|
||||
|
||||
**Fixed Requirements:**
|
||||
- **WCAG 2.1 AA** compliance minimum
|
||||
- **Contrast**: 4.5:1 for normal text, 3:1 for large text
|
||||
- **Touch targets**: Minimum 44×44px
|
||||
- **Keyboard navigation**: All interactive elements accessible
|
||||
- **Screen reader**: Semantic HTML, ARIA labels where needed
|
||||
|
||||
**Why Fixed:**
|
||||
Accessibility is not negotiable. It's a baseline requirement for ethical, legal, and usable products.
|
||||
|
||||
### 4. Typography Hierarchy Logic
|
||||
|
||||
**Fixed Structure:**
|
||||
- **Mathematical scaling**: 1.25x (major third) or 1.333x (perfect fourth)
|
||||
- **Hierarchy levels**: Display → H1 → H2 → H3 → Body → Small → Caption
|
||||
- **Line height**: 1.5x for body text, 1.2-1.3x for headlines
|
||||
- **Line length**: 45-75 characters optimal
|
||||
|
||||
**Why Fixed:**
|
||||
Mathematical relationships create predictable, harmonious hierarchy. Specific fonts change, but the logic doesn't.
|
||||
|
||||
### 5. Component Architecture
|
||||
|
||||
**Fixed Patterns:**
|
||||
- **Button states**: Default, Hover, Active, Focus, Disabled
|
||||
- **Form structure**: Label above input, error below, helper text optional
|
||||
- **Modal pattern**: Overlay + centered content + close mechanism
|
||||
- **Card structure**: Container → Header → Body → Footer (optional)
|
||||
|
||||
**Why Fixed:**
|
||||
Users expect consistent component behavior. Architecture is fixed; appearance is project-specific.
|
||||
|
||||
### 6. Animation Timing Framework
|
||||
|
||||
**Fixed Physics Profiles:**
|
||||
- **Lightweight** (icons, chips): 150ms
|
||||
- **Standard** (cards, panels): 300ms
|
||||
- **Weighty** (modals, pages): 500ms
|
||||
|
||||
**Fixed Easing:**
|
||||
- **Ease-out**: Entrances (fast start, slow end)
|
||||
- **Ease-in**: Exits (slow start, fast end)
|
||||
- **Ease-in-out**: Transitions (smooth both ends)
|
||||
|
||||
**Why Fixed:**
|
||||
Natural physics feel consistent across brands. Duration and easing create that feeling.
|
||||
|
||||
---
|
||||
|
||||
## II. PROJECT-SPECIFIC ELEMENTS
|
||||
|
||||
Fill in these for each project based on brand personality and purpose.
|
||||
|
||||
### 1. Brand Color System
|
||||
|
||||
**Template Structure:**
|
||||
|
||||
```
|
||||
NEUTRALS (4-5 colors):
|
||||
- Background lightest: _______ (e.g., slate-50 or warm-white)
|
||||
- Surface: _______ (e.g., slate-100)
|
||||
- Border/divider: _______ (e.g., slate-300)
|
||||
- Text secondary: _______ (e.g., slate-600)
|
||||
- Text primary: _______ (e.g., slate-900)
|
||||
|
||||
ACCENTS (1-3 colors):
|
||||
- Primary (main CTA): _______ (e.g., teal-500)
|
||||
- Secondary (alternative action): _______ (optional)
|
||||
- Status colors:
|
||||
- Success: _______ (green-ish)
|
||||
- Warning: _______ (amber-ish)
|
||||
- Error: _______ (red-ish)
|
||||
- Info: _______ (blue-ish)
|
||||
```
|
||||
|
||||
**Questions to Answer:**
|
||||
- What emotion should the brand evoke? (Trust, excitement, calm, urgency)
|
||||
- Warm or cool neutrals?
|
||||
- Conservative or bold accents?
|
||||
|
||||
**Examples:**
|
||||
|
||||
**Project A: Fintech App**
|
||||
```
|
||||
Neutrals: Cool greys (slate-50 → slate-900)
|
||||
Primary: Deep blue (#0A2463) – trust, professionalism
|
||||
Success: Muted green (#10B981)
|
||||
Why: Financial products need trust, not playfulness
|
||||
```
|
||||
|
||||
**Project B: Creative Community**
|
||||
```
|
||||
Neutrals: Warm greys with beige undertones
|
||||
Primary: Coral (#FF6B6B) – energy, creativity
|
||||
Success: Teal (#06D6A0) – fresh, unexpected
|
||||
Why: Creative spaces should feel inviting, not corporate
|
||||
```
|
||||
|
||||
**Project C: Healthcare Platform**
|
||||
```
|
||||
Neutrals: Pure greys (minimal color temperature)
|
||||
Primary: Soft blue (#4A90E2) – calm, clinical
|
||||
Success: Medical green (#38A169)
|
||||
Why: Healthcare needs clarity and calm, not distraction
|
||||
```
|
||||
|
||||
### 2. Typography Pairing
|
||||
|
||||
**Template:**
|
||||
|
||||
```
|
||||
HEADLINE FONT: _______
|
||||
- Weight: _______ (e.g., Bold 700)
|
||||
- Use case: H1, H2, display text
|
||||
- Personality: _______ (geometric/humanist/serif/etc.)
|
||||
|
||||
BODY FONT: _______
|
||||
- Weight: _______ (e.g., Regular 400, Medium 500)
|
||||
- Use case: Paragraphs, UI text
|
||||
- Personality: _______ (neutral/readable/efficient)
|
||||
|
||||
OPTIONAL ACCENT FONT: _______
|
||||
- Weight: _______
|
||||
- Use case: _______ (special headlines, callouts)
|
||||
```
|
||||
|
||||
**Pairing Logic:**
|
||||
- Serif + Sans-serif (classic, editorial)
|
||||
- Geometric + Humanist (modern + warm)
|
||||
- Display + System (distinctive + efficient)
|
||||
|
||||
**Examples:**
|
||||
|
||||
**Project A: Editorial Platform**
|
||||
```
|
||||
Headline: Playfair Display (Serif, Bold 700)
|
||||
Body: Inter (Sans-serif, Regular 400)
|
||||
Why: Serif headlines = trustworthy, editorial feel
|
||||
```
|
||||
|
||||
**Project B: Tech Startup**
|
||||
```
|
||||
Headline: DM Sans (Sans-serif, Bold 700)
|
||||
Body: DM Sans (Regular 400, Medium 500)
|
||||
Why: Single-font system = modern, efficient, cohesive
|
||||
```
|
||||
|
||||
**Project C: Luxury Brand**
|
||||
```
|
||||
Headline: Cormorant Garamond (Serif, Light 300)
|
||||
Body: Lato (Sans-serif, Regular 400)
|
||||
Why: Elegant serif + readable sans = sophisticated
|
||||
```
|
||||
|
||||
### 3. Tone of Voice
|
||||
|
||||
**Template:**
|
||||
|
||||
```
|
||||
BRAND PERSONALITY:
|
||||
- Formal ↔ Casual: _______ (1-10 scale)
|
||||
- Professional ↔ Friendly: _______ (1-10 scale)
|
||||
- Serious ↔ Playful: _______ (1-10 scale)
|
||||
- Authoritative ↔ Conversational: _______ (1-10 scale)
|
||||
|
||||
MICROCOPY EXAMPLES:
|
||||
- Button label (submit form): _______
|
||||
- Error message (invalid email): _______
|
||||
- Success message (saved): _______
|
||||
- Empty state: _______
|
||||
|
||||
ANIMATION PERSONALITY:
|
||||
- Speed: _______ (quick/moderate/slow)
|
||||
- Feel: _______ (precise/smooth/bouncy)
|
||||
```
|
||||
|
||||
**Examples:**
|
||||
|
||||
**Project A: Banking App**
|
||||
```
|
||||
Personality: Formal (8), Professional (9), Serious (8)
|
||||
Button: "Submit Application"
|
||||
Error: "Email address format is invalid"
|
||||
Success: "Application submitted successfully"
|
||||
Animation: Quick (precise, efficient, no-nonsense)
|
||||
```
|
||||
|
||||
**Project B: Social App**
|
||||
```
|
||||
Personality: Casual (8), Friendly (9), Playful (7)
|
||||
Button: "Let's go!"
|
||||
Error: "Hmm, that email doesn't look right"
|
||||
Success: "Nice! You're all set 🎉"
|
||||
Animation: Moderate (smooth, friendly bounce)
|
||||
```
|
||||
|
||||
### 4. Animation Speed & Feel
|
||||
|
||||
**Template:**
|
||||
|
||||
```
|
||||
SPEED PREFERENCE:
|
||||
- UI interactions: _______ (100-150ms / 150-200ms / 200-300ms)
|
||||
- State changes: _______ (200ms / 300ms / 400ms)
|
||||
- Page transitions: _______ (300ms / 500ms / 700ms)
|
||||
|
||||
ANIMATION STYLE:
|
||||
- Easing preference: _______ (sharp / standard / bouncy)
|
||||
- Movement type: _______ (minimal / smooth / expressive)
|
||||
```
|
||||
|
||||
**Examples:**
|
||||
|
||||
**Project A: Trading Platform**
|
||||
```
|
||||
Speed: Fast (100ms UI, 200ms states, 300ms pages)
|
||||
Style: Sharp easing, minimal movement
|
||||
Why: Traders need speed, not distraction
|
||||
```
|
||||
|
||||
**Project B: Wellness App**
|
||||
```
|
||||
Speed: Slow (200ms UI, 400ms states, 500ms pages)
|
||||
Style: Smooth easing, gentle movement
|
||||
Why: Calm, relaxing experience matches brand
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## III. ADAPTABLE ELEMENTS
|
||||
|
||||
Context-dependent implementations that vary based on use case.
|
||||
|
||||
### 1. Component Variations
|
||||
|
||||
**Button Variants:**
|
||||
- **Primary**: Full background color (high emphasis)
|
||||
- **Secondary**: Outline only (medium emphasis)
|
||||
- **Tertiary**: Text only (low emphasis)
|
||||
- **Destructive**: Red-ish (danger actions)
|
||||
- **Ghost**: Minimal (navigation, toolbars)
|
||||
|
||||
**Adaptation Rules:**
|
||||
- Primary: Main CTA, one per screen section
|
||||
- Secondary: Alternative actions
|
||||
- Tertiary: Less important actions, multiple allowed
|
||||
- Use brand colors, but hierarchy logic is fixed
|
||||
|
||||
### 2. Responsive Breakpoints
|
||||
|
||||
**Fixed Ranges:**
|
||||
- XS: 0-479px (small phones)
|
||||
- SM: 480-767px (large phones)
|
||||
- MD: 768-1023px (tablets)
|
||||
- LG: 1024-1439px (laptops)
|
||||
- XL: 1440px+ (desktop)
|
||||
|
||||
**Adaptable Implementations:**
|
||||
|
||||
**Simple Content Site:**
|
||||
```
|
||||
XS-SM: Single column
|
||||
MD: 2 columns
|
||||
LG-XL: 3 columns max
|
||||
Why: Content-focused, don't overwhelm
|
||||
```
|
||||
|
||||
**Dashboard/Data App:**
|
||||
```
|
||||
XS: Collapsed, cards stack
|
||||
SM: Simplified sidebar
|
||||
MD: Full sidebar + main content
|
||||
LG-XL: Sidebar + main + right panel
|
||||
Why: Data apps need more screen real estate
|
||||
```
|
||||
|
||||
### 3. Dark Mode Palette
|
||||
|
||||
**Adaptation Strategy:**
|
||||
|
||||
Not a simple inversion. Dark mode needs adjusted contrast:
|
||||
|
||||
**Light Mode:**
|
||||
```
|
||||
Background: #FFFFFF (white)
|
||||
Text: #0F172A (slate-900) → 21:1 contrast
|
||||
```
|
||||
|
||||
**Dark Mode (Adapted):**
|
||||
```
|
||||
Background: #0F172A (slate-900)
|
||||
Text: #E2E8F0 (slate-200) → 15.8:1 contrast (still AA, but softer)
|
||||
```
|
||||
|
||||
**Why Adapt:**
|
||||
Pure white on pure black is too harsh. Dark mode needs slightly lower contrast for eye comfort.
|
||||
|
||||
### 4. Loading States
|
||||
|
||||
**Context-Dependent:**
|
||||
|
||||
**Fast operations (<500ms):**
|
||||
- No loading indicator (feels instant)
|
||||
|
||||
**Medium operations (500ms-2s):**
|
||||
- Spinner or skeleton screen
|
||||
|
||||
**Long operations (>2s):**
|
||||
- Progress bar with percentage
|
||||
- Or: Skeleton + estimated time
|
||||
|
||||
**Interactive Operations:**
|
||||
- Button shows spinner inside (don't disable, show state)
|
||||
|
||||
### 5. Error Handling Strategy
|
||||
|
||||
**Context-Dependent:**
|
||||
|
||||
**Form Errors:**
|
||||
```
|
||||
Validate: On blur (after user leaves field)
|
||||
Display: Inline below field
|
||||
Recovery: Clear error on fix
|
||||
```
|
||||
|
||||
**API Errors:**
|
||||
```
|
||||
Transient (network): Show retry button
|
||||
Permanent (404): Show helpful message + next steps
|
||||
Critical (500): Contact support option
|
||||
```
|
||||
|
||||
**Data Errors:**
|
||||
```
|
||||
Missing: Show empty state with action
|
||||
Corrupt: Show error boundary with reload
|
||||
Invalid: Highlight + explain what's wrong
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## DECISION TREE
|
||||
|
||||
When implementing a feature, ask:
|
||||
|
||||
### Is this...
|
||||
|
||||
**FIXED?**
|
||||
- Does it affect structure, accessibility, or universal UX?
|
||||
- Examples: Spacing scale, grid, contrast ratios, component architecture
|
||||
- **Action**: Use the fixed system, no variation
|
||||
|
||||
**PROJECT-SPECIFIC?**
|
||||
- Does it express brand personality or purpose?
|
||||
- Examples: Colors, typography, tone of voice, animation feel
|
||||
- **Action**: Fill in the template for this project
|
||||
|
||||
**ADAPTABLE?**
|
||||
- Does it depend on context, content, or use case?
|
||||
- Examples: Component variants, responsive behavior, error handling
|
||||
- **Action**: Choose appropriate variation based on context
|
||||
|
||||
---
|
||||
|
||||
## EXAMPLE: Implementing a "Submit" Button
|
||||
|
||||
### Fixed Elements (Always the same):
|
||||
- Touch target: 44px minimum height
|
||||
- Padding: 16px horizontal (from spacing scale)
|
||||
- States: Default, Hover, Active, Focus, Disabled
|
||||
- Animation: 150ms ease-out (lightweight profile)
|
||||
|
||||
### Project-Specific (Filled per project):
|
||||
- **Project A (Bank)**: Dark blue background, white text, "Submit Application"
|
||||
- **Project B (Social)**: Coral background, white text, "Let's Go!"
|
||||
- **Project C (Healthcare)**: Soft blue background, white text, "Continue"
|
||||
|
||||
### Adaptable (Context-dependent):
|
||||
- **Form context**: Primary button (full color)
|
||||
- **Toolbar context**: Ghost button (text only)
|
||||
- **Danger context**: Destructive variant (red-ish)
|
||||
|
||||
---
|
||||
|
||||
## VALIDATION CHECKLIST
|
||||
|
||||
Before finalizing a design, check:
|
||||
|
||||
### Fixed Elements
|
||||
- [ ] Uses spacing scale (4/8/12/16/24/32/48/64/96px)
|
||||
- [ ] Follows grid system (12 or 16 columns)
|
||||
- [ ] Meets WCAG AA contrast (4.5:1 normal, 3:1 large)
|
||||
- [ ] Touch targets ≥ 44px
|
||||
- [ ] Typography follows mathematical scale
|
||||
- [ ] Components follow standard architecture
|
||||
|
||||
### Project-Specific Elements
|
||||
- [ ] Brand colors filled in and intentional
|
||||
- [ ] Typography pairing chosen and justified
|
||||
- [ ] Tone of voice defined and consistent
|
||||
- [ ] Animation speed matches brand personality
|
||||
|
||||
### Adaptable Elements
|
||||
- [ ] Component variants appropriate for context
|
||||
- [ ] Responsive behavior fits content type
|
||||
- [ ] Loading states match operation duration
|
||||
- [ ] Error handling fits error type
|
||||
|
||||
---
|
||||
|
||||
## PROJECT KICKOFF TEMPLATE
|
||||
|
||||
Use this to start a new project:
|
||||
|
||||
```
|
||||
PROJECT NAME: _______________________
|
||||
PURPOSE: ____________________________
|
||||
|
||||
BRAND PERSONALITY:
|
||||
- Primary emotion: _______
|
||||
- Warm or cool: _______
|
||||
- Formal or casual: _______
|
||||
- Conservative or bold: _______
|
||||
|
||||
COLORS (fill the template):
|
||||
- Neutral base: _______
|
||||
- Primary accent: _______
|
||||
- Status colors: _______ / _______ / _______
|
||||
|
||||
TYPOGRAPHY (fill the template):
|
||||
- Headline font: _______
|
||||
- Body font: _______
|
||||
- Pairing rationale: _______
|
||||
|
||||
TONE:
|
||||
- Button labels style: _______
|
||||
- Error message style: _______
|
||||
- Success message style: _______
|
||||
|
||||
ANIMATION:
|
||||
- Speed preference: _______ (fast/moderate/slow)
|
||||
- Feel preference: _______ (sharp/smooth/bouncy)
|
||||
|
||||
TARGET DEVICES:
|
||||
- Primary: _______ (mobile/desktop/both)
|
||||
- Secondary: _______
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## MAINTAINING CONSISTENCY
|
||||
|
||||
### Documentation
|
||||
- Keep this template updated as system evolves
|
||||
- Document WHY choices were made, not just WHAT
|
||||
|
||||
### Communication
|
||||
- Share with designers: "Here's what varies vs. what's fixed"
|
||||
- Share with developers: "Here are the design tokens"
|
||||
|
||||
### Tooling
|
||||
- Use CSS variables for project-specific values
|
||||
- Use Tailwind config for spacing scale
|
||||
- Use design tokens in Figma/Storybook
|
||||
|
||||
### Reviews
|
||||
- Audit: Does new work follow fixed elements?
|
||||
- Validate: Are project-specific elements intentional?
|
||||
- Question: Are adaptations justified by context?
|
||||
|
||||
---
|
||||
|
||||
## EXAMPLES OF COMPLETE SYSTEMS
|
||||
|
||||
### System A: B2B SaaS (Conservative)
|
||||
|
||||
**Fixed**: Standard spacing, 12-col grid, WCAG AA, major third type scale
|
||||
**Project-Specific**:
|
||||
- Colors: Cool greys + corporate blue
|
||||
- Typography: DM Sans (headlines + body)
|
||||
- Tone: Professional, formal
|
||||
- Animation: Quick, precise (150ms)
|
||||
**Adaptable**:
|
||||
- Dashboard gets multi-panel layout
|
||||
- Forms are extensive (use progressive disclosure)
|
||||
- Errors show detailed technical info
|
||||
|
||||
### System B: Consumer Social App (Playful)
|
||||
|
||||
**Fixed**: Same spacing/grid/accessibility/type logic
|
||||
**Project-Specific**:
|
||||
- Colors: Warm greys + vibrant coral
|
||||
- Typography: Poppins (headlines) + Inter (body)
|
||||
- Tone: Casual, friendly, playful
|
||||
- Animation: Moderate, bouncy (200ms)
|
||||
**Adaptable**:
|
||||
- Mobile-first (most users on phones)
|
||||
- Forms are minimal (progressive profiling)
|
||||
- Errors are friendly, not technical
|
||||
|
||||
### System C: Healthcare Platform (Clinical)
|
||||
|
||||
**Fixed**: Same foundational structure
|
||||
**Project-Specific**:
|
||||
- Colors: Pure greys + medical blue
|
||||
- Typography: System fonts (SF Pro / Segoe)
|
||||
- Tone: Clear, authoritative, calm
|
||||
- Animation: Slow, smooth (300ms)
|
||||
**Adaptable**:
|
||||
- Desktop-first (clinical use at workstations)
|
||||
- Forms are complex (HIPAA compliance)
|
||||
- Errors are precise with next steps
|
||||
|
||||
---
|
||||
|
||||
## KEY TAKEAWAY
|
||||
|
||||
**The system flexibility framework lets you:**
|
||||
- Maintain consistency (fixed elements)
|
||||
- Express brand personality (project-specific)
|
||||
- Adapt to context (adaptable elements)
|
||||
|
||||
**Without this framework:**
|
||||
- Designers reinvent spacing every project
|
||||
- Components feel inconsistent across products
|
||||
- Brand personality overrides accessibility
|
||||
- Context-blind implementations feel wrong
|
||||
|
||||
**With this framework:**
|
||||
- Speed: Start from proven foundations
|
||||
- Consistency: Fixed elements guarantee it
|
||||
- Flexibility: Express unique brand identity
|
||||
- Context: Adapt without breaking system
|
||||
@@ -1,72 +0,0 @@
|
||||
# Motion Specification
|
||||
|
||||
Motion should surprise and delight while serving function. Animation is a creative tool.
|
||||
|
||||
## Easing Curves
|
||||
|
||||
| Easing | CSS | Use For |
|
||||
|--------|-----|---------|
|
||||
| **Ease-out** | `cubic-bezier(0.0, 0.0, 0.2, 1)` | Entrances, appearing |
|
||||
| **Ease-in** | `cubic-bezier(0.4, 0.0, 1, 1)` | Exits, disappearing |
|
||||
| **Ease-in-out** | `cubic-bezier(0.4, 0.0, 0.2, 1)` | State changes, transforms |
|
||||
| **Spring** | `cubic-bezier(0.68, -0.55, 0.265, 1.55)` | Playful, attention-grabbing |
|
||||
| **Linear** | `linear` | Spinners, continuous loops |
|
||||
|
||||
## Duration by Element Weight
|
||||
|
||||
| Weight | Duration | Examples |
|
||||
|--------|----------|----------|
|
||||
| **Lightweight** | 150ms | Icons, badges, chips |
|
||||
| **Standard** | 300ms | Cards, panels, list items |
|
||||
| **Weighty** | 500ms | Modals, page transitions |
|
||||
|
||||
## Duration by Interaction
|
||||
|
||||
| Interaction | Duration |
|
||||
|-------------|----------|
|
||||
| Button press | 100ms |
|
||||
| Hover state | 150ms |
|
||||
| Tooltip appear | 200ms |
|
||||
| Tab switch | 250ms |
|
||||
| Modal open | 300ms |
|
||||
| Page transition | 400ms |
|
||||
|
||||
## Common Patterns
|
||||
|
||||
```tsx
|
||||
// Hover transition (CSS)
|
||||
<button className="transition-colors duration-150 ease-out hover:bg-blue-700">
|
||||
|
||||
// Fade + slide (Framer Motion)
|
||||
<motion.div
|
||||
initial={{ opacity: 0, y: 20 }}
|
||||
animate={{ opacity: 1, y: 0 }}
|
||||
transition={{ duration: 0.3, ease: "easeOut" }}
|
||||
/>
|
||||
|
||||
// Stagger children
|
||||
<motion.ul variants={{ visible: { transition: { staggerChildren: 0.1 } } }}>
|
||||
<motion.li variants={{ hidden: { opacity: 0 }, visible: { opacity: 1 } }} />
|
||||
</motion.ul>
|
||||
```
|
||||
|
||||
## Performance Rules
|
||||
|
||||
- Only animate `transform` and `opacity` (GPU-accelerated)
|
||||
- Avoid animating `width`, `height`, `margin`, `padding`
|
||||
- Keep durations under 500ms for UI interactions
|
||||
- Respect `prefers-reduced-motion`:
|
||||
|
||||
```css
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
*, *::before, *::after {
|
||||
animation-duration: 0.01ms !important;
|
||||
transition-duration: 0.01ms !important;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Resources
|
||||
|
||||
- [Framer Motion](https://www.framer.com/motion/)
|
||||
- [CSS Easing Functions](https://easings.net/)
|
||||
@@ -1,90 +0,0 @@
|
||||
# Responsive Design Essentials
|
||||
|
||||
Mobile-first approach: start with mobile, progressively enhance for larger screens.
|
||||
|
||||
## Breakpoints
|
||||
|
||||
| Range | Pixels | Devices | Strategy |
|
||||
|-------|--------|---------|----------|
|
||||
| **XS** | 0-479px | Small phones | Single column, stacked nav, 44px touch targets |
|
||||
| **SM** | 480-767px | Large phones | Single column, bottom nav, simplified UI |
|
||||
| **MD** | 768-1023px | Tablets | 2 columns possible, sidebar nav |
|
||||
| **LG** | 1024-1439px | Laptops | Multi-column, full nav, desktop UI |
|
||||
| **XL** | 1440px+ | Desktop | Max-width containers, multi-panel layouts |
|
||||
|
||||
## Tailwind Responsive
|
||||
|
||||
```tsx
|
||||
// Mobile-first: base styles, then scale up
|
||||
<div className="
|
||||
w-full // mobile: full width
|
||||
sm:w-1/2 // 480px+: half
|
||||
md:w-1/3 // 768px+: third
|
||||
lg:w-1/4 // 1024px+: quarter
|
||||
">
|
||||
|
||||
// Responsive grid
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6">
|
||||
|
||||
// Responsive typography
|
||||
<h1 className="text-3xl md:text-4xl lg:text-5xl">
|
||||
|
||||
// Show/hide by breakpoint
|
||||
<div className="block md:hidden">Mobile only</div>
|
||||
<div className="hidden md:block">Desktop only</div>
|
||||
```
|
||||
|
||||
## Fluid Typography
|
||||
|
||||
```css
|
||||
h1 { font-size: clamp(2rem, 5vw, 4rem); }
|
||||
p { font-size: clamp(1rem, 2.5vw, 1.25rem); }
|
||||
```
|
||||
|
||||
## Touch Targets
|
||||
|
||||
- Minimum **44x44px** for all interactive elements
|
||||
- Use `touch-manipulation` to prevent 300ms tap delay
|
||||
- Adequate spacing between targets
|
||||
|
||||
```tsx
|
||||
<button className="min-w-[44px] min-h-[44px] touch-manipulation">
|
||||
```
|
||||
|
||||
## Mobile Simplification
|
||||
|
||||
| Desktop | Mobile |
|
||||
|---------|--------|
|
||||
| Full nav bar | Hamburger menu |
|
||||
| Side-by-side fields | Stacked fields |
|
||||
| Multi-column grid | Single column |
|
||||
| Inline buttons | Fixed bottom bar |
|
||||
| Data table | Collapsed cards |
|
||||
| Visible sidebar | Hidden/collapsible |
|
||||
|
||||
## Images
|
||||
|
||||
```tsx
|
||||
// Responsive images
|
||||
<img
|
||||
srcSet="image-400w.jpg 400w, image-800w.jpg 800w, image-1200w.jpg 1200w"
|
||||
sizes="(max-width: 640px) 100vw, (max-width: 1024px) 50vw, 33vw"
|
||||
loading="lazy"
|
||||
/>
|
||||
|
||||
// Next.js
|
||||
<Image src="/hero.jpg" width={1200} height={600} priority className="w-full h-auto" />
|
||||
```
|
||||
|
||||
## Testing
|
||||
|
||||
Test at these widths:
|
||||
- 375px (iPhone SE)
|
||||
- 390px (iPhone 14)
|
||||
- 768px (iPad)
|
||||
- 1024px (iPad Pro)
|
||||
- 1280px+ (Desktop)
|
||||
|
||||
## Resources
|
||||
|
||||
- [Tailwind Responsive](https://tailwindcss.com/docs/responsive-design)
|
||||
@@ -1,718 +0,0 @@
|
||||
---
|
||||
name: bencium-innovative-ux-designer
|
||||
description: Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
|
||||
metadata:
|
||||
version: 2.0.0
|
||||
---
|
||||
|
||||
# Innovative UX Designer
|
||||
|
||||
Create distinctive, production-grade frontend interfaces that avoid generic "AI slop" aesthetics. Implement real working code with exceptional attention to aesthetic details and creative choices. Expert UI/UX design skill that helps create unique, accessible, and thoughtfully designed interfaces. This skill emphasizes design decision collaboration, breaking away from generic patterns, and building interfaces that stand out while remaining functional and accessible.
|
||||
|
||||
This skill emphasizes **bold creative commitment**, breaking away from generic patterns, and building interfaces that are visually striking and memorable while remaining functional and accessible.
|
||||
|
||||
## Core Philosophy
|
||||
|
||||
**CRITICAL: Design Thinking Protocol**
|
||||
|
||||
Before coding, **ASK to understand context**, then **COMMIT BOLDLY** to a distinctive direction:
|
||||
|
||||
### Questions to Ask First
|
||||
1. **Purpose**: What problem does this interface solve? Who uses it?
|
||||
2. **Tone**: What aesthetic extreme fits? (see Tone Options below)
|
||||
3. **Constraints**: Technical requirements (framework, performance, accessibility)?
|
||||
4. **Differentiation**: What makes this UNFORGETTABLE? What's the one thing someone will remember?
|
||||
|
||||
### Tone Options (Pick an Extreme)
|
||||
Choose a clear aesthetic direction and execute with precision:
|
||||
- **Brutally minimal** - stripped to essence, bold typography, vast whitespace
|
||||
- **Maximalist chaos** - layered, dense, visually rich, controlled disorder
|
||||
- **Retro-futuristic** - vintage meets sci-fi, nostalgic tech aesthetics
|
||||
- **Organic/natural** - soft edges, earthy colors, nature-inspired textures
|
||||
- **Luxury/refined** - elegant spacing, premium typography, subtle details
|
||||
- **Playful/toy-like** - bright colors, rounded shapes, delightful interactions
|
||||
- **Editorial/magazine** - strong typography hierarchy, asymmetric layouts
|
||||
- **Brutalist/raw** - exposed structure, harsh contrasts, intentionally rough
|
||||
- **Art deco/geometric** - bold patterns, metallic accents, symmetric elegance
|
||||
- **Soft/pastel** - gentle gradients, muted tones, calming atmosphere
|
||||
- **Industrial/utilitarian** - functional, no-nonsense, mechanical precision
|
||||
|
||||
### After Getting Context
|
||||
- **Commit fully** to the chosen direction - no half measures
|
||||
- Present 2-3 alternative approaches with trade-offs
|
||||
- Then implement with precision: production-grade, visually striking, memorable
|
||||
|
||||
## Foundational Design Principles
|
||||
|
||||
### Stand Out From Generic Patterns
|
||||
|
||||
**NEVER Use These AI-Generated Aesthetics:**
|
||||
- **Fonts**: Inter, Roboto, Arial, system fonts as primary choice, Space Grotesk (overused by AI)
|
||||
- **Colors**: Generic SaaS blue (#3B82F6), purple gradients on white backgrounds
|
||||
- **Patterns**: Cookie-cutter layouts, predictable component arrangements
|
||||
- **Effects**: Glass morphism, Apple design mimicry, liquid/blob backgrounds
|
||||
- **Overall**: Anything that looks "Claude-generated" or machine-made
|
||||
|
||||
**Instead, Create Atmosphere:**
|
||||
- Suggest photography, patterns, textures over flat solid colors
|
||||
- Apply gradient meshes, noise textures, geometric patterns
|
||||
- Use layered transparencies, dramatic shadows, decorative borders
|
||||
- Consider custom cursors, grain overlays, contextual effects
|
||||
- Think beyond typical patterns - you can step off the written path
|
||||
|
||||
**Draw Inspiration From:**
|
||||
- Modern landing pages (Perplexity, Comet Browser, Dia Browser)
|
||||
- Framer templates and their innovative approaches
|
||||
- Leading brand design studios
|
||||
- Historical design movements (Bauhaus, Otl Aicher, Braun) - but as inspiration, not imitation
|
||||
- Beautiful background animations (CSS, SVG) - slow, looping, subtle
|
||||
|
||||
**Visual Interest Strategies:**
|
||||
- Unique color pairs that aren't typical
|
||||
- Animation effects that feel fresh
|
||||
- Background patterns that add depth without distraction
|
||||
- Typography combinations that create contrast
|
||||
- Visual assets that tell a story
|
||||
|
||||
### Core Design Philosophy
|
||||
|
||||
1. **Simplicity Through Reduction**
|
||||
- Identify the essential purpose and eliminate distractions
|
||||
- Begin with complexity, then deliberately remove until reaching the simplest effective solution
|
||||
- Every element must justify its existence
|
||||
|
||||
2. **Material Honesty**
|
||||
- Digital materials have unique properties - embrace them
|
||||
- Buttons communicate affordance through color, spacing, typography, AND shadows when intentional
|
||||
- Cards can use borders, background differentiation, OR dramatic shadows for depth
|
||||
- Animations follow real-world physics principles adapted to digital responsiveness
|
||||
|
||||
**Examples:**
|
||||
- Clickable: Use distinct colors, hover state changes, cursor feedback, subtle lift effects
|
||||
- Containers: Use borders, background shifts, generous padding, OR shadow depth
|
||||
- Hierarchy: Use scale, weight, spacing, AND elevation when it serves the aesthetic
|
||||
|
||||
3. **Functional Layering**
|
||||
- Create hierarchy through typography scale, color contrast, and spatial relationships
|
||||
- Layer information conceptually (primary → secondary → tertiary)
|
||||
- Use shadows and gradients INTENTIONALLY when they serve the aesthetic direction
|
||||
- Embrace functional depth: modals over content, dropdowns over UI
|
||||
- Avoid: glass morphism, Apple mimicry (but shadows/gradients are tools, not enemies)
|
||||
|
||||
4. **Obsessive Detail**
|
||||
- Consider every pixel, interaction, and transition
|
||||
- Excellence emerges from hundreds of small, intentional decisions
|
||||
- Balance: Details should serve simplicity, not complexity
|
||||
- When detail conflicts with clarity, clarity wins
|
||||
|
||||
5. **Coherent Design Language**
|
||||
- Every element should visually communicate its function
|
||||
- Elements should feel part of a unified system
|
||||
- Nothing should feel arbitrary
|
||||
|
||||
6. **Invisibility of Technology**
|
||||
- The best technology disappears
|
||||
- Users should focus on content and goals, not on understanding the interface
|
||||
|
||||
### What This Means in Practice
|
||||
|
||||
**Color Usage:**
|
||||
- Base palette: 4-5 neutral shades (backgrounds, borders, text)
|
||||
- Accent palette: 1-3 bold colors (CTAs, status, emphasis)
|
||||
- Neutrals are slightly desaturated, warm or cool based on brand intent
|
||||
- Accents are saturated enough to create clear contrast
|
||||
|
||||
**Typography:**
|
||||
- Headlines: Emotional, attention-grabbing, UNEXPECTED (personality over pure legibility)
|
||||
- Body/UI: Functional, highly legible (clarity over expression)
|
||||
- 2-3 typefaces maximum, but make them CHARACTERFUL and distinctive
|
||||
- Clear mathematical scale (e.g., 1.25x between sizes)
|
||||
- NEVER default to Inter, Roboto, or Space Grotesk - find unique fonts
|
||||
|
||||
**Animation:**
|
||||
- Purposeful: Guides attention, establishes relationships, provides feedback
|
||||
- Subtle: Felt rather than seen (100-300ms for most interactions)
|
||||
- Physics-informed: Natural easing, appropriate mass/momentum
|
||||
|
||||
**Spacing:**
|
||||
- Generous negative space creates clarity and breathing room
|
||||
- Mathematical relationships (e.g., 4px base, 8/16/24/32/48px scale)
|
||||
- Consistent application creates visual rhythm
|
||||
|
||||
### Design Decision Checklist
|
||||
|
||||
Before presenting any design, verify:
|
||||
|
||||
1. **Purpose**: Does every element serve a clear function?
|
||||
2. **Hierarchy**: Is visual importance aligned with content importance?
|
||||
3. **Consistency**: Do similar elements look and behave similarly?
|
||||
4. **Accessibility**: Does it meet WCAG AA standards? (contrast, touch targets, keyboard nav)
|
||||
5. **Responsiveness**: Does it work on mobile, tablet, desktop?
|
||||
6. **Uniqueness**: Does this break from generic SaaS patterns?
|
||||
7. **Approval**: Have I asked before implementing colors, fonts, sizes, layouts?
|
||||
|
||||
**Design System Framework:**
|
||||
|
||||
For understanding what's fixed (universal rules), project-specific (brand personality), and adaptable (context-dependent) in your design system, think of a design system.
|
||||
|
||||
## Visual Design Standards
|
||||
|
||||
### Color & Contrast
|
||||
|
||||
**Color System Architecture:**
|
||||
|
||||
Every interface needs two color roles:
|
||||
|
||||
1. **Base/Neutral Palette (4-5 colors):**
|
||||
- Backgrounds (lightest)
|
||||
- Surface colors (cards, inputs)
|
||||
- Borders and dividers
|
||||
- Text (darkest)
|
||||
- Use slightly desaturated, warm or cool greys based on brand
|
||||
|
||||
2. **Accent Palette (1-3 colors):**
|
||||
- Primary action (CTA buttons)
|
||||
- Status indicators (success, warning, error, info)
|
||||
- Focus/hover states
|
||||
- Use saturated colors for clear contrast against neutrals
|
||||
|
||||
**Palette Structure Example:**
|
||||
```
|
||||
Neutrals: slate-50, slate-100, slate-300, slate-700, slate-900
|
||||
Accents: teal-500 (primary), amber-500 (warning), red-500 (error)
|
||||
```
|
||||
|
||||
**Color Application Rules:**
|
||||
|
||||
- **Backgrounds**: Lightest neutral (slate-50 or white)
|
||||
- **Text**: Darkest neutral for primary text (slate-900), mid-tone for secondary (slate-600)
|
||||
- **Buttons (primary)**: Accent color with white text
|
||||
- **Buttons (secondary)**: Neutral with border and dark text
|
||||
- **Status indicators**: Specific accent (green=success, red=error, amber=warning, blue=info)
|
||||
- **Interactive states**:
|
||||
- Hover: Darken by 10-15% or shift hue slightly
|
||||
- Focus: Use ring/outline in accent color
|
||||
- Disabled: Reduce opacity to 40-50% and remove hover effects
|
||||
|
||||
**Color Relationships:**
|
||||
|
||||
Choose warm or cool intentionally based on brand:
|
||||
- **Warm greys** (beige/brown undertones): Organic, approachable, trustworthy
|
||||
- **Cool greys** (blue undertones): Modern, tech-forward, professional
|
||||
|
||||
Accent colors should have clear contrast with both:
|
||||
- Light backgrounds (for buttons on white)
|
||||
- Dark text (if used as backgrounds for white text)
|
||||
|
||||
**Intentional Color Usage:**
|
||||
- Every color must serve a purpose (hierarchy, function, status, or action)
|
||||
- Avoid decorative colors that don't communicate meaning
|
||||
- Maintain consistency: same color = same meaning throughout
|
||||
|
||||
**Accessibility:**
|
||||
- Ensure sufficient contrast for color-blind users
|
||||
- Follow WCAG 2.1 AA: minimum 4.5:1 for normal text, 3:1 for large text
|
||||
- Don't rely on color alone to convey information (add icons or labels)
|
||||
|
||||
**Unique Color Strategy:**
|
||||
|
||||
To stand out from generic patterns:
|
||||
- NEVER use default SaaS blue (#3B82F6) or purple gradients on white
|
||||
- Use unexpected neutrals: warm greys, soft off-whites, deep charcoals, rich blacks
|
||||
- Pair neutrals with distinctive accents: terracotta + charcoal, sage + navy, coral + slate
|
||||
- Dominant colors with SHARP accents outperform timid, evenly-distributed palettes
|
||||
- Test combinations against "does this look AI-generated?" filter
|
||||
- Vary between light and dark themes - no design should look the same
|
||||
|
||||
**Create Atmosphere with Color:**
|
||||
- Gradient meshes for depth and visual interest
|
||||
- Noise textures and grain overlays for tactile feel
|
||||
- Layered transparencies for dimension
|
||||
- Dramatic shadows for emphasis and drama
|
||||
|
||||
### Typography Excellence
|
||||
|
||||
**Typography Philosophy:**
|
||||
|
||||
Typography is a primary design element that conveys personality and hierarchy.
|
||||
|
||||
**Functional vs Emotional Typography:**
|
||||
- **Headlines/Display**: Prioritize emotion, personality, attention (legibility secondary)
|
||||
- **Body Text**: Prioritize legibility, reading comfort, accessibility
|
||||
- **UI/Labels**: Prioritize clarity, scannability, consistency
|
||||
|
||||
**Font Selection:**
|
||||
- Use 2-3 typefaces maximum, but make them UNEXPECTED and characterful
|
||||
- Limit to 3 weights per typeface (e.g., Regular 400, Medium 500, Bold 700)
|
||||
- Prefer variable fonts for fine-tuned control and performance
|
||||
|
||||
**NEVER Use These Fonts as Primary:**
|
||||
- Inter (overused by AI and generic SaaS)
|
||||
- Roboto (too generic)
|
||||
- Arial/Helvetica (default fallback vibes)
|
||||
- Space Grotesk (AI generation favorite)
|
||||
- System fonts as primary choice (only as fallback)
|
||||
|
||||
**Font Version Usage:**
|
||||
- **Display version**: Headlines and hero text only - BE BOLD
|
||||
- **Text version**: Paragraphs and long-form content - legibility matters
|
||||
- **Caption/Micro**: Small UI labels (1-2 lines, non-critical info)
|
||||
|
||||
**Find Distinctive Fonts:**
|
||||
- Google Fonts for web - but dig deeper than page 1
|
||||
- Type foundries for unique options
|
||||
- Choose fonts that serve your CHOSEN AESTHETIC DIRECTION
|
||||
- Pair distinctive display font with refined body font
|
||||
|
||||
**Typographic Scale:**
|
||||
|
||||
Use mathematical relationships for size hierarchy:
|
||||
- **Ratio**: Major third (1.25x) for moderate contrast, Perfect fourth (1.333x) for dramatic
|
||||
- **Base size**: 16px (1rem) for body text
|
||||
- **Example scale (1.25x)**:
|
||||
```
|
||||
xs: 0.64rem (10px)
|
||||
sm: 0.8rem (13px)
|
||||
base: 1rem (16px)
|
||||
lg: 1.25rem (20px)
|
||||
xl: 1.563rem (25px)
|
||||
2xl: 1.953rem (31px)
|
||||
3xl: 2.441rem (39px)
|
||||
4xl: 3.052rem (49px)
|
||||
5xl: 3.815rem (61px)
|
||||
```
|
||||
|
||||
**Typographic Hierarchy:**
|
||||
- Create clear visual distinction between levels
|
||||
- Headlines, subheadings, body, captions should each have distinct size/weight
|
||||
- Use combination of size, weight, and color for hierarchy
|
||||
|
||||
**Spacing & Readability:**
|
||||
- **Line height**: 1.5x font size for body text (e.g., 16px text = 24px line-height)
|
||||
- **Line length**: 45-75 characters optimal for readability (60-70 ideal)
|
||||
- **Paragraph spacing**: 1-1.5em between paragraphs
|
||||
- **Letter spacing (tracking)**:
|
||||
- Larger text (headlines): Slightly tighter (-0.02em to -0.05em)
|
||||
- Normal text (body): Default (0)
|
||||
- Small text (captions): Slightly looser (+0.01em to +0.03em)
|
||||
- General rule: As size increases, reduce tracking; as size decreases, increase tracking
|
||||
|
||||
**Font Pairing Logic:**
|
||||
|
||||
When using multiple typefaces, create contrast through:
|
||||
- **Category contrast**: Serif + Sans-serif (classic, clear distinction)
|
||||
- **Weight contrast**: Light + Bold (dynamic, energetic)
|
||||
- **Personality contrast**: Geometric + Humanist (modern + warm)
|
||||
|
||||
Examples:
|
||||
- Serif headlines + Sans body (editorial, trustworthy)
|
||||
- Display headlines + System body (distinctive + efficient)
|
||||
- Bold sans headlines + Light sans body (modern, clean)
|
||||
|
||||
**UI Typography:**
|
||||
|
||||
Specific guidance for interface elements:
|
||||
- **Button text**: Semi-Bold (600), 14-16px, consistent casing (all-caps OR title case)
|
||||
- **Form labels**: Regular (400), 14px, positioned above input
|
||||
- **Form input text**: Regular (400), 16px minimum (prevents iOS zoom on focus)
|
||||
- **Placeholder text**: Light (300) or desaturated color, same size as input
|
||||
- **Error messages**: Regular (400), 12-14px, color-coded (red-ish)
|
||||
|
||||
**Responsive Typography:**
|
||||
|
||||
Scale type sizes across breakpoints:
|
||||
```tsx
|
||||
// Example with Tailwind
|
||||
<h1 className="text-3xl md:text-4xl lg:text-5xl">
|
||||
Responsive Headline
|
||||
</h1>
|
||||
|
||||
// Or with CSS clamp (fluid)
|
||||
h1 {
|
||||
font-size: clamp(2rem, 5vw, 4rem);
|
||||
}
|
||||
```
|
||||
|
||||
Reduce sizes on mobile (20-30% smaller than desktop)
|
||||
Reduce hierarchy levels on small screens (fewer distinct sizes)
|
||||
|
||||
### Layout & Spatial Design
|
||||
|
||||
**Compositional Balance:**
|
||||
- Every screen should feel balanced
|
||||
- Pay attention to visual weight and negative space
|
||||
- Use generous negative space to focus attention
|
||||
- Add sufficient margins and paddings for professional, spacious look
|
||||
|
||||
**Grid Discipline:**
|
||||
- Maintain consistent underlying grid system
|
||||
- Create sense of order while allowing meaningful exceptions
|
||||
- Use grid/flex wrappers with `gap` for spacing
|
||||
- Prioritize wrappers over direct margins/padding on children
|
||||
|
||||
**Spatial Relationships:**
|
||||
- Group related elements through proximity, alignment, and shared attributes
|
||||
- Use size, color, and spacing to highlight important elements
|
||||
- Guide user focus through visual hierarchy
|
||||
|
||||
**Attention Guidance:**
|
||||
- Design interfaces that guide user attention effectively
|
||||
- Avoid cluttered interfaces where elements compete
|
||||
- Create clear paths through the content
|
||||
|
||||
## Interaction Design
|
||||
|
||||
|
||||
**Motion Specification:**
|
||||
|
||||
For detailed motion specs, see MOTION-SPEC.md (easing curves, duration tables, state-specific animations, implementation patterns).
|
||||
|
||||
### User Experience Patterns
|
||||
|
||||
**Core UX Principles:**
|
||||
|
||||
1. **Direct Manipulation**
|
||||
- Users interact directly with content, not through abstract controls
|
||||
- Examples:
|
||||
- Drag & drop to reorder items (not up/down buttons)
|
||||
- Inline editing (click to edit, not separate form)
|
||||
- Sliders for ranges (not numeric input with +/-)
|
||||
- Pinch/zoom gestures on mobile (not +/- buttons)
|
||||
|
||||
2. **Immediate Feedback**
|
||||
- Every interaction provides instantaneous visual feedback (within 100ms)
|
||||
- Types of feedback:
|
||||
- **Visual**: Button pressed state, hover effects, color changes
|
||||
- **Haptic**: Vibration on mobile (submit, error, success)
|
||||
- **Audio**: Subtle sounds for critical actions (optional, user-controlled)
|
||||
- **Loading**: Skeleton screens, spinners for >300ms operations
|
||||
- **Success**: Checkmarks, green highlights, toast notifications
|
||||
- **Error**: Red highlights, inline error messages, shake animations
|
||||
|
||||
3. **Consistent Behavior**
|
||||
- Similar-looking elements behave similarly
|
||||
- Examples:
|
||||
- **Visual consistency**: All primary buttons have same colors, sizes, hover states
|
||||
- **Behavioral consistency**: All modals close via X button, ESC key, and outside click
|
||||
- **Interaction consistency**: All drag targets have same hover state and drop feedback
|
||||
- **Pattern consistency**: All forms validate on blur and submit
|
||||
|
||||
4. **Forgiveness**
|
||||
- Make errors difficult, but recovery easy
|
||||
- **Prevention strategies**:
|
||||
- Disable invalid actions (grey out unavailable buttons)
|
||||
- Validate inputs inline (before submission)
|
||||
- Confirm destructive actions (delete, overwrite)
|
||||
- Auto-save in background (drafts, progress)
|
||||
- **Recovery strategies**:
|
||||
- Undo/redo for all state changes
|
||||
- Soft deletes (trash/archive before permanent delete)
|
||||
- Clear error messages with actionable fixes
|
||||
- Preserve user input on errors (don't clear forms)
|
||||
|
||||
5. **Progressive Disclosure**
|
||||
- Reveal details as needed rather than overwhelming users
|
||||
- Levels of disclosure:
|
||||
- **Summary**: Show essential info by default (card title, price, rating)
|
||||
- **Details**: Expand to show more info (description, specs, reviews)
|
||||
- **Advanced**: Hide complex options behind "Advanced settings" toggle
|
||||
- Examples:
|
||||
- Accordion: Start collapsed, expand on click
|
||||
- Search filters: Show 3-5 common filters, hide rest behind "More filters"
|
||||
- Settings: Basic settings visible, advanced behind "Show advanced"
|
||||
|
||||
**Modern UX Patterns:**
|
||||
|
||||
1. **Conversational Interfaces**
|
||||
|
||||
Prioritize natural language interaction where appropriate:
|
||||
|
||||
**Four types:**
|
||||
- **Pure chat**: Full conversation (AI assistants, support bots)
|
||||
- **Command palette**: Text-based shortcuts (Cmd+K, search everywhere)
|
||||
- **Smart search**: Natural language queries (search "meetings next week" vs filtering)
|
||||
- **Form alternatives**: Conversational data collection ("What's your name?" vs form fields)
|
||||
|
||||
**When to use:**
|
||||
- Complex searches with multiple variables
|
||||
- Task guidance (wizards, onboarding)
|
||||
- Contextual help
|
||||
- Quick actions (command palette)
|
||||
|
||||
**When NOT to use:**
|
||||
- Simple forms (just use inputs)
|
||||
- Precise control interfaces (design tools, dashboards)
|
||||
- High-frequency repetitive tasks
|
||||
|
||||
2. **Adaptive Layouts**
|
||||
|
||||
Respond to user context automatically:
|
||||
- **Time-based**: Dark mode at night, light during day
|
||||
- **Device-based**: Simplified UI on mobile, full features on desktop
|
||||
- **Connection-based**: Reduce images/video on slow connections
|
||||
- **Usage-based**: Prioritize frequent actions, hide rarely-used features
|
||||
|
||||
Examples:
|
||||
- Auto dark/light mode based on time or system preference
|
||||
- Simplified mobile navigation (hamburger menu) vs full desktop nav
|
||||
- Collapsed sidebar on small screens, expanded on large
|
||||
|
||||
3. **Bold Visual Expression**
|
||||
|
||||
Aesthetic flexibility based on chosen direction:
|
||||
- Shadows ALLOWED and encouraged when intentional (dramatic shadows, soft elevation)
|
||||
- Gradients ALLOWED for depth, accents, backgrounds, and atmosphere
|
||||
- NO glass morphism effects (this is the one banned technique)
|
||||
- NO Apple design mimicry (find your own voice)
|
||||
- Focus on typography, color, spacing, AND visual effects to create hierarchy
|
||||
- Create atmosphere: gradient meshes, noise textures, grain overlays, dramatic lighting
|
||||
|
||||
**Navigation:**
|
||||
- Clear structure with intuitive navigation menus
|
||||
- Implement breadcrumbs for deep hierarchies (more than 2 levels)
|
||||
- Use standard UI patterns to reduce learning curve (hamburger menu, tab bars)
|
||||
- Ensure predictable behavior (back button works, links look clickable)
|
||||
- Maintain navigation context (highlight current page, preserve scroll position)
|
||||
|
||||
## Styling Implementation
|
||||
|
||||
### Component Library & Tools
|
||||
|
||||
**Component Library:**
|
||||
- Strongly prefer shadcn components (v4, pre-installed in `@/components/ui`)
|
||||
- Import individually: `import { Button } from "@/components/ui/button";`
|
||||
- Use over plain HTML elements (`<Button>` over `<button>`)
|
||||
- Avoid creating custom components with names that clash with shadcn
|
||||
|
||||
**Styling Engine:**
|
||||
- Use Tailwind utility classes exclusively
|
||||
- Adhere to theme variables in `index.css` via CSS custom properties
|
||||
- Map variables in `@theme` (see `tailwind.config.js`)
|
||||
- Use inline styles or CSS modules only when absolutely necessary
|
||||
|
||||
**Icons:**
|
||||
- Use `@phosphor-icons/react` for buttons and inputs
|
||||
- Example: `import { Plus } from "@phosphor-icons/react"; <Plus />`
|
||||
- Use color for plain icon buttons
|
||||
- Don't override default `size` or `weight` unless requested
|
||||
|
||||
**Notifications:**
|
||||
- Use `sonner` for toasts
|
||||
- Example: `import { toast } from 'sonner'`
|
||||
|
||||
**Loading States:**
|
||||
- Always add loading states, spinners, placeholder animations
|
||||
- Use skeletons until content renders
|
||||
|
||||
### Layout Implementation
|
||||
|
||||
**Spacing Strategy:**
|
||||
- Use grid/flex wrappers with `gap` for spacing
|
||||
- Prioritize wrappers over direct margins/padding on children
|
||||
- Nest wrappers as needed for complex layouts
|
||||
|
||||
**Conditional Styling:**
|
||||
- Use ternary operators or clsx/classnames utilities
|
||||
- Example: `className={clsx('base-class', { 'active-class': isActive })}`
|
||||
|
||||
### Responsive Design
|
||||
|
||||
**Fluid Layouts:**
|
||||
- Use relative units (%, em, rem) instead of fixed pixels
|
||||
- Implement CSS Grid and Flexbox for flexible layouts
|
||||
- Design mobile-first, then scale up
|
||||
|
||||
**Media Queries:**
|
||||
- Use breakpoints based on content needs, not specific devices
|
||||
- Test across range of devices and orientations
|
||||
|
||||
**Touch Targets:**
|
||||
- Minimum 44x44 pixels for interactive elements
|
||||
- Provide adequate spacing between touch targets
|
||||
- Consider hover states for desktop, focus states for touch/keyboard
|
||||
|
||||
**Performance:**
|
||||
- Optimize assets for mobile networks
|
||||
- Use CSS animations over JavaScript
|
||||
- Implement lazy loading for images and videos
|
||||
|
||||
## Accessibility Standards
|
||||
|
||||
**Core Requirements:**
|
||||
- Follow WCAG 2.1 AA guidelines
|
||||
- Ensure keyboard navigability for all interactive elements
|
||||
- Minimum touch target size: 44×44px
|
||||
- Use semantic HTML for screen reader compatibility
|
||||
- Provide alternative text for images and non-text content
|
||||
|
||||
**Implementation Details:**
|
||||
- Use descriptive variable and function names
|
||||
- Event functions: prefix with "handle" (handleClick, handleKeyDown)
|
||||
- Add accessibility attributes:
|
||||
- `tabindex="0"` for custom interactive elements
|
||||
- `aria-label` for buttons without text
|
||||
- `role` attributes when semantic HTML isn't sufficient
|
||||
- Ensure logical tab order
|
||||
- Provide visible focus states
|
||||
|
||||
## Design Process & Testing
|
||||
|
||||
### Design Workflow
|
||||
|
||||
1. **Understand Context:**
|
||||
- What problem are we solving?
|
||||
- Who are the users and when will they use this?
|
||||
- What are the success criteria?
|
||||
|
||||
2. **Explore Options:**
|
||||
- Present 2-3 alternative approaches
|
||||
- Explain trade-offs of each option
|
||||
- Ask which direction resonates
|
||||
|
||||
3. **Implement Iteratively:**
|
||||
- Start with structure and hierarchy
|
||||
- Add visual polish progressively
|
||||
- Test at each stage
|
||||
|
||||
4. **Validate:**
|
||||
- Use playwright MCP to test visual changes
|
||||
- Check across different screen sizes
|
||||
- Verify accessibility
|
||||
|
||||
### Testing Checklist
|
||||
|
||||
**Visual Testing:**
|
||||
- Use playwright MCP when available for automated testing
|
||||
- Check responsive behavior at common breakpoints
|
||||
- Verify touch targets on mobile
|
||||
- Test with different content lengths (short, long, edge cases)
|
||||
|
||||
**Accessibility Testing:**
|
||||
- Test keyboard navigation
|
||||
- Verify screen reader compatibility
|
||||
- Check color contrast ratios
|
||||
- Ensure focus states are visible
|
||||
|
||||
**Cross-Device Testing:**
|
||||
- Test on actual devices, not just emulators
|
||||
- Check different browsers (Chrome, Firefox, Safari)
|
||||
- Verify touch interactions on mobile
|
||||
- Test landscape and portrait orientations
|
||||
|
||||
## Examples
|
||||
|
||||
### Example 1: Designing a Button
|
||||
|
||||
**Initial Question to Ask:**
|
||||
```
|
||||
Before I implement this button, I have a few design questions:
|
||||
1. What's the primary action you want to emphasize?
|
||||
2. Do you have brand colors in mind, or should I suggest options?
|
||||
3. What emotion should this button convey? (urgent, calm, playful, professional)
|
||||
```
|
||||
|
||||
**After Getting Approval, Implementation:**
|
||||
```tsx
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { ArrowRight } from "@phosphor-icons/react";
|
||||
|
||||
<Button
|
||||
className="bg-slate-800 hover:bg-slate-700 text-white px-6 py-3 rounded-lg transition-colors duration-200"
|
||||
>
|
||||
Get Started
|
||||
<ArrowRight className="ml-2" />
|
||||
</Button>
|
||||
```
|
||||
|
||||
### Example 2: Typography Hierarchy
|
||||
|
||||
**Question First:**
|
||||
```
|
||||
For this content hierarchy, I'm thinking:
|
||||
- Headline: Large, bold, attention-grabbing
|
||||
- Subheading: Medium, regular weight
|
||||
- Body: Smaller, optimized for reading
|
||||
|
||||
Should we go bold and contemporary, or subtle and refined?
|
||||
```
|
||||
|
||||
**Implementation After Approval:**
|
||||
```tsx
|
||||
<div className="space-y-4">
|
||||
<h1 className="text-5xl font-bold tracking-tight text-slate-900">
|
||||
Headline Here
|
||||
</h1>
|
||||
<h2 className="text-2xl text-slate-600">
|
||||
Supporting subheading
|
||||
</h2>
|
||||
<p className="text-base leading-relaxed text-slate-700">
|
||||
Body text optimized for readability with proper line height.
|
||||
</p>
|
||||
</div>
|
||||
```
|
||||
|
||||
### Example 3: Unique Color Palette Suggestion
|
||||
|
||||
**Presenting Options:**
|
||||
```
|
||||
I'd like to suggest three color directions that break from typical SaaS patterns:
|
||||
|
||||
1. **Warm Earth Tones**
|
||||
- Base: Warm grey (#E8E2DC)
|
||||
- Accent: Terracotta (#C86E4B)
|
||||
- For: Organic, trustworthy feel
|
||||
|
||||
2. **Cool Midnight**
|
||||
- Base: Deep navy (#1A2332)
|
||||
- Accent: Cyan (#4ECDC4)
|
||||
- For: Modern, tech-forward feel
|
||||
|
||||
3. **Soft Pastels**
|
||||
- Base: Soft pink (#FFE5E5)
|
||||
- Accent: Sage green (#9DB5A4)
|
||||
- For: Calm, approachable feel
|
||||
|
||||
Which direction feels right for your brand?
|
||||
```
|
||||
|
||||
## Common Patterns to Avoid
|
||||
|
||||
❌ **NEVER:**
|
||||
- Use Inter, Roboto, Arial, Space Grotesk as primary fonts
|
||||
- Use generic SaaS blue (#3B82F6) or purple gradients on white
|
||||
- Copy Apple's design language or use glass morphism
|
||||
- Create cookie-cutter layouts that look AI-generated
|
||||
- Skip asking about context before designing
|
||||
- Converge on common choices across generations (vary everything!)
|
||||
- Use animations that delay user actions
|
||||
- Create cluttered interfaces where elements compete
|
||||
|
||||
✅ **ALWAYS:**
|
||||
- Ask about purpose, tone, constraints, differentiation FIRST
|
||||
- Then commit BOLDLY to a distinctive aesthetic direction
|
||||
- Use unexpected, characterful typography choices
|
||||
- Create atmosphere: shadows, gradients, textures, grain (when intentional)
|
||||
- Dominant colors with sharp accents (not timid, evenly-distributed palettes)
|
||||
- Provide immediate feedback for interactions
|
||||
- Test with real devices
|
||||
- Validate accessibility (it enables creativity, not limits it)
|
||||
- Remember: Claude is capable of extraordinary creative work - don't hold back!
|
||||
|
||||
## Version History
|
||||
|
||||
- v2.0.0 (2025-11-22): Creative liberation update - bold aesthetics, shadows/gradients allowed, Design Thinking protocol
|
||||
- v1.0.0 (2025-10-18): Initial release with comprehensive UI/UX design guidance
|
||||
|
||||
## References
|
||||
|
||||
For additional context, see:
|
||||
- **Anthropic Frontend Aesthetics Cookbook**: https://github.com/anthropics/claude-cookbooks/blob/main/coding/prompting_for_frontend_aesthetics.ipynb
|
||||
- WCAG 2.1 Guidelines: https://www.w3.org/WAI/WCAG21/quickref/
|
||||
- Google Fonts: https://fonts.google.com/
|
||||
- Tailwind CSS Docs: https://tailwindcss.com/docs
|
||||
- Shadcn UI Components: https://ui.shadcn.com/
|
||||
|
||||
**Progressive Disclosure Files:**
|
||||
- ACCESSIBILITY.md - Accessibility essentials (WCAG AA baseline)
|
||||
- MOTION-SPEC.md - Animation timing and easing
|
||||
- RESPONSIVE-DESIGN.md - Mobile-first breakpoints and patterns
|
||||
@@ -1,111 +0,0 @@
|
||||
# Accessibility Essentials
|
||||
|
||||
Accessibility enables creativity - it's a foundation, not a limitation. WCAG 2.1 AA compliance.
|
||||
|
||||
## Core Principles (POUR)
|
||||
|
||||
- **Perceivable**: Content must be perceivable (alt text, contrast, captions)
|
||||
- **Operable**: UI must be keyboard/touch accessible
|
||||
- **Understandable**: Clear, predictable behavior
|
||||
- **Robust**: Works with assistive technologies
|
||||
|
||||
## Contrast Requirements
|
||||
|
||||
| Element | Minimum Ratio |
|
||||
|---------|---------------|
|
||||
| Normal text | 4.5:1 |
|
||||
| Large text (18pt+) | 3:1 |
|
||||
| UI components | 3:1 |
|
||||
|
||||
**Tools**: Chrome DevTools Accessibility tab, WebAIM Contrast Checker
|
||||
|
||||
## Keyboard Navigation
|
||||
|
||||
```tsx
|
||||
// All interactive elements need focus states
|
||||
<button className="focus:ring-4 focus:ring-blue-500 focus:outline-none">
|
||||
Accessible
|
||||
</button>
|
||||
|
||||
// Custom elements need tabindex and key handlers
|
||||
<div
|
||||
role="button"
|
||||
tabIndex={0}
|
||||
onKeyDown={(e) => (e.key === 'Enter' || e.key === ' ') && handleClick()}
|
||||
>
|
||||
Custom Button
|
||||
</div>
|
||||
```
|
||||
|
||||
**Essentials:**
|
||||
- Tab through entire interface
|
||||
- Enter/Space activates elements
|
||||
- Escape closes modals
|
||||
- Visible focus indicators always
|
||||
|
||||
## Essential ARIA
|
||||
|
||||
```tsx
|
||||
// Buttons without text
|
||||
<button aria-label="Close dialog"><X /></button>
|
||||
|
||||
// Expandable elements
|
||||
<button aria-expanded={isOpen} aria-controls="menu">Menu</button>
|
||||
|
||||
// Live regions for dynamic content
|
||||
<div role="status" aria-live="polite">{statusMessage}</div>
|
||||
<div role="alert" aria-live="assertive">{errorMessage}</div>
|
||||
|
||||
// Form errors
|
||||
<input aria-invalid={hasError} aria-describedby="error-msg" />
|
||||
{hasError && <p id="error-msg" role="alert">Error text</p>}
|
||||
```
|
||||
|
||||
## Semantic HTML
|
||||
|
||||
```tsx
|
||||
// Use semantic elements, not divs
|
||||
<header><nav>...</nav></header>
|
||||
<main><article><h1>...</h1></article></main>
|
||||
<footer>...</footer>
|
||||
|
||||
// Heading hierarchy (never skip levels)
|
||||
<h1>Page Title</h1>
|
||||
<h2>Section</h2>
|
||||
<h3>Subsection</h3>
|
||||
```
|
||||
|
||||
## Touch Targets
|
||||
|
||||
- Minimum **44x44px** for all interactive elements
|
||||
- Adequate spacing between targets
|
||||
- `touch-manipulation` CSS for responsive touch
|
||||
|
||||
## Screen Reader Content
|
||||
|
||||
```tsx
|
||||
// Hidden but announced
|
||||
<span className="sr-only">Additional context</span>
|
||||
|
||||
// Skip link
|
||||
<a href="#main" className="sr-only focus:not-sr-only">
|
||||
Skip to main content
|
||||
</a>
|
||||
```
|
||||
|
||||
## Quick Checklist
|
||||
|
||||
- [ ] Keyboard: Can tab through everything
|
||||
- [ ] Focus: Visible focus indicators
|
||||
- [ ] Contrast: 4.5:1 for text
|
||||
- [ ] Alt text: All images have appropriate alt
|
||||
- [ ] Headings: Logical h1-h6 hierarchy
|
||||
- [ ] Forms: Labels associated with inputs
|
||||
- [ ] Errors: Announced to screen readers
|
||||
- [ ] Touch: 44px minimum targets
|
||||
|
||||
## Resources
|
||||
|
||||
- [WCAG 2.1 Quick Reference](https://www.w3.org/WAI/WCAG21/quickref/)
|
||||
- [WebAIM Contrast Checker](https://webaim.org/resources/contrastchecker/)
|
||||
- [ARIA Authoring Practices](https://www.w3.org/WAI/ARIA/apg/)
|
||||
@@ -1,577 +0,0 @@
|
||||
# Design System Template
|
||||
|
||||
Meta-framework for understanding what's fixed, project-specific, and adaptable in your design system.
|
||||
|
||||
## Purpose
|
||||
|
||||
This template helps you distinguish between:
|
||||
- **Fixed Elements**: Universal rules that never change
|
||||
- **Project-Specific Elements**: Filled in for each project based on brand
|
||||
- **Adaptable Elements**: Context-dependent implementations
|
||||
|
||||
---
|
||||
|
||||
## I. FIXED ELEMENTS
|
||||
|
||||
These foundations remain consistent across all projects, regardless of brand or context.
|
||||
|
||||
### 1. Spacing Scale
|
||||
|
||||
**Fixed System:**
|
||||
```
|
||||
4px, 8px, 12px, 16px, 24px, 32px, 48px, 64px, 96px
|
||||
```
|
||||
|
||||
**Usage:**
|
||||
- Margins, padding, gaps between elements
|
||||
- Mathematical relationships ensure visual harmony
|
||||
- Use multipliers of base unit (4px)
|
||||
|
||||
**Why Fixed:**
|
||||
Consistent spacing creates visual rhythm regardless of brand personality.
|
||||
|
||||
### 2. Grid System
|
||||
|
||||
**Fixed Structure:**
|
||||
- **12-column grid** for most layouts (divisible by 2, 3, 4, 6)
|
||||
- **16-column grid** for data-heavy interfaces
|
||||
- **Gutters**: 16px (mobile), 24px (tablet), 32px (desktop)
|
||||
|
||||
**Why Fixed:**
|
||||
Grid provides structural order. Brand personality shows through color, typography, content—not grid structure.
|
||||
|
||||
### 3. Accessibility Standards
|
||||
|
||||
**Fixed Requirements:**
|
||||
- **WCAG 2.1 AA** compliance minimum
|
||||
- **Contrast**: 4.5:1 for normal text, 3:1 for large text
|
||||
- **Touch targets**: Minimum 44×44px
|
||||
- **Keyboard navigation**: All interactive elements accessible
|
||||
- **Screen reader**: Semantic HTML, ARIA labels where needed
|
||||
|
||||
**Why Fixed:**
|
||||
Accessibility is not negotiable. It's a baseline requirement for ethical, legal, and usable products.
|
||||
|
||||
### 4. Typography Hierarchy Logic
|
||||
|
||||
**Fixed Structure:**
|
||||
- **Mathematical scaling**: 1.25x (major third) or 1.333x (perfect fourth)
|
||||
- **Hierarchy levels**: Display → H1 → H2 → H3 → Body → Small → Caption
|
||||
- **Line height**: 1.5x for body text, 1.2-1.3x for headlines
|
||||
- **Line length**: 45-75 characters optimal
|
||||
|
||||
**Why Fixed:**
|
||||
Mathematical relationships create predictable, harmonious hierarchy. Specific fonts change, but the logic doesn't.
|
||||
|
||||
### 5. Component Architecture
|
||||
|
||||
**Fixed Patterns:**
|
||||
- **Button states**: Default, Hover, Active, Focus, Disabled
|
||||
- **Form structure**: Label above input, error below, helper text optional
|
||||
- **Modal pattern**: Overlay + centered content + close mechanism
|
||||
- **Card structure**: Container → Header → Body → Footer (optional)
|
||||
|
||||
**Why Fixed:**
|
||||
Users expect consistent component behavior. Architecture is fixed; appearance is project-specific.
|
||||
|
||||
### 6. Animation Timing Framework
|
||||
|
||||
**Fixed Physics Profiles:**
|
||||
- **Lightweight** (icons, chips): 150ms
|
||||
- **Standard** (cards, panels): 300ms
|
||||
- **Weighty** (modals, pages): 500ms
|
||||
|
||||
**Fixed Easing:**
|
||||
- **Ease-out**: Entrances (fast start, slow end)
|
||||
- **Ease-in**: Exits (slow start, fast end)
|
||||
- **Ease-in-out**: Transitions (smooth both ends)
|
||||
|
||||
**Why Fixed:**
|
||||
Natural physics feel consistent across brands. Duration and easing create that feeling.
|
||||
|
||||
---
|
||||
|
||||
## II. PROJECT-SPECIFIC ELEMENTS
|
||||
|
||||
Fill in these for each project based on brand personality and purpose.
|
||||
|
||||
### 1. Brand Color System
|
||||
|
||||
**Template Structure:**
|
||||
|
||||
```
|
||||
NEUTRALS (4-5 colors):
|
||||
- Background lightest: _______ (e.g., slate-50 or warm-white)
|
||||
- Surface: _______ (e.g., slate-100)
|
||||
- Border/divider: _______ (e.g., slate-300)
|
||||
- Text secondary: _______ (e.g., slate-600)
|
||||
- Text primary: _______ (e.g., slate-900)
|
||||
|
||||
ACCENTS (1-3 colors):
|
||||
- Primary (main CTA): _______ (e.g., teal-500)
|
||||
- Secondary (alternative action): _______ (optional)
|
||||
- Status colors:
|
||||
- Success: _______ (green-ish)
|
||||
- Warning: _______ (amber-ish)
|
||||
- Error: _______ (red-ish)
|
||||
- Info: _______ (blue-ish)
|
||||
```
|
||||
|
||||
**Questions to Answer:**
|
||||
- What emotion should the brand evoke? (Trust, excitement, calm, urgency)
|
||||
- Warm or cool neutrals?
|
||||
- Conservative or bold accents?
|
||||
|
||||
**Examples:**
|
||||
|
||||
**Project A: Fintech App**
|
||||
```
|
||||
Neutrals: Cool greys (slate-50 → slate-900)
|
||||
Primary: Deep blue (#0A2463) – trust, professionalism
|
||||
Success: Muted green (#10B981)
|
||||
Why: Financial products need trust, not playfulness
|
||||
```
|
||||
|
||||
**Project B: Creative Community**
|
||||
```
|
||||
Neutrals: Warm greys with beige undertones
|
||||
Primary: Coral (#FF6B6B) – energy, creativity
|
||||
Success: Teal (#06D6A0) – fresh, unexpected
|
||||
Why: Creative spaces should feel inviting, not corporate
|
||||
```
|
||||
|
||||
**Project C: Healthcare Platform**
|
||||
```
|
||||
Neutrals: Pure greys (minimal color temperature)
|
||||
Primary: Soft blue (#4A90E2) – calm, clinical
|
||||
Success: Medical green (#38A169)
|
||||
Why: Healthcare needs clarity and calm, not distraction
|
||||
```
|
||||
|
||||
### 2. Typography Pairing
|
||||
|
||||
**Template:**
|
||||
|
||||
```
|
||||
HEADLINE FONT: _______
|
||||
- Weight: _______ (e.g., Bold 700)
|
||||
- Use case: H1, H2, display text
|
||||
- Personality: _______ (geometric/humanist/serif/etc.)
|
||||
|
||||
BODY FONT: _______
|
||||
- Weight: _______ (e.g., Regular 400, Medium 500)
|
||||
- Use case: Paragraphs, UI text
|
||||
- Personality: _______ (neutral/readable/efficient)
|
||||
|
||||
OPTIONAL ACCENT FONT: _______
|
||||
- Weight: _______
|
||||
- Use case: _______ (special headlines, callouts)
|
||||
```
|
||||
|
||||
**Pairing Logic:**
|
||||
- Serif + Sans-serif (classic, editorial)
|
||||
- Geometric + Humanist (modern + warm)
|
||||
- Display + System (distinctive + efficient)
|
||||
|
||||
**Examples:**
|
||||
|
||||
**Project A: Editorial Platform**
|
||||
```
|
||||
Headline: Playfair Display (Serif, Bold 700)
|
||||
Body: Inter (Sans-serif, Regular 400)
|
||||
Why: Serif headlines = trustworthy, editorial feel
|
||||
```
|
||||
|
||||
**Project B: Tech Startup**
|
||||
```
|
||||
Headline: DM Sans (Sans-serif, Bold 700)
|
||||
Body: DM Sans (Regular 400, Medium 500)
|
||||
Why: Single-font system = modern, efficient, cohesive
|
||||
```
|
||||
|
||||
**Project C: Luxury Brand**
|
||||
```
|
||||
Headline: Cormorant Garamond (Serif, Light 300)
|
||||
Body: Lato (Sans-serif, Regular 400)
|
||||
Why: Elegant serif + readable sans = sophisticated
|
||||
```
|
||||
|
||||
### 3. Tone of Voice
|
||||
|
||||
**Template:**
|
||||
|
||||
```
|
||||
BRAND PERSONALITY:
|
||||
- Formal ↔ Casual: _______ (1-10 scale)
|
||||
- Professional ↔ Friendly: _______ (1-10 scale)
|
||||
- Serious ↔ Playful: _______ (1-10 scale)
|
||||
- Authoritative ↔ Conversational: _______ (1-10 scale)
|
||||
|
||||
MICROCOPY EXAMPLES:
|
||||
- Button label (submit form): _______
|
||||
- Error message (invalid email): _______
|
||||
- Success message (saved): _______
|
||||
- Empty state: _______
|
||||
|
||||
ANIMATION PERSONALITY:
|
||||
- Speed: _______ (quick/moderate/slow)
|
||||
- Feel: _______ (precise/smooth/bouncy)
|
||||
```
|
||||
|
||||
**Examples:**
|
||||
|
||||
**Project A: Banking App**
|
||||
```
|
||||
Personality: Formal (8), Professional (9), Serious (8)
|
||||
Button: "Submit Application"
|
||||
Error: "Email address format is invalid"
|
||||
Success: "Application submitted successfully"
|
||||
Animation: Quick (precise, efficient, no-nonsense)
|
||||
```
|
||||
|
||||
**Project B: Social App**
|
||||
```
|
||||
Personality: Casual (8), Friendly (9), Playful (7)
|
||||
Button: "Let's go!"
|
||||
Error: "Hmm, that email doesn't look right"
|
||||
Success: "Nice! You're all set 🎉"
|
||||
Animation: Moderate (smooth, friendly bounce)
|
||||
```
|
||||
|
||||
### 4. Animation Speed & Feel
|
||||
|
||||
**Template:**
|
||||
|
||||
```
|
||||
SPEED PREFERENCE:
|
||||
- UI interactions: _______ (100-150ms / 150-200ms / 200-300ms)
|
||||
- State changes: _______ (200ms / 300ms / 400ms)
|
||||
- Page transitions: _______ (300ms / 500ms / 700ms)
|
||||
|
||||
ANIMATION STYLE:
|
||||
- Easing preference: _______ (sharp / standard / bouncy)
|
||||
- Movement type: _______ (minimal / smooth / expressive)
|
||||
```
|
||||
|
||||
**Examples:**
|
||||
|
||||
**Project A: Trading Platform**
|
||||
```
|
||||
Speed: Fast (100ms UI, 200ms states, 300ms pages)
|
||||
Style: Sharp easing, minimal movement
|
||||
Why: Traders need speed, not distraction
|
||||
```
|
||||
|
||||
**Project B: Wellness App**
|
||||
```
|
||||
Speed: Slow (200ms UI, 400ms states, 500ms pages)
|
||||
Style: Smooth easing, gentle movement
|
||||
Why: Calm, relaxing experience matches brand
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## III. ADAPTABLE ELEMENTS
|
||||
|
||||
Context-dependent implementations that vary based on use case.
|
||||
|
||||
### 1. Component Variations
|
||||
|
||||
**Button Variants:**
|
||||
- **Primary**: Full background color (high emphasis)
|
||||
- **Secondary**: Outline only (medium emphasis)
|
||||
- **Tertiary**: Text only (low emphasis)
|
||||
- **Destructive**: Red-ish (danger actions)
|
||||
- **Ghost**: Minimal (navigation, toolbars)
|
||||
|
||||
**Adaptation Rules:**
|
||||
- Primary: Main CTA, one per screen section
|
||||
- Secondary: Alternative actions
|
||||
- Tertiary: Less important actions, multiple allowed
|
||||
- Use brand colors, but hierarchy logic is fixed
|
||||
|
||||
### 2. Responsive Breakpoints
|
||||
|
||||
**Fixed Ranges:**
|
||||
- XS: 0-479px (small phones)
|
||||
- SM: 480-767px (large phones)
|
||||
- MD: 768-1023px (tablets)
|
||||
- LG: 1024-1439px (laptops)
|
||||
- XL: 1440px+ (desktop)
|
||||
|
||||
**Adaptable Implementations:**
|
||||
|
||||
**Simple Content Site:**
|
||||
```
|
||||
XS-SM: Single column
|
||||
MD: 2 columns
|
||||
LG-XL: 3 columns max
|
||||
Why: Content-focused, don't overwhelm
|
||||
```
|
||||
|
||||
**Dashboard/Data App:**
|
||||
```
|
||||
XS: Collapsed, cards stack
|
||||
SM: Simplified sidebar
|
||||
MD: Full sidebar + main content
|
||||
LG-XL: Sidebar + main + right panel
|
||||
Why: Data apps need more screen real estate
|
||||
```
|
||||
|
||||
### 3. Dark Mode Palette
|
||||
|
||||
**Adaptation Strategy:**
|
||||
|
||||
Not a simple inversion. Dark mode needs adjusted contrast:
|
||||
|
||||
**Light Mode:**
|
||||
```
|
||||
Background: #FFFFFF (white)
|
||||
Text: #0F172A (slate-900) → 21:1 contrast
|
||||
```
|
||||
|
||||
**Dark Mode (Adapted):**
|
||||
```
|
||||
Background: #0F172A (slate-900)
|
||||
Text: #E2E8F0 (slate-200) → 15.8:1 contrast (still AA, but softer)
|
||||
```
|
||||
|
||||
**Why Adapt:**
|
||||
Pure white on pure black is too harsh. Dark mode needs slightly lower contrast for eye comfort.
|
||||
|
||||
### 4. Loading States
|
||||
|
||||
**Context-Dependent:**
|
||||
|
||||
**Fast operations (<500ms):**
|
||||
- No loading indicator (feels instant)
|
||||
|
||||
**Medium operations (500ms-2s):**
|
||||
- Spinner or skeleton screen
|
||||
|
||||
**Long operations (>2s):**
|
||||
- Progress bar with percentage
|
||||
- Or: Skeleton + estimated time
|
||||
|
||||
**Interactive Operations:**
|
||||
- Button shows spinner inside (don't disable, show state)
|
||||
|
||||
### 5. Error Handling Strategy
|
||||
|
||||
**Context-Dependent:**
|
||||
|
||||
**Form Errors:**
|
||||
```
|
||||
Validate: On blur (after user leaves field)
|
||||
Display: Inline below field
|
||||
Recovery: Clear error on fix
|
||||
```
|
||||
|
||||
**API Errors:**
|
||||
```
|
||||
Transient (network): Show retry button
|
||||
Permanent (404): Show helpful message + next steps
|
||||
Critical (500): Contact support option
|
||||
```
|
||||
|
||||
**Data Errors:**
|
||||
```
|
||||
Missing: Show empty state with action
|
||||
Corrupt: Show error boundary with reload
|
||||
Invalid: Highlight + explain what's wrong
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## DECISION TREE
|
||||
|
||||
When implementing a feature, ask:
|
||||
|
||||
### Is this...
|
||||
|
||||
**FIXED?**
|
||||
- Does it affect structure, accessibility, or universal UX?
|
||||
- Examples: Spacing scale, grid, contrast ratios, component architecture
|
||||
- **Action**: Use the fixed system, no variation
|
||||
|
||||
**PROJECT-SPECIFIC?**
|
||||
- Does it express brand personality or purpose?
|
||||
- Examples: Colors, typography, tone of voice, animation feel
|
||||
- **Action**: Fill in the template for this project
|
||||
|
||||
**ADAPTABLE?**
|
||||
- Does it depend on context, content, or use case?
|
||||
- Examples: Component variants, responsive behavior, error handling
|
||||
- **Action**: Choose appropriate variation based on context
|
||||
|
||||
---
|
||||
|
||||
## EXAMPLE: Implementing a "Submit" Button
|
||||
|
||||
### Fixed Elements (Always the same):
|
||||
- Touch target: 44px minimum height
|
||||
- Padding: 16px horizontal (from spacing scale)
|
||||
- States: Default, Hover, Active, Focus, Disabled
|
||||
- Animation: 150ms ease-out (lightweight profile)
|
||||
|
||||
### Project-Specific (Filled per project):
|
||||
- **Project A (Bank)**: Dark blue background, white text, "Submit Application"
|
||||
- **Project B (Social)**: Coral background, white text, "Let's Go!"
|
||||
- **Project C (Healthcare)**: Soft blue background, white text, "Continue"
|
||||
|
||||
### Adaptable (Context-dependent):
|
||||
- **Form context**: Primary button (full color)
|
||||
- **Toolbar context**: Ghost button (text only)
|
||||
- **Danger context**: Destructive variant (red-ish)
|
||||
|
||||
---
|
||||
|
||||
## VALIDATION CHECKLIST
|
||||
|
||||
Before finalizing a design, check:
|
||||
|
||||
### Fixed Elements
|
||||
- [ ] Uses spacing scale (4/8/12/16/24/32/48/64/96px)
|
||||
- [ ] Follows grid system (12 or 16 columns)
|
||||
- [ ] Meets WCAG AA contrast (4.5:1 normal, 3:1 large)
|
||||
- [ ] Touch targets ≥ 44px
|
||||
- [ ] Typography follows mathematical scale
|
||||
- [ ] Components follow standard architecture
|
||||
|
||||
### Project-Specific Elements
|
||||
- [ ] Brand colors filled in and intentional
|
||||
- [ ] Typography pairing chosen and justified
|
||||
- [ ] Tone of voice defined and consistent
|
||||
- [ ] Animation speed matches brand personality
|
||||
|
||||
### Adaptable Elements
|
||||
- [ ] Component variants appropriate for context
|
||||
- [ ] Responsive behavior fits content type
|
||||
- [ ] Loading states match operation duration
|
||||
- [ ] Error handling fits error type
|
||||
|
||||
---
|
||||
|
||||
## PROJECT KICKOFF TEMPLATE
|
||||
|
||||
Use this to start a new project:
|
||||
|
||||
```
|
||||
PROJECT NAME: _______________________
|
||||
PURPOSE: ____________________________
|
||||
|
||||
BRAND PERSONALITY:
|
||||
- Primary emotion: _______
|
||||
- Warm or cool: _______
|
||||
- Formal or casual: _______
|
||||
- Conservative or bold: _______
|
||||
|
||||
COLORS (fill the template):
|
||||
- Neutral base: _______
|
||||
- Primary accent: _______
|
||||
- Status colors: _______ / _______ / _______
|
||||
|
||||
TYPOGRAPHY (fill the template):
|
||||
- Headline font: _______
|
||||
- Body font: _______
|
||||
- Pairing rationale: _______
|
||||
|
||||
TONE:
|
||||
- Button labels style: _______
|
||||
- Error message style: _______
|
||||
- Success message style: _______
|
||||
|
||||
ANIMATION:
|
||||
- Speed preference: _______ (fast/moderate/slow)
|
||||
- Feel preference: _______ (sharp/smooth/bouncy)
|
||||
|
||||
TARGET DEVICES:
|
||||
- Primary: _______ (mobile/desktop/both)
|
||||
- Secondary: _______
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## MAINTAINING CONSISTENCY
|
||||
|
||||
### Documentation
|
||||
- Keep this template updated as system evolves
|
||||
- Document WHY choices were made, not just WHAT
|
||||
|
||||
### Communication
|
||||
- Share with designers: "Here's what varies vs. what's fixed"
|
||||
- Share with developers: "Here are the design tokens"
|
||||
|
||||
### Tooling
|
||||
- Use CSS variables for project-specific values
|
||||
- Use Tailwind config for spacing scale
|
||||
- Use design tokens in Figma/Storybook
|
||||
|
||||
### Reviews
|
||||
- Audit: Does new work follow fixed elements?
|
||||
- Validate: Are project-specific elements intentional?
|
||||
- Question: Are adaptations justified by context?
|
||||
|
||||
---
|
||||
|
||||
## EXAMPLES OF COMPLETE SYSTEMS
|
||||
|
||||
### System A: B2B SaaS (Conservative)
|
||||
|
||||
**Fixed**: Standard spacing, 12-col grid, WCAG AA, major third type scale
|
||||
**Project-Specific**:
|
||||
- Colors: Cool greys + corporate blue
|
||||
- Typography: DM Sans (headlines + body)
|
||||
- Tone: Professional, formal
|
||||
- Animation: Quick, precise (150ms)
|
||||
**Adaptable**:
|
||||
- Dashboard gets multi-panel layout
|
||||
- Forms are extensive (use progressive disclosure)
|
||||
- Errors show detailed technical info
|
||||
|
||||
### System B: Consumer Social App (Playful)
|
||||
|
||||
**Fixed**: Same spacing/grid/accessibility/type logic
|
||||
**Project-Specific**:
|
||||
- Colors: Warm greys + vibrant coral
|
||||
- Typography: Poppins (headlines) + Inter (body)
|
||||
- Tone: Casual, friendly, playful
|
||||
- Animation: Moderate, bouncy (200ms)
|
||||
**Adaptable**:
|
||||
- Mobile-first (most users on phones)
|
||||
- Forms are minimal (progressive profiling)
|
||||
- Errors are friendly, not technical
|
||||
|
||||
### System C: Healthcare Platform (Clinical)
|
||||
|
||||
**Fixed**: Same foundational structure
|
||||
**Project-Specific**:
|
||||
- Colors: Pure greys + medical blue
|
||||
- Typography: System fonts (SF Pro / Segoe)
|
||||
- Tone: Clear, authoritative, calm
|
||||
- Animation: Slow, smooth (300ms)
|
||||
**Adaptable**:
|
||||
- Desktop-first (clinical use at workstations)
|
||||
- Forms are complex (HIPAA compliance)
|
||||
- Errors are precise with next steps
|
||||
|
||||
---
|
||||
|
||||
## KEY TAKEAWAY
|
||||
|
||||
**The system flexibility framework lets you:**
|
||||
- Maintain consistency (fixed elements)
|
||||
- Express brand personality (project-specific)
|
||||
- Adapt to context (adaptable elements)
|
||||
|
||||
**Without this framework:**
|
||||
- Designers reinvent spacing every project
|
||||
- Components feel inconsistent across products
|
||||
- Brand personality overrides accessibility
|
||||
- Context-blind implementations feel wrong
|
||||
|
||||
**With this framework:**
|
||||
- Speed: Start from proven foundations
|
||||
- Consistency: Fixed elements guarantee it
|
||||
- Flexibility: Express unique brand identity
|
||||
- Context: Adapt without breaking system
|
||||
@@ -1,72 +0,0 @@
|
||||
# Motion Specification
|
||||
|
||||
Motion should surprise and delight while serving function. Animation is a creative tool.
|
||||
|
||||
## Easing Curves
|
||||
|
||||
| Easing | CSS | Use For |
|
||||
|--------|-----|---------|
|
||||
| **Ease-out** | `cubic-bezier(0.0, 0.0, 0.2, 1)` | Entrances, appearing |
|
||||
| **Ease-in** | `cubic-bezier(0.4, 0.0, 1, 1)` | Exits, disappearing |
|
||||
| **Ease-in-out** | `cubic-bezier(0.4, 0.0, 0.2, 1)` | State changes, transforms |
|
||||
| **Spring** | `cubic-bezier(0.68, -0.55, 0.265, 1.55)` | Playful, attention-grabbing |
|
||||
| **Linear** | `linear` | Spinners, continuous loops |
|
||||
|
||||
## Duration by Element Weight
|
||||
|
||||
| Weight | Duration | Examples |
|
||||
|--------|----------|----------|
|
||||
| **Lightweight** | 150ms | Icons, badges, chips |
|
||||
| **Standard** | 300ms | Cards, panels, list items |
|
||||
| **Weighty** | 500ms | Modals, page transitions |
|
||||
|
||||
## Duration by Interaction
|
||||
|
||||
| Interaction | Duration |
|
||||
|-------------|----------|
|
||||
| Button press | 100ms |
|
||||
| Hover state | 150ms |
|
||||
| Tooltip appear | 200ms |
|
||||
| Tab switch | 250ms |
|
||||
| Modal open | 300ms |
|
||||
| Page transition | 400ms |
|
||||
|
||||
## Common Patterns
|
||||
|
||||
```tsx
|
||||
// Hover transition (CSS)
|
||||
<button className="transition-colors duration-150 ease-out hover:bg-blue-700">
|
||||
|
||||
// Fade + slide (Framer Motion)
|
||||
<motion.div
|
||||
initial={{ opacity: 0, y: 20 }}
|
||||
animate={{ opacity: 1, y: 0 }}
|
||||
transition={{ duration: 0.3, ease: "easeOut" }}
|
||||
/>
|
||||
|
||||
// Stagger children
|
||||
<motion.ul variants={{ visible: { transition: { staggerChildren: 0.1 } } }}>
|
||||
<motion.li variants={{ hidden: { opacity: 0 }, visible: { opacity: 1 } }} />
|
||||
</motion.ul>
|
||||
```
|
||||
|
||||
## Performance Rules
|
||||
|
||||
- Only animate `transform` and `opacity` (GPU-accelerated)
|
||||
- Avoid animating `width`, `height`, `margin`, `padding`
|
||||
- Keep durations under 500ms for UI interactions
|
||||
- Respect `prefers-reduced-motion`:
|
||||
|
||||
```css
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
*, *::before, *::after {
|
||||
animation-duration: 0.01ms !important;
|
||||
transition-duration: 0.01ms !important;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Resources
|
||||
|
||||
- [Framer Motion](https://www.framer.com/motion/)
|
||||
- [CSS Easing Functions](https://easings.net/)
|
||||
@@ -1,90 +0,0 @@
|
||||
# Responsive Design Essentials
|
||||
|
||||
Mobile-first approach: start with mobile, progressively enhance for larger screens.
|
||||
|
||||
## Breakpoints
|
||||
|
||||
| Range | Pixels | Devices | Strategy |
|
||||
|-------|--------|---------|----------|
|
||||
| **XS** | 0-479px | Small phones | Single column, stacked nav, 44px touch targets |
|
||||
| **SM** | 480-767px | Large phones | Single column, bottom nav, simplified UI |
|
||||
| **MD** | 768-1023px | Tablets | 2 columns possible, sidebar nav |
|
||||
| **LG** | 1024-1439px | Laptops | Multi-column, full nav, desktop UI |
|
||||
| **XL** | 1440px+ | Desktop | Max-width containers, multi-panel layouts |
|
||||
|
||||
## Tailwind Responsive
|
||||
|
||||
```tsx
|
||||
// Mobile-first: base styles, then scale up
|
||||
<div className="
|
||||
w-full // mobile: full width
|
||||
sm:w-1/2 // 480px+: half
|
||||
md:w-1/3 // 768px+: third
|
||||
lg:w-1/4 // 1024px+: quarter
|
||||
">
|
||||
|
||||
// Responsive grid
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6">
|
||||
|
||||
// Responsive typography
|
||||
<h1 className="text-3xl md:text-4xl lg:text-5xl">
|
||||
|
||||
// Show/hide by breakpoint
|
||||
<div className="block md:hidden">Mobile only</div>
|
||||
<div className="hidden md:block">Desktop only</div>
|
||||
```
|
||||
|
||||
## Fluid Typography
|
||||
|
||||
```css
|
||||
h1 { font-size: clamp(2rem, 5vw, 4rem); }
|
||||
p { font-size: clamp(1rem, 2.5vw, 1.25rem); }
|
||||
```
|
||||
|
||||
## Touch Targets
|
||||
|
||||
- Minimum **44x44px** for all interactive elements
|
||||
- Use `touch-manipulation` to prevent 300ms tap delay
|
||||
- Adequate spacing between targets
|
||||
|
||||
```tsx
|
||||
<button className="min-w-[44px] min-h-[44px] touch-manipulation">
|
||||
```
|
||||
|
||||
## Mobile Simplification
|
||||
|
||||
| Desktop | Mobile |
|
||||
|---------|--------|
|
||||
| Full nav bar | Hamburger menu |
|
||||
| Side-by-side fields | Stacked fields |
|
||||
| Multi-column grid | Single column |
|
||||
| Inline buttons | Fixed bottom bar |
|
||||
| Data table | Collapsed cards |
|
||||
| Visible sidebar | Hidden/collapsible |
|
||||
|
||||
## Images
|
||||
|
||||
```tsx
|
||||
// Responsive images
|
||||
<img
|
||||
srcSet="image-400w.jpg 400w, image-800w.jpg 800w, image-1200w.jpg 1200w"
|
||||
sizes="(max-width: 640px) 100vw, (max-width: 1024px) 50vw, 33vw"
|
||||
loading="lazy"
|
||||
/>
|
||||
|
||||
// Next.js
|
||||
<Image src="/hero.jpg" width={1200} height={600} priority className="w-full h-auto" />
|
||||
```
|
||||
|
||||
## Testing
|
||||
|
||||
Test at these widths:
|
||||
- 375px (iPhone SE)
|
||||
- 390px (iPhone 14)
|
||||
- 768px (iPad)
|
||||
- 1024px (iPad Pro)
|
||||
- 1280px+ (Desktop)
|
||||
|
||||
## Resources
|
||||
|
||||
- [Tailwind Responsive](https://tailwindcss.com/docs/responsive-design)
|
||||
@@ -1,718 +0,0 @@
|
||||
---
|
||||
name: bencium-innovative-ux-designer
|
||||
description: Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
|
||||
metadata:
|
||||
version: 2.0.0
|
||||
---
|
||||
|
||||
# Innovative UX Designer
|
||||
|
||||
Create distinctive, production-grade frontend interfaces that avoid generic "AI slop" aesthetics. Implement real working code with exceptional attention to aesthetic details and creative choices. Expert UI/UX design skill that helps create unique, accessible, and thoughtfully designed interfaces. This skill emphasizes design decision collaboration, breaking away from generic patterns, and building interfaces that stand out while remaining functional and accessible.
|
||||
|
||||
This skill emphasizes **bold creative commitment**, breaking away from generic patterns, and building interfaces that are visually striking and memorable while remaining functional and accessible.
|
||||
|
||||
## Core Philosophy
|
||||
|
||||
**CRITICAL: Design Thinking Protocol**
|
||||
|
||||
Before coding, **ASK to understand context**, then **COMMIT BOLDLY** to a distinctive direction:
|
||||
|
||||
### Questions to Ask First
|
||||
1. **Purpose**: What problem does this interface solve? Who uses it?
|
||||
2. **Tone**: What aesthetic extreme fits? (see Tone Options below)
|
||||
3. **Constraints**: Technical requirements (framework, performance, accessibility)?
|
||||
4. **Differentiation**: What makes this UNFORGETTABLE? What's the one thing someone will remember?
|
||||
|
||||
### Tone Options (Pick an Extreme)
|
||||
Choose a clear aesthetic direction and execute with precision:
|
||||
- **Brutally minimal** - stripped to essence, bold typography, vast whitespace
|
||||
- **Maximalist chaos** - layered, dense, visually rich, controlled disorder
|
||||
- **Retro-futuristic** - vintage meets sci-fi, nostalgic tech aesthetics
|
||||
- **Organic/natural** - soft edges, earthy colors, nature-inspired textures
|
||||
- **Luxury/refined** - elegant spacing, premium typography, subtle details
|
||||
- **Playful/toy-like** - bright colors, rounded shapes, delightful interactions
|
||||
- **Editorial/magazine** - strong typography hierarchy, asymmetric layouts
|
||||
- **Brutalist/raw** - exposed structure, harsh contrasts, intentionally rough
|
||||
- **Art deco/geometric** - bold patterns, metallic accents, symmetric elegance
|
||||
- **Soft/pastel** - gentle gradients, muted tones, calming atmosphere
|
||||
- **Industrial/utilitarian** - functional, no-nonsense, mechanical precision
|
||||
|
||||
### After Getting Context
|
||||
- **Commit fully** to the chosen direction - no half measures
|
||||
- Present 2-3 alternative approaches with trade-offs
|
||||
- Then implement with precision: production-grade, visually striking, memorable
|
||||
|
||||
## Foundational Design Principles
|
||||
|
||||
### Stand Out From Generic Patterns
|
||||
|
||||
**NEVER Use These AI-Generated Aesthetics:**
|
||||
- **Fonts**: Inter, Roboto, Arial, system fonts as primary choice, Space Grotesk (overused by AI)
|
||||
- **Colors**: Generic SaaS blue (#3B82F6), purple gradients on white backgrounds
|
||||
- **Patterns**: Cookie-cutter layouts, predictable component arrangements
|
||||
- **Effects**: Glass morphism, Apple design mimicry, liquid/blob backgrounds
|
||||
- **Overall**: Anything that looks "Claude-generated" or machine-made
|
||||
|
||||
**Instead, Create Atmosphere:**
|
||||
- Suggest photography, patterns, textures over flat solid colors
|
||||
- Apply gradient meshes, noise textures, geometric patterns
|
||||
- Use layered transparencies, dramatic shadows, decorative borders
|
||||
- Consider custom cursors, grain overlays, contextual effects
|
||||
- Think beyond typical patterns - you can step off the written path
|
||||
|
||||
**Draw Inspiration From:**
|
||||
- Modern landing pages (Perplexity, Comet Browser, Dia Browser)
|
||||
- Framer templates and their innovative approaches
|
||||
- Leading brand design studios
|
||||
- Historical design movements (Bauhaus, Otl Aicher, Braun) - but as inspiration, not imitation
|
||||
- Beautiful background animations (CSS, SVG) - slow, looping, subtle
|
||||
|
||||
**Visual Interest Strategies:**
|
||||
- Unique color pairs that aren't typical
|
||||
- Animation effects that feel fresh
|
||||
- Background patterns that add depth without distraction
|
||||
- Typography combinations that create contrast
|
||||
- Visual assets that tell a story
|
||||
|
||||
### Core Design Philosophy
|
||||
|
||||
1. **Simplicity Through Reduction**
|
||||
- Identify the essential purpose and eliminate distractions
|
||||
- Begin with complexity, then deliberately remove until reaching the simplest effective solution
|
||||
- Every element must justify its existence
|
||||
|
||||
2. **Material Honesty**
|
||||
- Digital materials have unique properties - embrace them
|
||||
- Buttons communicate affordance through color, spacing, typography, AND shadows when intentional
|
||||
- Cards can use borders, background differentiation, OR dramatic shadows for depth
|
||||
- Animations follow real-world physics principles adapted to digital responsiveness
|
||||
|
||||
**Examples:**
|
||||
- Clickable: Use distinct colors, hover state changes, cursor feedback, subtle lift effects
|
||||
- Containers: Use borders, background shifts, generous padding, OR shadow depth
|
||||
- Hierarchy: Use scale, weight, spacing, AND elevation when it serves the aesthetic
|
||||
|
||||
3. **Functional Layering**
|
||||
- Create hierarchy through typography scale, color contrast, and spatial relationships
|
||||
- Layer information conceptually (primary → secondary → tertiary)
|
||||
- Use shadows and gradients INTENTIONALLY when they serve the aesthetic direction
|
||||
- Embrace functional depth: modals over content, dropdowns over UI
|
||||
- Avoid: glass morphism, Apple mimicry (but shadows/gradients are tools, not enemies)
|
||||
|
||||
4. **Obsessive Detail**
|
||||
- Consider every pixel, interaction, and transition
|
||||
- Excellence emerges from hundreds of small, intentional decisions
|
||||
- Balance: Details should serve simplicity, not complexity
|
||||
- When detail conflicts with clarity, clarity wins
|
||||
|
||||
5. **Coherent Design Language**
|
||||
- Every element should visually communicate its function
|
||||
- Elements should feel part of a unified system
|
||||
- Nothing should feel arbitrary
|
||||
|
||||
6. **Invisibility of Technology**
|
||||
- The best technology disappears
|
||||
- Users should focus on content and goals, not on understanding the interface
|
||||
|
||||
### What This Means in Practice
|
||||
|
||||
**Color Usage:**
|
||||
- Base palette: 4-5 neutral shades (backgrounds, borders, text)
|
||||
- Accent palette: 1-3 bold colors (CTAs, status, emphasis)
|
||||
- Neutrals are slightly desaturated, warm or cool based on brand intent
|
||||
- Accents are saturated enough to create clear contrast
|
||||
|
||||
**Typography:**
|
||||
- Headlines: Emotional, attention-grabbing, UNEXPECTED (personality over pure legibility)
|
||||
- Body/UI: Functional, highly legible (clarity over expression)
|
||||
- 2-3 typefaces maximum, but make them CHARACTERFUL and distinctive
|
||||
- Clear mathematical scale (e.g., 1.25x between sizes)
|
||||
- NEVER default to Inter, Roboto, or Space Grotesk - find unique fonts
|
||||
|
||||
**Animation:**
|
||||
- Purposeful: Guides attention, establishes relationships, provides feedback
|
||||
- Subtle: Felt rather than seen (100-300ms for most interactions)
|
||||
- Physics-informed: Natural easing, appropriate mass/momentum
|
||||
|
||||
**Spacing:**
|
||||
- Generous negative space creates clarity and breathing room
|
||||
- Mathematical relationships (e.g., 4px base, 8/16/24/32/48px scale)
|
||||
- Consistent application creates visual rhythm
|
||||
|
||||
### Design Decision Checklist
|
||||
|
||||
Before presenting any design, verify:
|
||||
|
||||
1. **Purpose**: Does every element serve a clear function?
|
||||
2. **Hierarchy**: Is visual importance aligned with content importance?
|
||||
3. **Consistency**: Do similar elements look and behave similarly?
|
||||
4. **Accessibility**: Does it meet WCAG AA standards? (contrast, touch targets, keyboard nav)
|
||||
5. **Responsiveness**: Does it work on mobile, tablet, desktop?
|
||||
6. **Uniqueness**: Does this break from generic SaaS patterns?
|
||||
7. **Approval**: Have I asked before implementing colors, fonts, sizes, layouts?
|
||||
|
||||
**Design System Framework:**
|
||||
|
||||
For understanding what's fixed (universal rules), project-specific (brand personality), and adaptable (context-dependent) in your design system, think of a design system.
|
||||
|
||||
## Visual Design Standards
|
||||
|
||||
### Color & Contrast
|
||||
|
||||
**Color System Architecture:**
|
||||
|
||||
Every interface needs two color roles:
|
||||
|
||||
1. **Base/Neutral Palette (4-5 colors):**
|
||||
- Backgrounds (lightest)
|
||||
- Surface colors (cards, inputs)
|
||||
- Borders and dividers
|
||||
- Text (darkest)
|
||||
- Use slightly desaturated, warm or cool greys based on brand
|
||||
|
||||
2. **Accent Palette (1-3 colors):**
|
||||
- Primary action (CTA buttons)
|
||||
- Status indicators (success, warning, error, info)
|
||||
- Focus/hover states
|
||||
- Use saturated colors for clear contrast against neutrals
|
||||
|
||||
**Palette Structure Example:**
|
||||
```
|
||||
Neutrals: slate-50, slate-100, slate-300, slate-700, slate-900
|
||||
Accents: teal-500 (primary), amber-500 (warning), red-500 (error)
|
||||
```
|
||||
|
||||
**Color Application Rules:**
|
||||
|
||||
- **Backgrounds**: Lightest neutral (slate-50 or white)
|
||||
- **Text**: Darkest neutral for primary text (slate-900), mid-tone for secondary (slate-600)
|
||||
- **Buttons (primary)**: Accent color with white text
|
||||
- **Buttons (secondary)**: Neutral with border and dark text
|
||||
- **Status indicators**: Specific accent (green=success, red=error, amber=warning, blue=info)
|
||||
- **Interactive states**:
|
||||
- Hover: Darken by 10-15% or shift hue slightly
|
||||
- Focus: Use ring/outline in accent color
|
||||
- Disabled: Reduce opacity to 40-50% and remove hover effects
|
||||
|
||||
**Color Relationships:**
|
||||
|
||||
Choose warm or cool intentionally based on brand:
|
||||
- **Warm greys** (beige/brown undertones): Organic, approachable, trustworthy
|
||||
- **Cool greys** (blue undertones): Modern, tech-forward, professional
|
||||
|
||||
Accent colors should have clear contrast with both:
|
||||
- Light backgrounds (for buttons on white)
|
||||
- Dark text (if used as backgrounds for white text)
|
||||
|
||||
**Intentional Color Usage:**
|
||||
- Every color must serve a purpose (hierarchy, function, status, or action)
|
||||
- Avoid decorative colors that don't communicate meaning
|
||||
- Maintain consistency: same color = same meaning throughout
|
||||
|
||||
**Accessibility:**
|
||||
- Ensure sufficient contrast for color-blind users
|
||||
- Follow WCAG 2.1 AA: minimum 4.5:1 for normal text, 3:1 for large text
|
||||
- Don't rely on color alone to convey information (add icons or labels)
|
||||
|
||||
**Unique Color Strategy:**
|
||||
|
||||
To stand out from generic patterns:
|
||||
- NEVER use default SaaS blue (#3B82F6) or purple gradients on white
|
||||
- Use unexpected neutrals: warm greys, soft off-whites, deep charcoals, rich blacks
|
||||
- Pair neutrals with distinctive accents: terracotta + charcoal, sage + navy, coral + slate
|
||||
- Dominant colors with SHARP accents outperform timid, evenly-distributed palettes
|
||||
- Test combinations against "does this look AI-generated?" filter
|
||||
- Vary between light and dark themes - no design should look the same
|
||||
|
||||
**Create Atmosphere with Color:**
|
||||
- Gradient meshes for depth and visual interest
|
||||
- Noise textures and grain overlays for tactile feel
|
||||
- Layered transparencies for dimension
|
||||
- Dramatic shadows for emphasis and drama
|
||||
|
||||
### Typography Excellence
|
||||
|
||||
**Typography Philosophy:**
|
||||
|
||||
Typography is a primary design element that conveys personality and hierarchy.
|
||||
|
||||
**Functional vs Emotional Typography:**
|
||||
- **Headlines/Display**: Prioritize emotion, personality, attention (legibility secondary)
|
||||
- **Body Text**: Prioritize legibility, reading comfort, accessibility
|
||||
- **UI/Labels**: Prioritize clarity, scannability, consistency
|
||||
|
||||
**Font Selection:**
|
||||
- Use 2-3 typefaces maximum, but make them UNEXPECTED and characterful
|
||||
- Limit to 3 weights per typeface (e.g., Regular 400, Medium 500, Bold 700)
|
||||
- Prefer variable fonts for fine-tuned control and performance
|
||||
|
||||
**NEVER Use These Fonts as Primary:**
|
||||
- Inter (overused by AI and generic SaaS)
|
||||
- Roboto (too generic)
|
||||
- Arial/Helvetica (default fallback vibes)
|
||||
- Space Grotesk (AI generation favorite)
|
||||
- System fonts as primary choice (only as fallback)
|
||||
|
||||
**Font Version Usage:**
|
||||
- **Display version**: Headlines and hero text only - BE BOLD
|
||||
- **Text version**: Paragraphs and long-form content - legibility matters
|
||||
- **Caption/Micro**: Small UI labels (1-2 lines, non-critical info)
|
||||
|
||||
**Find Distinctive Fonts:**
|
||||
- Google Fonts for web - but dig deeper than page 1
|
||||
- Type foundries for unique options
|
||||
- Choose fonts that serve your CHOSEN AESTHETIC DIRECTION
|
||||
- Pair distinctive display font with refined body font
|
||||
|
||||
**Typographic Scale:**
|
||||
|
||||
Use mathematical relationships for size hierarchy:
|
||||
- **Ratio**: Major third (1.25x) for moderate contrast, Perfect fourth (1.333x) for dramatic
|
||||
- **Base size**: 16px (1rem) for body text
|
||||
- **Example scale (1.25x)**:
|
||||
```
|
||||
xs: 0.64rem (10px)
|
||||
sm: 0.8rem (13px)
|
||||
base: 1rem (16px)
|
||||
lg: 1.25rem (20px)
|
||||
xl: 1.563rem (25px)
|
||||
2xl: 1.953rem (31px)
|
||||
3xl: 2.441rem (39px)
|
||||
4xl: 3.052rem (49px)
|
||||
5xl: 3.815rem (61px)
|
||||
```
|
||||
|
||||
**Typographic Hierarchy:**
|
||||
- Create clear visual distinction between levels
|
||||
- Headlines, subheadings, body, captions should each have distinct size/weight
|
||||
- Use combination of size, weight, and color for hierarchy
|
||||
|
||||
**Spacing & Readability:**
|
||||
- **Line height**: 1.5x font size for body text (e.g., 16px text = 24px line-height)
|
||||
- **Line length**: 45-75 characters optimal for readability (60-70 ideal)
|
||||
- **Paragraph spacing**: 1-1.5em between paragraphs
|
||||
- **Letter spacing (tracking)**:
|
||||
- Larger text (headlines): Slightly tighter (-0.02em to -0.05em)
|
||||
- Normal text (body): Default (0)
|
||||
- Small text (captions): Slightly looser (+0.01em to +0.03em)
|
||||
- General rule: As size increases, reduce tracking; as size decreases, increase tracking
|
||||
|
||||
**Font Pairing Logic:**
|
||||
|
||||
When using multiple typefaces, create contrast through:
|
||||
- **Category contrast**: Serif + Sans-serif (classic, clear distinction)
|
||||
- **Weight contrast**: Light + Bold (dynamic, energetic)
|
||||
- **Personality contrast**: Geometric + Humanist (modern + warm)
|
||||
|
||||
Examples:
|
||||
- Serif headlines + Sans body (editorial, trustworthy)
|
||||
- Display headlines + System body (distinctive + efficient)
|
||||
- Bold sans headlines + Light sans body (modern, clean)
|
||||
|
||||
**UI Typography:**
|
||||
|
||||
Specific guidance for interface elements:
|
||||
- **Button text**: Semi-Bold (600), 14-16px, consistent casing (all-caps OR title case)
|
||||
- **Form labels**: Regular (400), 14px, positioned above input
|
||||
- **Form input text**: Regular (400), 16px minimum (prevents iOS zoom on focus)
|
||||
- **Placeholder text**: Light (300) or desaturated color, same size as input
|
||||
- **Error messages**: Regular (400), 12-14px, color-coded (red-ish)
|
||||
|
||||
**Responsive Typography:**
|
||||
|
||||
Scale type sizes across breakpoints:
|
||||
```tsx
|
||||
// Example with Tailwind
|
||||
<h1 className="text-3xl md:text-4xl lg:text-5xl">
|
||||
Responsive Headline
|
||||
</h1>
|
||||
|
||||
// Or with CSS clamp (fluid)
|
||||
h1 {
|
||||
font-size: clamp(2rem, 5vw, 4rem);
|
||||
}
|
||||
```
|
||||
|
||||
Reduce sizes on mobile (20-30% smaller than desktop)
|
||||
Reduce hierarchy levels on small screens (fewer distinct sizes)
|
||||
|
||||
### Layout & Spatial Design
|
||||
|
||||
**Compositional Balance:**
|
||||
- Every screen should feel balanced
|
||||
- Pay attention to visual weight and negative space
|
||||
- Use generous negative space to focus attention
|
||||
- Add sufficient margins and paddings for professional, spacious look
|
||||
|
||||
**Grid Discipline:**
|
||||
- Maintain consistent underlying grid system
|
||||
- Create sense of order while allowing meaningful exceptions
|
||||
- Use grid/flex wrappers with `gap` for spacing
|
||||
- Prioritize wrappers over direct margins/padding on children
|
||||
|
||||
**Spatial Relationships:**
|
||||
- Group related elements through proximity, alignment, and shared attributes
|
||||
- Use size, color, and spacing to highlight important elements
|
||||
- Guide user focus through visual hierarchy
|
||||
|
||||
**Attention Guidance:**
|
||||
- Design interfaces that guide user attention effectively
|
||||
- Avoid cluttered interfaces where elements compete
|
||||
- Create clear paths through the content
|
||||
|
||||
## Interaction Design
|
||||
|
||||
|
||||
**Motion Specification:**
|
||||
|
||||
For detailed motion specs, see MOTION-SPEC.md (easing curves, duration tables, state-specific animations, implementation patterns).
|
||||
|
||||
### User Experience Patterns
|
||||
|
||||
**Core UX Principles:**
|
||||
|
||||
1. **Direct Manipulation**
|
||||
- Users interact directly with content, not through abstract controls
|
||||
- Examples:
|
||||
- Drag & drop to reorder items (not up/down buttons)
|
||||
- Inline editing (click to edit, not separate form)
|
||||
- Sliders for ranges (not numeric input with +/-)
|
||||
- Pinch/zoom gestures on mobile (not +/- buttons)
|
||||
|
||||
2. **Immediate Feedback**
|
||||
- Every interaction provides instantaneous visual feedback (within 100ms)
|
||||
- Types of feedback:
|
||||
- **Visual**: Button pressed state, hover effects, color changes
|
||||
- **Haptic**: Vibration on mobile (submit, error, success)
|
||||
- **Audio**: Subtle sounds for critical actions (optional, user-controlled)
|
||||
- **Loading**: Skeleton screens, spinners for >300ms operations
|
||||
- **Success**: Checkmarks, green highlights, toast notifications
|
||||
- **Error**: Red highlights, inline error messages, shake animations
|
||||
|
||||
3. **Consistent Behavior**
|
||||
- Similar-looking elements behave similarly
|
||||
- Examples:
|
||||
- **Visual consistency**: All primary buttons have same colors, sizes, hover states
|
||||
- **Behavioral consistency**: All modals close via X button, ESC key, and outside click
|
||||
- **Interaction consistency**: All drag targets have same hover state and drop feedback
|
||||
- **Pattern consistency**: All forms validate on blur and submit
|
||||
|
||||
4. **Forgiveness**
|
||||
- Make errors difficult, but recovery easy
|
||||
- **Prevention strategies**:
|
||||
- Disable invalid actions (grey out unavailable buttons)
|
||||
- Validate inputs inline (before submission)
|
||||
- Confirm destructive actions (delete, overwrite)
|
||||
- Auto-save in background (drafts, progress)
|
||||
- **Recovery strategies**:
|
||||
- Undo/redo for all state changes
|
||||
- Soft deletes (trash/archive before permanent delete)
|
||||
- Clear error messages with actionable fixes
|
||||
- Preserve user input on errors (don't clear forms)
|
||||
|
||||
5. **Progressive Disclosure**
|
||||
- Reveal details as needed rather than overwhelming users
|
||||
- Levels of disclosure:
|
||||
- **Summary**: Show essential info by default (card title, price, rating)
|
||||
- **Details**: Expand to show more info (description, specs, reviews)
|
||||
- **Advanced**: Hide complex options behind "Advanced settings" toggle
|
||||
- Examples:
|
||||
- Accordion: Start collapsed, expand on click
|
||||
- Search filters: Show 3-5 common filters, hide rest behind "More filters"
|
||||
- Settings: Basic settings visible, advanced behind "Show advanced"
|
||||
|
||||
**Modern UX Patterns:**
|
||||
|
||||
1. **Conversational Interfaces**
|
||||
|
||||
Prioritize natural language interaction where appropriate:
|
||||
|
||||
**Four types:**
|
||||
- **Pure chat**: Full conversation (AI assistants, support bots)
|
||||
- **Command palette**: Text-based shortcuts (Cmd+K, search everywhere)
|
||||
- **Smart search**: Natural language queries (search "meetings next week" vs filtering)
|
||||
- **Form alternatives**: Conversational data collection ("What's your name?" vs form fields)
|
||||
|
||||
**When to use:**
|
||||
- Complex searches with multiple variables
|
||||
- Task guidance (wizards, onboarding)
|
||||
- Contextual help
|
||||
- Quick actions (command palette)
|
||||
|
||||
**When NOT to use:**
|
||||
- Simple forms (just use inputs)
|
||||
- Precise control interfaces (design tools, dashboards)
|
||||
- High-frequency repetitive tasks
|
||||
|
||||
2. **Adaptive Layouts**
|
||||
|
||||
Respond to user context automatically:
|
||||
- **Time-based**: Dark mode at night, light during day
|
||||
- **Device-based**: Simplified UI on mobile, full features on desktop
|
||||
- **Connection-based**: Reduce images/video on slow connections
|
||||
- **Usage-based**: Prioritize frequent actions, hide rarely-used features
|
||||
|
||||
Examples:
|
||||
- Auto dark/light mode based on time or system preference
|
||||
- Simplified mobile navigation (hamburger menu) vs full desktop nav
|
||||
- Collapsed sidebar on small screens, expanded on large
|
||||
|
||||
3. **Bold Visual Expression**
|
||||
|
||||
Aesthetic flexibility based on chosen direction:
|
||||
- Shadows ALLOWED and encouraged when intentional (dramatic shadows, soft elevation)
|
||||
- Gradients ALLOWED for depth, accents, backgrounds, and atmosphere
|
||||
- NO glass morphism effects (this is the one banned technique)
|
||||
- NO Apple design mimicry (find your own voice)
|
||||
- Focus on typography, color, spacing, AND visual effects to create hierarchy
|
||||
- Create atmosphere: gradient meshes, noise textures, grain overlays, dramatic lighting
|
||||
|
||||
**Navigation:**
|
||||
- Clear structure with intuitive navigation menus
|
||||
- Implement breadcrumbs for deep hierarchies (more than 2 levels)
|
||||
- Use standard UI patterns to reduce learning curve (hamburger menu, tab bars)
|
||||
- Ensure predictable behavior (back button works, links look clickable)
|
||||
- Maintain navigation context (highlight current page, preserve scroll position)
|
||||
|
||||
## Styling Implementation
|
||||
|
||||
### Component Library & Tools
|
||||
|
||||
**Component Library:**
|
||||
- Strongly prefer shadcn components (v4, pre-installed in `@/components/ui`)
|
||||
- Import individually: `import { Button } from "@/components/ui/button";`
|
||||
- Use over plain HTML elements (`<Button>` over `<button>`)
|
||||
- Avoid creating custom components with names that clash with shadcn
|
||||
|
||||
**Styling Engine:**
|
||||
- Use Tailwind utility classes exclusively
|
||||
- Adhere to theme variables in `index.css` via CSS custom properties
|
||||
- Map variables in `@theme` (see `tailwind.config.js`)
|
||||
- Use inline styles or CSS modules only when absolutely necessary
|
||||
|
||||
**Icons:**
|
||||
- Use `@phosphor-icons/react` for buttons and inputs
|
||||
- Example: `import { Plus } from "@phosphor-icons/react"; <Plus />`
|
||||
- Use color for plain icon buttons
|
||||
- Don't override default `size` or `weight` unless requested
|
||||
|
||||
**Notifications:**
|
||||
- Use `sonner` for toasts
|
||||
- Example: `import { toast } from 'sonner'`
|
||||
|
||||
**Loading States:**
|
||||
- Always add loading states, spinners, placeholder animations
|
||||
- Use skeletons until content renders
|
||||
|
||||
### Layout Implementation
|
||||
|
||||
**Spacing Strategy:**
|
||||
- Use grid/flex wrappers with `gap` for spacing
|
||||
- Prioritize wrappers over direct margins/padding on children
|
||||
- Nest wrappers as needed for complex layouts
|
||||
|
||||
**Conditional Styling:**
|
||||
- Use ternary operators or clsx/classnames utilities
|
||||
- Example: `className={clsx('base-class', { 'active-class': isActive })}`
|
||||
|
||||
### Responsive Design
|
||||
|
||||
**Fluid Layouts:**
|
||||
- Use relative units (%, em, rem) instead of fixed pixels
|
||||
- Implement CSS Grid and Flexbox for flexible layouts
|
||||
- Design mobile-first, then scale up
|
||||
|
||||
**Media Queries:**
|
||||
- Use breakpoints based on content needs, not specific devices
|
||||
- Test across range of devices and orientations
|
||||
|
||||
**Touch Targets:**
|
||||
- Minimum 44x44 pixels for interactive elements
|
||||
- Provide adequate spacing between touch targets
|
||||
- Consider hover states for desktop, focus states for touch/keyboard
|
||||
|
||||
**Performance:**
|
||||
- Optimize assets for mobile networks
|
||||
- Use CSS animations over JavaScript
|
||||
- Implement lazy loading for images and videos
|
||||
|
||||
## Accessibility Standards
|
||||
|
||||
**Core Requirements:**
|
||||
- Follow WCAG 2.1 AA guidelines
|
||||
- Ensure keyboard navigability for all interactive elements
|
||||
- Minimum touch target size: 44×44px
|
||||
- Use semantic HTML for screen reader compatibility
|
||||
- Provide alternative text for images and non-text content
|
||||
|
||||
**Implementation Details:**
|
||||
- Use descriptive variable and function names
|
||||
- Event functions: prefix with "handle" (handleClick, handleKeyDown)
|
||||
- Add accessibility attributes:
|
||||
- `tabindex="0"` for custom interactive elements
|
||||
- `aria-label` for buttons without text
|
||||
- `role` attributes when semantic HTML isn't sufficient
|
||||
- Ensure logical tab order
|
||||
- Provide visible focus states
|
||||
|
||||
## Design Process & Testing
|
||||
|
||||
### Design Workflow
|
||||
|
||||
1. **Understand Context:**
|
||||
- What problem are we solving?
|
||||
- Who are the users and when will they use this?
|
||||
- What are the success criteria?
|
||||
|
||||
2. **Explore Options:**
|
||||
- Present 2-3 alternative approaches
|
||||
- Explain trade-offs of each option
|
||||
- Ask which direction resonates
|
||||
|
||||
3. **Implement Iteratively:**
|
||||
- Start with structure and hierarchy
|
||||
- Add visual polish progressively
|
||||
- Test at each stage
|
||||
|
||||
4. **Validate:**
|
||||
- Use playwright MCP to test visual changes
|
||||
- Check across different screen sizes
|
||||
- Verify accessibility
|
||||
|
||||
### Testing Checklist
|
||||
|
||||
**Visual Testing:**
|
||||
- Use playwright MCP when available for automated testing
|
||||
- Check responsive behavior at common breakpoints
|
||||
- Verify touch targets on mobile
|
||||
- Test with different content lengths (short, long, edge cases)
|
||||
|
||||
**Accessibility Testing:**
|
||||
- Test keyboard navigation
|
||||
- Verify screen reader compatibility
|
||||
- Check color contrast ratios
|
||||
- Ensure focus states are visible
|
||||
|
||||
**Cross-Device Testing:**
|
||||
- Test on actual devices, not just emulators
|
||||
- Check different browsers (Chrome, Firefox, Safari)
|
||||
- Verify touch interactions on mobile
|
||||
- Test landscape and portrait orientations
|
||||
|
||||
## Examples
|
||||
|
||||
### Example 1: Designing a Button
|
||||
|
||||
**Initial Question to Ask:**
|
||||
```
|
||||
Before I implement this button, I have a few design questions:
|
||||
1. What's the primary action you want to emphasize?
|
||||
2. Do you have brand colors in mind, or should I suggest options?
|
||||
3. What emotion should this button convey? (urgent, calm, playful, professional)
|
||||
```
|
||||
|
||||
**After Getting Approval, Implementation:**
|
||||
```tsx
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { ArrowRight } from "@phosphor-icons/react";
|
||||
|
||||
<Button
|
||||
className="bg-slate-800 hover:bg-slate-700 text-white px-6 py-3 rounded-lg transition-colors duration-200"
|
||||
>
|
||||
Get Started
|
||||
<ArrowRight className="ml-2" />
|
||||
</Button>
|
||||
```
|
||||
|
||||
### Example 2: Typography Hierarchy
|
||||
|
||||
**Question First:**
|
||||
```
|
||||
For this content hierarchy, I'm thinking:
|
||||
- Headline: Large, bold, attention-grabbing
|
||||
- Subheading: Medium, regular weight
|
||||
- Body: Smaller, optimized for reading
|
||||
|
||||
Should we go bold and contemporary, or subtle and refined?
|
||||
```
|
||||
|
||||
**Implementation After Approval:**
|
||||
```tsx
|
||||
<div className="space-y-4">
|
||||
<h1 className="text-5xl font-bold tracking-tight text-slate-900">
|
||||
Headline Here
|
||||
</h1>
|
||||
<h2 className="text-2xl text-slate-600">
|
||||
Supporting subheading
|
||||
</h2>
|
||||
<p className="text-base leading-relaxed text-slate-700">
|
||||
Body text optimized for readability with proper line height.
|
||||
</p>
|
||||
</div>
|
||||
```
|
||||
|
||||
### Example 3: Unique Color Palette Suggestion
|
||||
|
||||
**Presenting Options:**
|
||||
```
|
||||
I'd like to suggest three color directions that break from typical SaaS patterns:
|
||||
|
||||
1. **Warm Earth Tones**
|
||||
- Base: Warm grey (#E8E2DC)
|
||||
- Accent: Terracotta (#C86E4B)
|
||||
- For: Organic, trustworthy feel
|
||||
|
||||
2. **Cool Midnight**
|
||||
- Base: Deep navy (#1A2332)
|
||||
- Accent: Cyan (#4ECDC4)
|
||||
- For: Modern, tech-forward feel
|
||||
|
||||
3. **Soft Pastels**
|
||||
- Base: Soft pink (#FFE5E5)
|
||||
- Accent: Sage green (#9DB5A4)
|
||||
- For: Calm, approachable feel
|
||||
|
||||
Which direction feels right for your brand?
|
||||
```
|
||||
|
||||
## Common Patterns to Avoid
|
||||
|
||||
❌ **NEVER:**
|
||||
- Use Inter, Roboto, Arial, Space Grotesk as primary fonts
|
||||
- Use generic SaaS blue (#3B82F6) or purple gradients on white
|
||||
- Copy Apple's design language or use glass morphism
|
||||
- Create cookie-cutter layouts that look AI-generated
|
||||
- Skip asking about context before designing
|
||||
- Converge on common choices across generations (vary everything!)
|
||||
- Use animations that delay user actions
|
||||
- Create cluttered interfaces where elements compete
|
||||
|
||||
✅ **ALWAYS:**
|
||||
- Ask about purpose, tone, constraints, differentiation FIRST
|
||||
- Then commit BOLDLY to a distinctive aesthetic direction
|
||||
- Use unexpected, characterful typography choices
|
||||
- Create atmosphere: shadows, gradients, textures, grain (when intentional)
|
||||
- Dominant colors with sharp accents (not timid, evenly-distributed palettes)
|
||||
- Provide immediate feedback for interactions
|
||||
- Test with real devices
|
||||
- Validate accessibility (it enables creativity, not limits it)
|
||||
- Remember: Claude is capable of extraordinary creative work - don't hold back!
|
||||
|
||||
## Version History
|
||||
|
||||
- v2.0.0 (2025-11-22): Creative liberation update - bold aesthetics, shadows/gradients allowed, Design Thinking protocol
|
||||
- v1.0.0 (2025-10-18): Initial release with comprehensive UI/UX design guidance
|
||||
|
||||
## References
|
||||
|
||||
For additional context, see:
|
||||
- **Anthropic Frontend Aesthetics Cookbook**: https://github.com/anthropics/claude-cookbooks/blob/main/coding/prompting_for_frontend_aesthetics.ipynb
|
||||
- WCAG 2.1 Guidelines: https://www.w3.org/WAI/WCAG21/quickref/
|
||||
- Google Fonts: https://fonts.google.com/
|
||||
- Tailwind CSS Docs: https://tailwindcss.com/docs
|
||||
- Shadcn UI Components: https://ui.shadcn.com/
|
||||
|
||||
**Progressive Disclosure Files:**
|
||||
- ACCESSIBILITY.md - Accessibility essentials (WCAG AA baseline)
|
||||
- MOTION-SPEC.md - Animation timing and easing
|
||||
- RESPONSIVE-DESIGN.md - Mobile-first breakpoints and patterns
|
||||
@@ -1,223 +0,0 @@
|
||||
---
|
||||
name: interactive-portfolio
|
||||
description: "Expert in building portfolios that actually land jobs and clients - not just showing work, but creating memorable experiences. Covers developer portfolios, designer portfolios, creative portfolios, and portfolios that convert visitors into opportunities. Use when: portfolio, personal website, showcase work, developer portfolio, designer portfolio."
|
||||
source: vibeship-spawner-skills (Apache 2.0)
|
||||
---
|
||||
|
||||
# Interactive Portfolio
|
||||
|
||||
**Role**: Portfolio Experience Designer
|
||||
|
||||
You know a portfolio isn't a resume - it's a first impression that needs
|
||||
to convert. You balance creativity with usability. You understand that
|
||||
hiring managers spend 30 seconds on each portfolio. You make those 30
|
||||
seconds count. You help people stand out without being gimmicky.
|
||||
|
||||
## Capabilities
|
||||
|
||||
- Portfolio architecture
|
||||
- Project showcase design
|
||||
- Interactive case studies
|
||||
- Personal branding for devs/designers
|
||||
- Contact conversion
|
||||
- Portfolio performance
|
||||
- Work presentation
|
||||
- Testimonial integration
|
||||
|
||||
## Patterns
|
||||
|
||||
### Portfolio Architecture
|
||||
|
||||
Structure that works for portfolios
|
||||
|
||||
**When to use**: When planning portfolio structure
|
||||
|
||||
```javascript
|
||||
## Portfolio Architecture
|
||||
|
||||
### The 30-Second Test
|
||||
In 30 seconds, visitors should know:
|
||||
1. Who you are
|
||||
2. What you do
|
||||
3. Your best work
|
||||
4. How to contact you
|
||||
|
||||
### Essential Sections
|
||||
| Section | Purpose | Priority |
|
||||
|---------|---------|----------|
|
||||
| Hero | Hook + identity | Critical |
|
||||
| Work/Projects | Prove skills | Critical |
|
||||
| About | Personality + story | Important |
|
||||
| Contact | Convert interest | Critical |
|
||||
| Testimonials | Social proof | Nice to have |
|
||||
| Blog/Writing | Thought leadership | Optional |
|
||||
|
||||
### Navigation Patterns
|
||||
```
|
||||
Option 1: Single page scroll
|
||||
- Best for: Designers, creatives
|
||||
- Works well with animations
|
||||
- Mobile friendly
|
||||
|
||||
Option 2: Multi-page
|
||||
- Best for: Lots of projects
|
||||
- Individual case study pages
|
||||
- Better for SEO
|
||||
|
||||
Option 3: Hybrid
|
||||
- Main sections on one page
|
||||
- Detailed case studies separate
|
||||
- Best of both worlds
|
||||
```
|
||||
|
||||
### Hero Section Formula
|
||||
```
|
||||
[Your name]
|
||||
[What you do in one line]
|
||||
[One line that differentiates you]
|
||||
[CTA: View Work / Contact]
|
||||
```
|
||||
```
|
||||
|
||||
### Project Showcase
|
||||
|
||||
How to present work effectively
|
||||
|
||||
**When to use**: When building project sections
|
||||
|
||||
```javascript
|
||||
## Project Showcase
|
||||
|
||||
### Project Card Elements
|
||||
| Element | Purpose |
|
||||
|---------|---------|
|
||||
| Thumbnail | Visual hook |
|
||||
| Title | What it is |
|
||||
| One-liner | What you did |
|
||||
| Tech/tags | Quick scan |
|
||||
| Results | Proof of impact |
|
||||
|
||||
### Case Study Structure
|
||||
```
|
||||
1. Hero image/video
|
||||
2. Project overview (2-3 sentences)
|
||||
3. The challenge
|
||||
4. Your role
|
||||
5. Process highlights
|
||||
6. Key decisions
|
||||
7. Results/impact
|
||||
8. Learnings (optional)
|
||||
9. Links (live, GitHub, etc.)
|
||||
```
|
||||
|
||||
### Showing Impact
|
||||
| Instead of | Write |
|
||||
|------------|-------|
|
||||
| "Built a website" | "Increased conversions 40%" |
|
||||
| "Designed UI" | "Reduced user drop-off 25%" |
|
||||
| "Developed features" | "Shipped to 50K users" |
|
||||
|
||||
### Visual Presentation
|
||||
- Device mockups for web/mobile
|
||||
- Before/after comparisons
|
||||
- Process artifacts (wireframes, etc.)
|
||||
- Video walkthroughs for complex work
|
||||
- Hover effects for engagement
|
||||
```
|
||||
|
||||
### Developer Portfolio Specifics
|
||||
|
||||
What works for dev portfolios
|
||||
|
||||
**When to use**: When building developer portfolio
|
||||
|
||||
```javascript
|
||||
## Developer Portfolio
|
||||
|
||||
### What Hiring Managers Look For
|
||||
1. Code quality (GitHub link)
|
||||
2. Real projects (not just tutorials)
|
||||
3. Problem-solving ability
|
||||
4. Communication skills
|
||||
5. Technical depth
|
||||
|
||||
### Must-Haves
|
||||
- GitHub profile link (cleaned up)
|
||||
- Live project links
|
||||
- Tech stack for each project
|
||||
- Your specific contribution (for team projects)
|
||||
|
||||
### Project Selection
|
||||
| Include | Avoid |
|
||||
|---------|-------|
|
||||
| Real problems solved | Tutorial clones |
|
||||
| Side projects with users | Incomplete projects |
|
||||
| Open source contributions | "Coming soon" |
|
||||
| Technical challenges | Basic CRUD apps |
|
||||
|
||||
### Technical Showcase
|
||||
```javascript
|
||||
// Show code snippets that demonstrate:
|
||||
- Clean architecture decisions
|
||||
- Performance optimizations
|
||||
- Clever solutions
|
||||
- Testing approach
|
||||
```
|
||||
|
||||
### Blog/Writing
|
||||
- Technical deep dives
|
||||
- Problem-solving stories
|
||||
- Learning journeys
|
||||
- Shows communication skills
|
||||
```
|
||||
|
||||
## Anti-Patterns
|
||||
|
||||
### ❌ Template Portfolio
|
||||
|
||||
**Why bad**: Looks like everyone else.
|
||||
No memorable impression.
|
||||
Doesn't show creativity.
|
||||
Easy to forget.
|
||||
|
||||
**Instead**: Add personal touches.
|
||||
Custom design elements.
|
||||
Unique project presentations.
|
||||
Your voice in the copy.
|
||||
|
||||
### ❌ All Style No Substance
|
||||
|
||||
**Why bad**: Fancy animations, weak projects.
|
||||
Style over substance.
|
||||
Hiring managers see through it.
|
||||
No proof of skills.
|
||||
|
||||
**Instead**: Projects first, style second.
|
||||
Real work with real impact.
|
||||
Quality over quantity.
|
||||
Depth over breadth.
|
||||
|
||||
### ❌ Resume Website
|
||||
|
||||
**Why bad**: Boring, forgettable.
|
||||
Doesn't use the medium.
|
||||
No personality.
|
||||
Lists instead of stories.
|
||||
|
||||
**Instead**: Show, don't tell.
|
||||
Visual case studies.
|
||||
Interactive elements.
|
||||
Personality throughout.
|
||||
|
||||
## ⚠️ Sharp Edges
|
||||
|
||||
| Issue | Severity | Solution |
|
||||
|-------|----------|----------|
|
||||
| Portfolio more complex than your actual work | medium | ## Right-Sizing Your Portfolio |
|
||||
| Portfolio looks great on desktop, broken on mobile | high | ## Mobile-First Portfolio |
|
||||
| Visitors don't know what to do next | medium | ## Portfolio CTAs |
|
||||
| Portfolio shows old or irrelevant work | medium | ## Portfolio Freshness |
|
||||
|
||||
## Related Skills
|
||||
|
||||
Works well with: `scroll-experience`, `3d-web-experience`, `landing-page-design`, `personal-branding`
|
||||
@@ -1,34 +0,0 @@
|
||||
{
|
||||
"permissions": {
|
||||
"allow": [
|
||||
"Bash(powershell -Command \"$lines = Get-Content ''4-vitals-monitor.html''; $before = $lines[0..1757]; $after = $lines[2028..\\($lines.Length-1\\)]; \\($before + $after\\) | Set-Content ''4-vitals-monitor.html'' -Encoding UTF8\")",
|
||||
"Bash(powershell -Command \"$lines = Get-Content ''4-vitals-monitor.html''; $before = $lines[0..1757]; $after = $lines[2028..\\($lines.Length-1\\)]; $result = $before + $after; $result | Set-Content ''4-vitals-monitor.html'' -Encoding UTF8\")",
|
||||
"Bash(powershell -ExecutionPolicy Bypass -File:*)",
|
||||
"Bash(del \"C:\\\\Users\\\\Andy\\\\Ralph Local\\\\Tasks\\\\cv-4-vitals-monitor\\\\remove-lines.ps1\")",
|
||||
"Bash(start \"\" \"C:\\\\Users\\\\Andy\\\\Ralph Local\\\\Tasks\\\\cv-4-vitals-monitor\\\\4-vitals-monitor.html\")",
|
||||
"Bash(npx skills find:*)",
|
||||
"WebSearch",
|
||||
"Bash(ls \"C:\\\\Users\\\\Andy\\\\Ralph Local\\\\Tasks\\\\New CV website\\\\designs\"\" 2>nul || echo \"Directory does not exist \")",
|
||||
"Bash(npm run typecheck:*)",
|
||||
"Bash(npm run dev:*)",
|
||||
"Bash(npm run build:*)",
|
||||
"Bash(dir:*)",
|
||||
"mcp__playwright__browser_snapshot",
|
||||
"mcp__playwright__browser_navigate",
|
||||
"mcp__playwright__browser_take_screenshot",
|
||||
"Bash(npm run lint:*)",
|
||||
"Bash(curl:*)",
|
||||
"mcp__playwright__browser_click",
|
||||
"mcp__playwright__browser_wait_for",
|
||||
"mcp__playwright__browser_evaluate",
|
||||
"Bash(git add:*)",
|
||||
"Bash(git commit -m \"$\\(cat <<''EOF''\nTask 4: Rebuild PatientBanner with premium fonts, tooltip, and animations\n\n- Replace font-inter with font-ui \\(Elvaro Grotesque\\) throughout banner\n- Add custom NHSNumberWithTooltip with Framer Motion animated reveal\n- Add AnimatePresence crossfade between full/condensed banner states\n- Animate mobile overflow menu enter/exit\n- Add SkipButton to App.tsx for boot/ECG phase skip\n- Add shadow-pmr-banner, focus ring styles, prefers-reduced-motion support\n- Fix mobile banner to use patient data instead of hardcoded values\n\nCo-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>\nEOF\n\\)\")",
|
||||
"Bash(git commit:*)",
|
||||
"Bash(ls:*)",
|
||||
"Bash(tasklist:*)",
|
||||
"Bash(npx -y serve -l 3333 .)",
|
||||
"Bash(npx serve:*)",
|
||||
"Bash(timeout /t 3 /nobreak)"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -1,111 +0,0 @@
|
||||
# Accessibility Essentials
|
||||
|
||||
Accessibility enables creativity - it's a foundation, not a limitation. WCAG 2.1 AA compliance.
|
||||
|
||||
## Core Principles (POUR)
|
||||
|
||||
- **Perceivable**: Content must be perceivable (alt text, contrast, captions)
|
||||
- **Operable**: UI must be keyboard/touch accessible
|
||||
- **Understandable**: Clear, predictable behavior
|
||||
- **Robust**: Works with assistive technologies
|
||||
|
||||
## Contrast Requirements
|
||||
|
||||
| Element | Minimum Ratio |
|
||||
|---------|---------------|
|
||||
| Normal text | 4.5:1 |
|
||||
| Large text (18pt+) | 3:1 |
|
||||
| UI components | 3:1 |
|
||||
|
||||
**Tools**: Chrome DevTools Accessibility tab, WebAIM Contrast Checker
|
||||
|
||||
## Keyboard Navigation
|
||||
|
||||
```tsx
|
||||
// All interactive elements need focus states
|
||||
<button className="focus:ring-4 focus:ring-blue-500 focus:outline-none">
|
||||
Accessible
|
||||
</button>
|
||||
|
||||
// Custom elements need tabindex and key handlers
|
||||
<div
|
||||
role="button"
|
||||
tabIndex={0}
|
||||
onKeyDown={(e) => (e.key === 'Enter' || e.key === ' ') && handleClick()}
|
||||
>
|
||||
Custom Button
|
||||
</div>
|
||||
```
|
||||
|
||||
**Essentials:**
|
||||
- Tab through entire interface
|
||||
- Enter/Space activates elements
|
||||
- Escape closes modals
|
||||
- Visible focus indicators always
|
||||
|
||||
## Essential ARIA
|
||||
|
||||
```tsx
|
||||
// Buttons without text
|
||||
<button aria-label="Close dialog"><X /></button>
|
||||
|
||||
// Expandable elements
|
||||
<button aria-expanded={isOpen} aria-controls="menu">Menu</button>
|
||||
|
||||
// Live regions for dynamic content
|
||||
<div role="status" aria-live="polite">{statusMessage}</div>
|
||||
<div role="alert" aria-live="assertive">{errorMessage}</div>
|
||||
|
||||
// Form errors
|
||||
<input aria-invalid={hasError} aria-describedby="error-msg" />
|
||||
{hasError && <p id="error-msg" role="alert">Error text</p>}
|
||||
```
|
||||
|
||||
## Semantic HTML
|
||||
|
||||
```tsx
|
||||
// Use semantic elements, not divs
|
||||
<header><nav>...</nav></header>
|
||||
<main><article><h1>...</h1></article></main>
|
||||
<footer>...</footer>
|
||||
|
||||
// Heading hierarchy (never skip levels)
|
||||
<h1>Page Title</h1>
|
||||
<h2>Section</h2>
|
||||
<h3>Subsection</h3>
|
||||
```
|
||||
|
||||
## Touch Targets
|
||||
|
||||
- Minimum **44x44px** for all interactive elements
|
||||
- Adequate spacing between targets
|
||||
- `touch-manipulation` CSS for responsive touch
|
||||
|
||||
## Screen Reader Content
|
||||
|
||||
```tsx
|
||||
// Hidden but announced
|
||||
<span className="sr-only">Additional context</span>
|
||||
|
||||
// Skip link
|
||||
<a href="#main" className="sr-only focus:not-sr-only">
|
||||
Skip to main content
|
||||
</a>
|
||||
```
|
||||
|
||||
## Quick Checklist
|
||||
|
||||
- [ ] Keyboard: Can tab through everything
|
||||
- [ ] Focus: Visible focus indicators
|
||||
- [ ] Contrast: 4.5:1 for text
|
||||
- [ ] Alt text: All images have appropriate alt
|
||||
- [ ] Headings: Logical h1-h6 hierarchy
|
||||
- [ ] Forms: Labels associated with inputs
|
||||
- [ ] Errors: Announced to screen readers
|
||||
- [ ] Touch: 44px minimum targets
|
||||
|
||||
## Resources
|
||||
|
||||
- [WCAG 2.1 Quick Reference](https://www.w3.org/WAI/WCAG21/quickref/)
|
||||
- [WebAIM Contrast Checker](https://webaim.org/resources/contrastchecker/)
|
||||
- [ARIA Authoring Practices](https://www.w3.org/WAI/ARIA/apg/)
|
||||
@@ -1,577 +0,0 @@
|
||||
# Design System Template
|
||||
|
||||
Meta-framework for understanding what's fixed, project-specific, and adaptable in your design system.
|
||||
|
||||
## Purpose
|
||||
|
||||
This template helps you distinguish between:
|
||||
- **Fixed Elements**: Universal rules that never change
|
||||
- **Project-Specific Elements**: Filled in for each project based on brand
|
||||
- **Adaptable Elements**: Context-dependent implementations
|
||||
|
||||
---
|
||||
|
||||
## I. FIXED ELEMENTS
|
||||
|
||||
These foundations remain consistent across all projects, regardless of brand or context.
|
||||
|
||||
### 1. Spacing Scale
|
||||
|
||||
**Fixed System:**
|
||||
```
|
||||
4px, 8px, 12px, 16px, 24px, 32px, 48px, 64px, 96px
|
||||
```
|
||||
|
||||
**Usage:**
|
||||
- Margins, padding, gaps between elements
|
||||
- Mathematical relationships ensure visual harmony
|
||||
- Use multipliers of base unit (4px)
|
||||
|
||||
**Why Fixed:**
|
||||
Consistent spacing creates visual rhythm regardless of brand personality.
|
||||
|
||||
### 2. Grid System
|
||||
|
||||
**Fixed Structure:**
|
||||
- **12-column grid** for most layouts (divisible by 2, 3, 4, 6)
|
||||
- **16-column grid** for data-heavy interfaces
|
||||
- **Gutters**: 16px (mobile), 24px (tablet), 32px (desktop)
|
||||
|
||||
**Why Fixed:**
|
||||
Grid provides structural order. Brand personality shows through color, typography, content—not grid structure.
|
||||
|
||||
### 3. Accessibility Standards
|
||||
|
||||
**Fixed Requirements:**
|
||||
- **WCAG 2.1 AA** compliance minimum
|
||||
- **Contrast**: 4.5:1 for normal text, 3:1 for large text
|
||||
- **Touch targets**: Minimum 44×44px
|
||||
- **Keyboard navigation**: All interactive elements accessible
|
||||
- **Screen reader**: Semantic HTML, ARIA labels where needed
|
||||
|
||||
**Why Fixed:**
|
||||
Accessibility is not negotiable. It's a baseline requirement for ethical, legal, and usable products.
|
||||
|
||||
### 4. Typography Hierarchy Logic
|
||||
|
||||
**Fixed Structure:**
|
||||
- **Mathematical scaling**: 1.25x (major third) or 1.333x (perfect fourth)
|
||||
- **Hierarchy levels**: Display → H1 → H2 → H3 → Body → Small → Caption
|
||||
- **Line height**: 1.5x for body text, 1.2-1.3x for headlines
|
||||
- **Line length**: 45-75 characters optimal
|
||||
|
||||
**Why Fixed:**
|
||||
Mathematical relationships create predictable, harmonious hierarchy. Specific fonts change, but the logic doesn't.
|
||||
|
||||
### 5. Component Architecture
|
||||
|
||||
**Fixed Patterns:**
|
||||
- **Button states**: Default, Hover, Active, Focus, Disabled
|
||||
- **Form structure**: Label above input, error below, helper text optional
|
||||
- **Modal pattern**: Overlay + centered content + close mechanism
|
||||
- **Card structure**: Container → Header → Body → Footer (optional)
|
||||
|
||||
**Why Fixed:**
|
||||
Users expect consistent component behavior. Architecture is fixed; appearance is project-specific.
|
||||
|
||||
### 6. Animation Timing Framework
|
||||
|
||||
**Fixed Physics Profiles:**
|
||||
- **Lightweight** (icons, chips): 150ms
|
||||
- **Standard** (cards, panels): 300ms
|
||||
- **Weighty** (modals, pages): 500ms
|
||||
|
||||
**Fixed Easing:**
|
||||
- **Ease-out**: Entrances (fast start, slow end)
|
||||
- **Ease-in**: Exits (slow start, fast end)
|
||||
- **Ease-in-out**: Transitions (smooth both ends)
|
||||
|
||||
**Why Fixed:**
|
||||
Natural physics feel consistent across brands. Duration and easing create that feeling.
|
||||
|
||||
---
|
||||
|
||||
## II. PROJECT-SPECIFIC ELEMENTS
|
||||
|
||||
Fill in these for each project based on brand personality and purpose.
|
||||
|
||||
### 1. Brand Color System
|
||||
|
||||
**Template Structure:**
|
||||
|
||||
```
|
||||
NEUTRALS (4-5 colors):
|
||||
- Background lightest: _______ (e.g., slate-50 or warm-white)
|
||||
- Surface: _______ (e.g., slate-100)
|
||||
- Border/divider: _______ (e.g., slate-300)
|
||||
- Text secondary: _______ (e.g., slate-600)
|
||||
- Text primary: _______ (e.g., slate-900)
|
||||
|
||||
ACCENTS (1-3 colors):
|
||||
- Primary (main CTA): _______ (e.g., teal-500)
|
||||
- Secondary (alternative action): _______ (optional)
|
||||
- Status colors:
|
||||
- Success: _______ (green-ish)
|
||||
- Warning: _______ (amber-ish)
|
||||
- Error: _______ (red-ish)
|
||||
- Info: _______ (blue-ish)
|
||||
```
|
||||
|
||||
**Questions to Answer:**
|
||||
- What emotion should the brand evoke? (Trust, excitement, calm, urgency)
|
||||
- Warm or cool neutrals?
|
||||
- Conservative or bold accents?
|
||||
|
||||
**Examples:**
|
||||
|
||||
**Project A: Fintech App**
|
||||
```
|
||||
Neutrals: Cool greys (slate-50 → slate-900)
|
||||
Primary: Deep blue (#0A2463) – trust, professionalism
|
||||
Success: Muted green (#10B981)
|
||||
Why: Financial products need trust, not playfulness
|
||||
```
|
||||
|
||||
**Project B: Creative Community**
|
||||
```
|
||||
Neutrals: Warm greys with beige undertones
|
||||
Primary: Coral (#FF6B6B) – energy, creativity
|
||||
Success: Teal (#06D6A0) – fresh, unexpected
|
||||
Why: Creative spaces should feel inviting, not corporate
|
||||
```
|
||||
|
||||
**Project C: Healthcare Platform**
|
||||
```
|
||||
Neutrals: Pure greys (minimal color temperature)
|
||||
Primary: Soft blue (#4A90E2) – calm, clinical
|
||||
Success: Medical green (#38A169)
|
||||
Why: Healthcare needs clarity and calm, not distraction
|
||||
```
|
||||
|
||||
### 2. Typography Pairing
|
||||
|
||||
**Template:**
|
||||
|
||||
```
|
||||
HEADLINE FONT: _______
|
||||
- Weight: _______ (e.g., Bold 700)
|
||||
- Use case: H1, H2, display text
|
||||
- Personality: _______ (geometric/humanist/serif/etc.)
|
||||
|
||||
BODY FONT: _______
|
||||
- Weight: _______ (e.g., Regular 400, Medium 500)
|
||||
- Use case: Paragraphs, UI text
|
||||
- Personality: _______ (neutral/readable/efficient)
|
||||
|
||||
OPTIONAL ACCENT FONT: _______
|
||||
- Weight: _______
|
||||
- Use case: _______ (special headlines, callouts)
|
||||
```
|
||||
|
||||
**Pairing Logic:**
|
||||
- Serif + Sans-serif (classic, editorial)
|
||||
- Geometric + Humanist (modern + warm)
|
||||
- Display + System (distinctive + efficient)
|
||||
|
||||
**Examples:**
|
||||
|
||||
**Project A: Editorial Platform**
|
||||
```
|
||||
Headline: Playfair Display (Serif, Bold 700)
|
||||
Body: Inter (Sans-serif, Regular 400)
|
||||
Why: Serif headlines = trustworthy, editorial feel
|
||||
```
|
||||
|
||||
**Project B: Tech Startup**
|
||||
```
|
||||
Headline: DM Sans (Sans-serif, Bold 700)
|
||||
Body: DM Sans (Regular 400, Medium 500)
|
||||
Why: Single-font system = modern, efficient, cohesive
|
||||
```
|
||||
|
||||
**Project C: Luxury Brand**
|
||||
```
|
||||
Headline: Cormorant Garamond (Serif, Light 300)
|
||||
Body: Lato (Sans-serif, Regular 400)
|
||||
Why: Elegant serif + readable sans = sophisticated
|
||||
```
|
||||
|
||||
### 3. Tone of Voice
|
||||
|
||||
**Template:**
|
||||
|
||||
```
|
||||
BRAND PERSONALITY:
|
||||
- Formal ↔ Casual: _______ (1-10 scale)
|
||||
- Professional ↔ Friendly: _______ (1-10 scale)
|
||||
- Serious ↔ Playful: _______ (1-10 scale)
|
||||
- Authoritative ↔ Conversational: _______ (1-10 scale)
|
||||
|
||||
MICROCOPY EXAMPLES:
|
||||
- Button label (submit form): _______
|
||||
- Error message (invalid email): _______
|
||||
- Success message (saved): _______
|
||||
- Empty state: _______
|
||||
|
||||
ANIMATION PERSONALITY:
|
||||
- Speed: _______ (quick/moderate/slow)
|
||||
- Feel: _______ (precise/smooth/bouncy)
|
||||
```
|
||||
|
||||
**Examples:**
|
||||
|
||||
**Project A: Banking App**
|
||||
```
|
||||
Personality: Formal (8), Professional (9), Serious (8)
|
||||
Button: "Submit Application"
|
||||
Error: "Email address format is invalid"
|
||||
Success: "Application submitted successfully"
|
||||
Animation: Quick (precise, efficient, no-nonsense)
|
||||
```
|
||||
|
||||
**Project B: Social App**
|
||||
```
|
||||
Personality: Casual (8), Friendly (9), Playful (7)
|
||||
Button: "Let's go!"
|
||||
Error: "Hmm, that email doesn't look right"
|
||||
Success: "Nice! You're all set 🎉"
|
||||
Animation: Moderate (smooth, friendly bounce)
|
||||
```
|
||||
|
||||
### 4. Animation Speed & Feel
|
||||
|
||||
**Template:**
|
||||
|
||||
```
|
||||
SPEED PREFERENCE:
|
||||
- UI interactions: _______ (100-150ms / 150-200ms / 200-300ms)
|
||||
- State changes: _______ (200ms / 300ms / 400ms)
|
||||
- Page transitions: _______ (300ms / 500ms / 700ms)
|
||||
|
||||
ANIMATION STYLE:
|
||||
- Easing preference: _______ (sharp / standard / bouncy)
|
||||
- Movement type: _______ (minimal / smooth / expressive)
|
||||
```
|
||||
|
||||
**Examples:**
|
||||
|
||||
**Project A: Trading Platform**
|
||||
```
|
||||
Speed: Fast (100ms UI, 200ms states, 300ms pages)
|
||||
Style: Sharp easing, minimal movement
|
||||
Why: Traders need speed, not distraction
|
||||
```
|
||||
|
||||
**Project B: Wellness App**
|
||||
```
|
||||
Speed: Slow (200ms UI, 400ms states, 500ms pages)
|
||||
Style: Smooth easing, gentle movement
|
||||
Why: Calm, relaxing experience matches brand
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## III. ADAPTABLE ELEMENTS
|
||||
|
||||
Context-dependent implementations that vary based on use case.
|
||||
|
||||
### 1. Component Variations
|
||||
|
||||
**Button Variants:**
|
||||
- **Primary**: Full background color (high emphasis)
|
||||
- **Secondary**: Outline only (medium emphasis)
|
||||
- **Tertiary**: Text only (low emphasis)
|
||||
- **Destructive**: Red-ish (danger actions)
|
||||
- **Ghost**: Minimal (navigation, toolbars)
|
||||
|
||||
**Adaptation Rules:**
|
||||
- Primary: Main CTA, one per screen section
|
||||
- Secondary: Alternative actions
|
||||
- Tertiary: Less important actions, multiple allowed
|
||||
- Use brand colors, but hierarchy logic is fixed
|
||||
|
||||
### 2. Responsive Breakpoints
|
||||
|
||||
**Fixed Ranges:**
|
||||
- XS: 0-479px (small phones)
|
||||
- SM: 480-767px (large phones)
|
||||
- MD: 768-1023px (tablets)
|
||||
- LG: 1024-1439px (laptops)
|
||||
- XL: 1440px+ (desktop)
|
||||
|
||||
**Adaptable Implementations:**
|
||||
|
||||
**Simple Content Site:**
|
||||
```
|
||||
XS-SM: Single column
|
||||
MD: 2 columns
|
||||
LG-XL: 3 columns max
|
||||
Why: Content-focused, don't overwhelm
|
||||
```
|
||||
|
||||
**Dashboard/Data App:**
|
||||
```
|
||||
XS: Collapsed, cards stack
|
||||
SM: Simplified sidebar
|
||||
MD: Full sidebar + main content
|
||||
LG-XL: Sidebar + main + right panel
|
||||
Why: Data apps need more screen real estate
|
||||
```
|
||||
|
||||
### 3. Dark Mode Palette
|
||||
|
||||
**Adaptation Strategy:**
|
||||
|
||||
Not a simple inversion. Dark mode needs adjusted contrast:
|
||||
|
||||
**Light Mode:**
|
||||
```
|
||||
Background: #FFFFFF (white)
|
||||
Text: #0F172A (slate-900) → 21:1 contrast
|
||||
```
|
||||
|
||||
**Dark Mode (Adapted):**
|
||||
```
|
||||
Background: #0F172A (slate-900)
|
||||
Text: #E2E8F0 (slate-200) → 15.8:1 contrast (still AA, but softer)
|
||||
```
|
||||
|
||||
**Why Adapt:**
|
||||
Pure white on pure black is too harsh. Dark mode needs slightly lower contrast for eye comfort.
|
||||
|
||||
### 4. Loading States
|
||||
|
||||
**Context-Dependent:**
|
||||
|
||||
**Fast operations (<500ms):**
|
||||
- No loading indicator (feels instant)
|
||||
|
||||
**Medium operations (500ms-2s):**
|
||||
- Spinner or skeleton screen
|
||||
|
||||
**Long operations (>2s):**
|
||||
- Progress bar with percentage
|
||||
- Or: Skeleton + estimated time
|
||||
|
||||
**Interactive Operations:**
|
||||
- Button shows spinner inside (don't disable, show state)
|
||||
|
||||
### 5. Error Handling Strategy
|
||||
|
||||
**Context-Dependent:**
|
||||
|
||||
**Form Errors:**
|
||||
```
|
||||
Validate: On blur (after user leaves field)
|
||||
Display: Inline below field
|
||||
Recovery: Clear error on fix
|
||||
```
|
||||
|
||||
**API Errors:**
|
||||
```
|
||||
Transient (network): Show retry button
|
||||
Permanent (404): Show helpful message + next steps
|
||||
Critical (500): Contact support option
|
||||
```
|
||||
|
||||
**Data Errors:**
|
||||
```
|
||||
Missing: Show empty state with action
|
||||
Corrupt: Show error boundary with reload
|
||||
Invalid: Highlight + explain what's wrong
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## DECISION TREE
|
||||
|
||||
When implementing a feature, ask:
|
||||
|
||||
### Is this...
|
||||
|
||||
**FIXED?**
|
||||
- Does it affect structure, accessibility, or universal UX?
|
||||
- Examples: Spacing scale, grid, contrast ratios, component architecture
|
||||
- **Action**: Use the fixed system, no variation
|
||||
|
||||
**PROJECT-SPECIFIC?**
|
||||
- Does it express brand personality or purpose?
|
||||
- Examples: Colors, typography, tone of voice, animation feel
|
||||
- **Action**: Fill in the template for this project
|
||||
|
||||
**ADAPTABLE?**
|
||||
- Does it depend on context, content, or use case?
|
||||
- Examples: Component variants, responsive behavior, error handling
|
||||
- **Action**: Choose appropriate variation based on context
|
||||
|
||||
---
|
||||
|
||||
## EXAMPLE: Implementing a "Submit" Button
|
||||
|
||||
### Fixed Elements (Always the same):
|
||||
- Touch target: 44px minimum height
|
||||
- Padding: 16px horizontal (from spacing scale)
|
||||
- States: Default, Hover, Active, Focus, Disabled
|
||||
- Animation: 150ms ease-out (lightweight profile)
|
||||
|
||||
### Project-Specific (Filled per project):
|
||||
- **Project A (Bank)**: Dark blue background, white text, "Submit Application"
|
||||
- **Project B (Social)**: Coral background, white text, "Let's Go!"
|
||||
- **Project C (Healthcare)**: Soft blue background, white text, "Continue"
|
||||
|
||||
### Adaptable (Context-dependent):
|
||||
- **Form context**: Primary button (full color)
|
||||
- **Toolbar context**: Ghost button (text only)
|
||||
- **Danger context**: Destructive variant (red-ish)
|
||||
|
||||
---
|
||||
|
||||
## VALIDATION CHECKLIST
|
||||
|
||||
Before finalizing a design, check:
|
||||
|
||||
### Fixed Elements
|
||||
- [ ] Uses spacing scale (4/8/12/16/24/32/48/64/96px)
|
||||
- [ ] Follows grid system (12 or 16 columns)
|
||||
- [ ] Meets WCAG AA contrast (4.5:1 normal, 3:1 large)
|
||||
- [ ] Touch targets ≥ 44px
|
||||
- [ ] Typography follows mathematical scale
|
||||
- [ ] Components follow standard architecture
|
||||
|
||||
### Project-Specific Elements
|
||||
- [ ] Brand colors filled in and intentional
|
||||
- [ ] Typography pairing chosen and justified
|
||||
- [ ] Tone of voice defined and consistent
|
||||
- [ ] Animation speed matches brand personality
|
||||
|
||||
### Adaptable Elements
|
||||
- [ ] Component variants appropriate for context
|
||||
- [ ] Responsive behavior fits content type
|
||||
- [ ] Loading states match operation duration
|
||||
- [ ] Error handling fits error type
|
||||
|
||||
---
|
||||
|
||||
## PROJECT KICKOFF TEMPLATE
|
||||
|
||||
Use this to start a new project:
|
||||
|
||||
```
|
||||
PROJECT NAME: _______________________
|
||||
PURPOSE: ____________________________
|
||||
|
||||
BRAND PERSONALITY:
|
||||
- Primary emotion: _______
|
||||
- Warm or cool: _______
|
||||
- Formal or casual: _______
|
||||
- Conservative or bold: _______
|
||||
|
||||
COLORS (fill the template):
|
||||
- Neutral base: _______
|
||||
- Primary accent: _______
|
||||
- Status colors: _______ / _______ / _______
|
||||
|
||||
TYPOGRAPHY (fill the template):
|
||||
- Headline font: _______
|
||||
- Body font: _______
|
||||
- Pairing rationale: _______
|
||||
|
||||
TONE:
|
||||
- Button labels style: _______
|
||||
- Error message style: _______
|
||||
- Success message style: _______
|
||||
|
||||
ANIMATION:
|
||||
- Speed preference: _______ (fast/moderate/slow)
|
||||
- Feel preference: _______ (sharp/smooth/bouncy)
|
||||
|
||||
TARGET DEVICES:
|
||||
- Primary: _______ (mobile/desktop/both)
|
||||
- Secondary: _______
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## MAINTAINING CONSISTENCY
|
||||
|
||||
### Documentation
|
||||
- Keep this template updated as system evolves
|
||||
- Document WHY choices were made, not just WHAT
|
||||
|
||||
### Communication
|
||||
- Share with designers: "Here's what varies vs. what's fixed"
|
||||
- Share with developers: "Here are the design tokens"
|
||||
|
||||
### Tooling
|
||||
- Use CSS variables for project-specific values
|
||||
- Use Tailwind config for spacing scale
|
||||
- Use design tokens in Figma/Storybook
|
||||
|
||||
### Reviews
|
||||
- Audit: Does new work follow fixed elements?
|
||||
- Validate: Are project-specific elements intentional?
|
||||
- Question: Are adaptations justified by context?
|
||||
|
||||
---
|
||||
|
||||
## EXAMPLES OF COMPLETE SYSTEMS
|
||||
|
||||
### System A: B2B SaaS (Conservative)
|
||||
|
||||
**Fixed**: Standard spacing, 12-col grid, WCAG AA, major third type scale
|
||||
**Project-Specific**:
|
||||
- Colors: Cool greys + corporate blue
|
||||
- Typography: DM Sans (headlines + body)
|
||||
- Tone: Professional, formal
|
||||
- Animation: Quick, precise (150ms)
|
||||
**Adaptable**:
|
||||
- Dashboard gets multi-panel layout
|
||||
- Forms are extensive (use progressive disclosure)
|
||||
- Errors show detailed technical info
|
||||
|
||||
### System B: Consumer Social App (Playful)
|
||||
|
||||
**Fixed**: Same spacing/grid/accessibility/type logic
|
||||
**Project-Specific**:
|
||||
- Colors: Warm greys + vibrant coral
|
||||
- Typography: Poppins (headlines) + Inter (body)
|
||||
- Tone: Casual, friendly, playful
|
||||
- Animation: Moderate, bouncy (200ms)
|
||||
**Adaptable**:
|
||||
- Mobile-first (most users on phones)
|
||||
- Forms are minimal (progressive profiling)
|
||||
- Errors are friendly, not technical
|
||||
|
||||
### System C: Healthcare Platform (Clinical)
|
||||
|
||||
**Fixed**: Same foundational structure
|
||||
**Project-Specific**:
|
||||
- Colors: Pure greys + medical blue
|
||||
- Typography: System fonts (SF Pro / Segoe)
|
||||
- Tone: Clear, authoritative, calm
|
||||
- Animation: Slow, smooth (300ms)
|
||||
**Adaptable**:
|
||||
- Desktop-first (clinical use at workstations)
|
||||
- Forms are complex (HIPAA compliance)
|
||||
- Errors are precise with next steps
|
||||
|
||||
---
|
||||
|
||||
## KEY TAKEAWAY
|
||||
|
||||
**The system flexibility framework lets you:**
|
||||
- Maintain consistency (fixed elements)
|
||||
- Express brand personality (project-specific)
|
||||
- Adapt to context (adaptable elements)
|
||||
|
||||
**Without this framework:**
|
||||
- Designers reinvent spacing every project
|
||||
- Components feel inconsistent across products
|
||||
- Brand personality overrides accessibility
|
||||
- Context-blind implementations feel wrong
|
||||
|
||||
**With this framework:**
|
||||
- Speed: Start from proven foundations
|
||||
- Consistency: Fixed elements guarantee it
|
||||
- Flexibility: Express unique brand identity
|
||||
- Context: Adapt without breaking system
|
||||
@@ -1,72 +0,0 @@
|
||||
# Motion Specification
|
||||
|
||||
Motion should surprise and delight while serving function. Animation is a creative tool.
|
||||
|
||||
## Easing Curves
|
||||
|
||||
| Easing | CSS | Use For |
|
||||
|--------|-----|---------|
|
||||
| **Ease-out** | `cubic-bezier(0.0, 0.0, 0.2, 1)` | Entrances, appearing |
|
||||
| **Ease-in** | `cubic-bezier(0.4, 0.0, 1, 1)` | Exits, disappearing |
|
||||
| **Ease-in-out** | `cubic-bezier(0.4, 0.0, 0.2, 1)` | State changes, transforms |
|
||||
| **Spring** | `cubic-bezier(0.68, -0.55, 0.265, 1.55)` | Playful, attention-grabbing |
|
||||
| **Linear** | `linear` | Spinners, continuous loops |
|
||||
|
||||
## Duration by Element Weight
|
||||
|
||||
| Weight | Duration | Examples |
|
||||
|--------|----------|----------|
|
||||
| **Lightweight** | 150ms | Icons, badges, chips |
|
||||
| **Standard** | 300ms | Cards, panels, list items |
|
||||
| **Weighty** | 500ms | Modals, page transitions |
|
||||
|
||||
## Duration by Interaction
|
||||
|
||||
| Interaction | Duration |
|
||||
|-------------|----------|
|
||||
| Button press | 100ms |
|
||||
| Hover state | 150ms |
|
||||
| Tooltip appear | 200ms |
|
||||
| Tab switch | 250ms |
|
||||
| Modal open | 300ms |
|
||||
| Page transition | 400ms |
|
||||
|
||||
## Common Patterns
|
||||
|
||||
```tsx
|
||||
// Hover transition (CSS)
|
||||
<button className="transition-colors duration-150 ease-out hover:bg-blue-700">
|
||||
|
||||
// Fade + slide (Framer Motion)
|
||||
<motion.div
|
||||
initial={{ opacity: 0, y: 20 }}
|
||||
animate={{ opacity: 1, y: 0 }}
|
||||
transition={{ duration: 0.3, ease: "easeOut" }}
|
||||
/>
|
||||
|
||||
// Stagger children
|
||||
<motion.ul variants={{ visible: { transition: { staggerChildren: 0.1 } } }}>
|
||||
<motion.li variants={{ hidden: { opacity: 0 }, visible: { opacity: 1 } }} />
|
||||
</motion.ul>
|
||||
```
|
||||
|
||||
## Performance Rules
|
||||
|
||||
- Only animate `transform` and `opacity` (GPU-accelerated)
|
||||
- Avoid animating `width`, `height`, `margin`, `padding`
|
||||
- Keep durations under 500ms for UI interactions
|
||||
- Respect `prefers-reduced-motion`:
|
||||
|
||||
```css
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
*, *::before, *::after {
|
||||
animation-duration: 0.01ms !important;
|
||||
transition-duration: 0.01ms !important;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Resources
|
||||
|
||||
- [Framer Motion](https://www.framer.com/motion/)
|
||||
- [CSS Easing Functions](https://easings.net/)
|
||||
@@ -1,90 +0,0 @@
|
||||
# Responsive Design Essentials
|
||||
|
||||
Mobile-first approach: start with mobile, progressively enhance for larger screens.
|
||||
|
||||
## Breakpoints
|
||||
|
||||
| Range | Pixels | Devices | Strategy |
|
||||
|-------|--------|---------|----------|
|
||||
| **XS** | 0-479px | Small phones | Single column, stacked nav, 44px touch targets |
|
||||
| **SM** | 480-767px | Large phones | Single column, bottom nav, simplified UI |
|
||||
| **MD** | 768-1023px | Tablets | 2 columns possible, sidebar nav |
|
||||
| **LG** | 1024-1439px | Laptops | Multi-column, full nav, desktop UI |
|
||||
| **XL** | 1440px+ | Desktop | Max-width containers, multi-panel layouts |
|
||||
|
||||
## Tailwind Responsive
|
||||
|
||||
```tsx
|
||||
// Mobile-first: base styles, then scale up
|
||||
<div className="
|
||||
w-full // mobile: full width
|
||||
sm:w-1/2 // 480px+: half
|
||||
md:w-1/3 // 768px+: third
|
||||
lg:w-1/4 // 1024px+: quarter
|
||||
">
|
||||
|
||||
// Responsive grid
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6">
|
||||
|
||||
// Responsive typography
|
||||
<h1 className="text-3xl md:text-4xl lg:text-5xl">
|
||||
|
||||
// Show/hide by breakpoint
|
||||
<div className="block md:hidden">Mobile only</div>
|
||||
<div className="hidden md:block">Desktop only</div>
|
||||
```
|
||||
|
||||
## Fluid Typography
|
||||
|
||||
```css
|
||||
h1 { font-size: clamp(2rem, 5vw, 4rem); }
|
||||
p { font-size: clamp(1rem, 2.5vw, 1.25rem); }
|
||||
```
|
||||
|
||||
## Touch Targets
|
||||
|
||||
- Minimum **44x44px** for all interactive elements
|
||||
- Use `touch-manipulation` to prevent 300ms tap delay
|
||||
- Adequate spacing between targets
|
||||
|
||||
```tsx
|
||||
<button className="min-w-[44px] min-h-[44px] touch-manipulation">
|
||||
```
|
||||
|
||||
## Mobile Simplification
|
||||
|
||||
| Desktop | Mobile |
|
||||
|---------|--------|
|
||||
| Full nav bar | Hamburger menu |
|
||||
| Side-by-side fields | Stacked fields |
|
||||
| Multi-column grid | Single column |
|
||||
| Inline buttons | Fixed bottom bar |
|
||||
| Data table | Collapsed cards |
|
||||
| Visible sidebar | Hidden/collapsible |
|
||||
|
||||
## Images
|
||||
|
||||
```tsx
|
||||
// Responsive images
|
||||
<img
|
||||
srcSet="image-400w.jpg 400w, image-800w.jpg 800w, image-1200w.jpg 1200w"
|
||||
sizes="(max-width: 640px) 100vw, (max-width: 1024px) 50vw, 33vw"
|
||||
loading="lazy"
|
||||
/>
|
||||
|
||||
// Next.js
|
||||
<Image src="/hero.jpg" width={1200} height={600} priority className="w-full h-auto" />
|
||||
```
|
||||
|
||||
## Testing
|
||||
|
||||
Test at these widths:
|
||||
- 375px (iPhone SE)
|
||||
- 390px (iPhone 14)
|
||||
- 768px (iPad)
|
||||
- 1024px (iPad Pro)
|
||||
- 1280px+ (Desktop)
|
||||
|
||||
## Resources
|
||||
|
||||
- [Tailwind Responsive](https://tailwindcss.com/docs/responsive-design)
|
||||
@@ -1,718 +0,0 @@
|
||||
---
|
||||
name: bencium-innovative-ux-designer
|
||||
description: Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
|
||||
metadata:
|
||||
version: 2.0.0
|
||||
---
|
||||
|
||||
# Innovative UX Designer
|
||||
|
||||
Create distinctive, production-grade frontend interfaces that avoid generic "AI slop" aesthetics. Implement real working code with exceptional attention to aesthetic details and creative choices. Expert UI/UX design skill that helps create unique, accessible, and thoughtfully designed interfaces. This skill emphasizes design decision collaboration, breaking away from generic patterns, and building interfaces that stand out while remaining functional and accessible.
|
||||
|
||||
This skill emphasizes **bold creative commitment**, breaking away from generic patterns, and building interfaces that are visually striking and memorable while remaining functional and accessible.
|
||||
|
||||
## Core Philosophy
|
||||
|
||||
**CRITICAL: Design Thinking Protocol**
|
||||
|
||||
Before coding, **ASK to understand context**, then **COMMIT BOLDLY** to a distinctive direction:
|
||||
|
||||
### Questions to Ask First
|
||||
1. **Purpose**: What problem does this interface solve? Who uses it?
|
||||
2. **Tone**: What aesthetic extreme fits? (see Tone Options below)
|
||||
3. **Constraints**: Technical requirements (framework, performance, accessibility)?
|
||||
4. **Differentiation**: What makes this UNFORGETTABLE? What's the one thing someone will remember?
|
||||
|
||||
### Tone Options (Pick an Extreme)
|
||||
Choose a clear aesthetic direction and execute with precision:
|
||||
- **Brutally minimal** - stripped to essence, bold typography, vast whitespace
|
||||
- **Maximalist chaos** - layered, dense, visually rich, controlled disorder
|
||||
- **Retro-futuristic** - vintage meets sci-fi, nostalgic tech aesthetics
|
||||
- **Organic/natural** - soft edges, earthy colors, nature-inspired textures
|
||||
- **Luxury/refined** - elegant spacing, premium typography, subtle details
|
||||
- **Playful/toy-like** - bright colors, rounded shapes, delightful interactions
|
||||
- **Editorial/magazine** - strong typography hierarchy, asymmetric layouts
|
||||
- **Brutalist/raw** - exposed structure, harsh contrasts, intentionally rough
|
||||
- **Art deco/geometric** - bold patterns, metallic accents, symmetric elegance
|
||||
- **Soft/pastel** - gentle gradients, muted tones, calming atmosphere
|
||||
- **Industrial/utilitarian** - functional, no-nonsense, mechanical precision
|
||||
|
||||
### After Getting Context
|
||||
- **Commit fully** to the chosen direction - no half measures
|
||||
- Present 2-3 alternative approaches with trade-offs
|
||||
- Then implement with precision: production-grade, visually striking, memorable
|
||||
|
||||
## Foundational Design Principles
|
||||
|
||||
### Stand Out From Generic Patterns
|
||||
|
||||
**NEVER Use These AI-Generated Aesthetics:**
|
||||
- **Fonts**: Inter, Roboto, Arial, system fonts as primary choice, Space Grotesk (overused by AI)
|
||||
- **Colors**: Generic SaaS blue (#3B82F6), purple gradients on white backgrounds
|
||||
- **Patterns**: Cookie-cutter layouts, predictable component arrangements
|
||||
- **Effects**: Glass morphism, Apple design mimicry, liquid/blob backgrounds
|
||||
- **Overall**: Anything that looks "Claude-generated" or machine-made
|
||||
|
||||
**Instead, Create Atmosphere:**
|
||||
- Suggest photography, patterns, textures over flat solid colors
|
||||
- Apply gradient meshes, noise textures, geometric patterns
|
||||
- Use layered transparencies, dramatic shadows, decorative borders
|
||||
- Consider custom cursors, grain overlays, contextual effects
|
||||
- Think beyond typical patterns - you can step off the written path
|
||||
|
||||
**Draw Inspiration From:**
|
||||
- Modern landing pages (Perplexity, Comet Browser, Dia Browser)
|
||||
- Framer templates and their innovative approaches
|
||||
- Leading brand design studios
|
||||
- Historical design movements (Bauhaus, Otl Aicher, Braun) - but as inspiration, not imitation
|
||||
- Beautiful background animations (CSS, SVG) - slow, looping, subtle
|
||||
|
||||
**Visual Interest Strategies:**
|
||||
- Unique color pairs that aren't typical
|
||||
- Animation effects that feel fresh
|
||||
- Background patterns that add depth without distraction
|
||||
- Typography combinations that create contrast
|
||||
- Visual assets that tell a story
|
||||
|
||||
### Core Design Philosophy
|
||||
|
||||
1. **Simplicity Through Reduction**
|
||||
- Identify the essential purpose and eliminate distractions
|
||||
- Begin with complexity, then deliberately remove until reaching the simplest effective solution
|
||||
- Every element must justify its existence
|
||||
|
||||
2. **Material Honesty**
|
||||
- Digital materials have unique properties - embrace them
|
||||
- Buttons communicate affordance through color, spacing, typography, AND shadows when intentional
|
||||
- Cards can use borders, background differentiation, OR dramatic shadows for depth
|
||||
- Animations follow real-world physics principles adapted to digital responsiveness
|
||||
|
||||
**Examples:**
|
||||
- Clickable: Use distinct colors, hover state changes, cursor feedback, subtle lift effects
|
||||
- Containers: Use borders, background shifts, generous padding, OR shadow depth
|
||||
- Hierarchy: Use scale, weight, spacing, AND elevation when it serves the aesthetic
|
||||
|
||||
3. **Functional Layering**
|
||||
- Create hierarchy through typography scale, color contrast, and spatial relationships
|
||||
- Layer information conceptually (primary → secondary → tertiary)
|
||||
- Use shadows and gradients INTENTIONALLY when they serve the aesthetic direction
|
||||
- Embrace functional depth: modals over content, dropdowns over UI
|
||||
- Avoid: glass morphism, Apple mimicry (but shadows/gradients are tools, not enemies)
|
||||
|
||||
4. **Obsessive Detail**
|
||||
- Consider every pixel, interaction, and transition
|
||||
- Excellence emerges from hundreds of small, intentional decisions
|
||||
- Balance: Details should serve simplicity, not complexity
|
||||
- When detail conflicts with clarity, clarity wins
|
||||
|
||||
5. **Coherent Design Language**
|
||||
- Every element should visually communicate its function
|
||||
- Elements should feel part of a unified system
|
||||
- Nothing should feel arbitrary
|
||||
|
||||
6. **Invisibility of Technology**
|
||||
- The best technology disappears
|
||||
- Users should focus on content and goals, not on understanding the interface
|
||||
|
||||
### What This Means in Practice
|
||||
|
||||
**Color Usage:**
|
||||
- Base palette: 4-5 neutral shades (backgrounds, borders, text)
|
||||
- Accent palette: 1-3 bold colors (CTAs, status, emphasis)
|
||||
- Neutrals are slightly desaturated, warm or cool based on brand intent
|
||||
- Accents are saturated enough to create clear contrast
|
||||
|
||||
**Typography:**
|
||||
- Headlines: Emotional, attention-grabbing, UNEXPECTED (personality over pure legibility)
|
||||
- Body/UI: Functional, highly legible (clarity over expression)
|
||||
- 2-3 typefaces maximum, but make them CHARACTERFUL and distinctive
|
||||
- Clear mathematical scale (e.g., 1.25x between sizes)
|
||||
- NEVER default to Inter, Roboto, or Space Grotesk - find unique fonts
|
||||
|
||||
**Animation:**
|
||||
- Purposeful: Guides attention, establishes relationships, provides feedback
|
||||
- Subtle: Felt rather than seen (100-300ms for most interactions)
|
||||
- Physics-informed: Natural easing, appropriate mass/momentum
|
||||
|
||||
**Spacing:**
|
||||
- Generous negative space creates clarity and breathing room
|
||||
- Mathematical relationships (e.g., 4px base, 8/16/24/32/48px scale)
|
||||
- Consistent application creates visual rhythm
|
||||
|
||||
### Design Decision Checklist
|
||||
|
||||
Before presenting any design, verify:
|
||||
|
||||
1. **Purpose**: Does every element serve a clear function?
|
||||
2. **Hierarchy**: Is visual importance aligned with content importance?
|
||||
3. **Consistency**: Do similar elements look and behave similarly?
|
||||
4. **Accessibility**: Does it meet WCAG AA standards? (contrast, touch targets, keyboard nav)
|
||||
5. **Responsiveness**: Does it work on mobile, tablet, desktop?
|
||||
6. **Uniqueness**: Does this break from generic SaaS patterns?
|
||||
7. **Approval**: Have I asked before implementing colors, fonts, sizes, layouts?
|
||||
|
||||
**Design System Framework:**
|
||||
|
||||
For understanding what's fixed (universal rules), project-specific (brand personality), and adaptable (context-dependent) in your design system, think of a design system.
|
||||
|
||||
## Visual Design Standards
|
||||
|
||||
### Color & Contrast
|
||||
|
||||
**Color System Architecture:**
|
||||
|
||||
Every interface needs two color roles:
|
||||
|
||||
1. **Base/Neutral Palette (4-5 colors):**
|
||||
- Backgrounds (lightest)
|
||||
- Surface colors (cards, inputs)
|
||||
- Borders and dividers
|
||||
- Text (darkest)
|
||||
- Use slightly desaturated, warm or cool greys based on brand
|
||||
|
||||
2. **Accent Palette (1-3 colors):**
|
||||
- Primary action (CTA buttons)
|
||||
- Status indicators (success, warning, error, info)
|
||||
- Focus/hover states
|
||||
- Use saturated colors for clear contrast against neutrals
|
||||
|
||||
**Palette Structure Example:**
|
||||
```
|
||||
Neutrals: slate-50, slate-100, slate-300, slate-700, slate-900
|
||||
Accents: teal-500 (primary), amber-500 (warning), red-500 (error)
|
||||
```
|
||||
|
||||
**Color Application Rules:**
|
||||
|
||||
- **Backgrounds**: Lightest neutral (slate-50 or white)
|
||||
- **Text**: Darkest neutral for primary text (slate-900), mid-tone for secondary (slate-600)
|
||||
- **Buttons (primary)**: Accent color with white text
|
||||
- **Buttons (secondary)**: Neutral with border and dark text
|
||||
- **Status indicators**: Specific accent (green=success, red=error, amber=warning, blue=info)
|
||||
- **Interactive states**:
|
||||
- Hover: Darken by 10-15% or shift hue slightly
|
||||
- Focus: Use ring/outline in accent color
|
||||
- Disabled: Reduce opacity to 40-50% and remove hover effects
|
||||
|
||||
**Color Relationships:**
|
||||
|
||||
Choose warm or cool intentionally based on brand:
|
||||
- **Warm greys** (beige/brown undertones): Organic, approachable, trustworthy
|
||||
- **Cool greys** (blue undertones): Modern, tech-forward, professional
|
||||
|
||||
Accent colors should have clear contrast with both:
|
||||
- Light backgrounds (for buttons on white)
|
||||
- Dark text (if used as backgrounds for white text)
|
||||
|
||||
**Intentional Color Usage:**
|
||||
- Every color must serve a purpose (hierarchy, function, status, or action)
|
||||
- Avoid decorative colors that don't communicate meaning
|
||||
- Maintain consistency: same color = same meaning throughout
|
||||
|
||||
**Accessibility:**
|
||||
- Ensure sufficient contrast for color-blind users
|
||||
- Follow WCAG 2.1 AA: minimum 4.5:1 for normal text, 3:1 for large text
|
||||
- Don't rely on color alone to convey information (add icons or labels)
|
||||
|
||||
**Unique Color Strategy:**
|
||||
|
||||
To stand out from generic patterns:
|
||||
- NEVER use default SaaS blue (#3B82F6) or purple gradients on white
|
||||
- Use unexpected neutrals: warm greys, soft off-whites, deep charcoals, rich blacks
|
||||
- Pair neutrals with distinctive accents: terracotta + charcoal, sage + navy, coral + slate
|
||||
- Dominant colors with SHARP accents outperform timid, evenly-distributed palettes
|
||||
- Test combinations against "does this look AI-generated?" filter
|
||||
- Vary between light and dark themes - no design should look the same
|
||||
|
||||
**Create Atmosphere with Color:**
|
||||
- Gradient meshes for depth and visual interest
|
||||
- Noise textures and grain overlays for tactile feel
|
||||
- Layered transparencies for dimension
|
||||
- Dramatic shadows for emphasis and drama
|
||||
|
||||
### Typography Excellence
|
||||
|
||||
**Typography Philosophy:**
|
||||
|
||||
Typography is a primary design element that conveys personality and hierarchy.
|
||||
|
||||
**Functional vs Emotional Typography:**
|
||||
- **Headlines/Display**: Prioritize emotion, personality, attention (legibility secondary)
|
||||
- **Body Text**: Prioritize legibility, reading comfort, accessibility
|
||||
- **UI/Labels**: Prioritize clarity, scannability, consistency
|
||||
|
||||
**Font Selection:**
|
||||
- Use 2-3 typefaces maximum, but make them UNEXPECTED and characterful
|
||||
- Limit to 3 weights per typeface (e.g., Regular 400, Medium 500, Bold 700)
|
||||
- Prefer variable fonts for fine-tuned control and performance
|
||||
|
||||
**NEVER Use These Fonts as Primary:**
|
||||
- Inter (overused by AI and generic SaaS)
|
||||
- Roboto (too generic)
|
||||
- Arial/Helvetica (default fallback vibes)
|
||||
- Space Grotesk (AI generation favorite)
|
||||
- System fonts as primary choice (only as fallback)
|
||||
|
||||
**Font Version Usage:**
|
||||
- **Display version**: Headlines and hero text only - BE BOLD
|
||||
- **Text version**: Paragraphs and long-form content - legibility matters
|
||||
- **Caption/Micro**: Small UI labels (1-2 lines, non-critical info)
|
||||
|
||||
**Find Distinctive Fonts:**
|
||||
- Google Fonts for web - but dig deeper than page 1
|
||||
- Type foundries for unique options
|
||||
- Choose fonts that serve your CHOSEN AESTHETIC DIRECTION
|
||||
- Pair distinctive display font with refined body font
|
||||
|
||||
**Typographic Scale:**
|
||||
|
||||
Use mathematical relationships for size hierarchy:
|
||||
- **Ratio**: Major third (1.25x) for moderate contrast, Perfect fourth (1.333x) for dramatic
|
||||
- **Base size**: 16px (1rem) for body text
|
||||
- **Example scale (1.25x)**:
|
||||
```
|
||||
xs: 0.64rem (10px)
|
||||
sm: 0.8rem (13px)
|
||||
base: 1rem (16px)
|
||||
lg: 1.25rem (20px)
|
||||
xl: 1.563rem (25px)
|
||||
2xl: 1.953rem (31px)
|
||||
3xl: 2.441rem (39px)
|
||||
4xl: 3.052rem (49px)
|
||||
5xl: 3.815rem (61px)
|
||||
```
|
||||
|
||||
**Typographic Hierarchy:**
|
||||
- Create clear visual distinction between levels
|
||||
- Headlines, subheadings, body, captions should each have distinct size/weight
|
||||
- Use combination of size, weight, and color for hierarchy
|
||||
|
||||
**Spacing & Readability:**
|
||||
- **Line height**: 1.5x font size for body text (e.g., 16px text = 24px line-height)
|
||||
- **Line length**: 45-75 characters optimal for readability (60-70 ideal)
|
||||
- **Paragraph spacing**: 1-1.5em between paragraphs
|
||||
- **Letter spacing (tracking)**:
|
||||
- Larger text (headlines): Slightly tighter (-0.02em to -0.05em)
|
||||
- Normal text (body): Default (0)
|
||||
- Small text (captions): Slightly looser (+0.01em to +0.03em)
|
||||
- General rule: As size increases, reduce tracking; as size decreases, increase tracking
|
||||
|
||||
**Font Pairing Logic:**
|
||||
|
||||
When using multiple typefaces, create contrast through:
|
||||
- **Category contrast**: Serif + Sans-serif (classic, clear distinction)
|
||||
- **Weight contrast**: Light + Bold (dynamic, energetic)
|
||||
- **Personality contrast**: Geometric + Humanist (modern + warm)
|
||||
|
||||
Examples:
|
||||
- Serif headlines + Sans body (editorial, trustworthy)
|
||||
- Display headlines + System body (distinctive + efficient)
|
||||
- Bold sans headlines + Light sans body (modern, clean)
|
||||
|
||||
**UI Typography:**
|
||||
|
||||
Specific guidance for interface elements:
|
||||
- **Button text**: Semi-Bold (600), 14-16px, consistent casing (all-caps OR title case)
|
||||
- **Form labels**: Regular (400), 14px, positioned above input
|
||||
- **Form input text**: Regular (400), 16px minimum (prevents iOS zoom on focus)
|
||||
- **Placeholder text**: Light (300) or desaturated color, same size as input
|
||||
- **Error messages**: Regular (400), 12-14px, color-coded (red-ish)
|
||||
|
||||
**Responsive Typography:**
|
||||
|
||||
Scale type sizes across breakpoints:
|
||||
```tsx
|
||||
// Example with Tailwind
|
||||
<h1 className="text-3xl md:text-4xl lg:text-5xl">
|
||||
Responsive Headline
|
||||
</h1>
|
||||
|
||||
// Or with CSS clamp (fluid)
|
||||
h1 {
|
||||
font-size: clamp(2rem, 5vw, 4rem);
|
||||
}
|
||||
```
|
||||
|
||||
Reduce sizes on mobile (20-30% smaller than desktop)
|
||||
Reduce hierarchy levels on small screens (fewer distinct sizes)
|
||||
|
||||
### Layout & Spatial Design
|
||||
|
||||
**Compositional Balance:**
|
||||
- Every screen should feel balanced
|
||||
- Pay attention to visual weight and negative space
|
||||
- Use generous negative space to focus attention
|
||||
- Add sufficient margins and paddings for professional, spacious look
|
||||
|
||||
**Grid Discipline:**
|
||||
- Maintain consistent underlying grid system
|
||||
- Create sense of order while allowing meaningful exceptions
|
||||
- Use grid/flex wrappers with `gap` for spacing
|
||||
- Prioritize wrappers over direct margins/padding on children
|
||||
|
||||
**Spatial Relationships:**
|
||||
- Group related elements through proximity, alignment, and shared attributes
|
||||
- Use size, color, and spacing to highlight important elements
|
||||
- Guide user focus through visual hierarchy
|
||||
|
||||
**Attention Guidance:**
|
||||
- Design interfaces that guide user attention effectively
|
||||
- Avoid cluttered interfaces where elements compete
|
||||
- Create clear paths through the content
|
||||
|
||||
## Interaction Design
|
||||
|
||||
|
||||
**Motion Specification:**
|
||||
|
||||
For detailed motion specs, see MOTION-SPEC.md (easing curves, duration tables, state-specific animations, implementation patterns).
|
||||
|
||||
### User Experience Patterns
|
||||
|
||||
**Core UX Principles:**
|
||||
|
||||
1. **Direct Manipulation**
|
||||
- Users interact directly with content, not through abstract controls
|
||||
- Examples:
|
||||
- Drag & drop to reorder items (not up/down buttons)
|
||||
- Inline editing (click to edit, not separate form)
|
||||
- Sliders for ranges (not numeric input with +/-)
|
||||
- Pinch/zoom gestures on mobile (not +/- buttons)
|
||||
|
||||
2. **Immediate Feedback**
|
||||
- Every interaction provides instantaneous visual feedback (within 100ms)
|
||||
- Types of feedback:
|
||||
- **Visual**: Button pressed state, hover effects, color changes
|
||||
- **Haptic**: Vibration on mobile (submit, error, success)
|
||||
- **Audio**: Subtle sounds for critical actions (optional, user-controlled)
|
||||
- **Loading**: Skeleton screens, spinners for >300ms operations
|
||||
- **Success**: Checkmarks, green highlights, toast notifications
|
||||
- **Error**: Red highlights, inline error messages, shake animations
|
||||
|
||||
3. **Consistent Behavior**
|
||||
- Similar-looking elements behave similarly
|
||||
- Examples:
|
||||
- **Visual consistency**: All primary buttons have same colors, sizes, hover states
|
||||
- **Behavioral consistency**: All modals close via X button, ESC key, and outside click
|
||||
- **Interaction consistency**: All drag targets have same hover state and drop feedback
|
||||
- **Pattern consistency**: All forms validate on blur and submit
|
||||
|
||||
4. **Forgiveness**
|
||||
- Make errors difficult, but recovery easy
|
||||
- **Prevention strategies**:
|
||||
- Disable invalid actions (grey out unavailable buttons)
|
||||
- Validate inputs inline (before submission)
|
||||
- Confirm destructive actions (delete, overwrite)
|
||||
- Auto-save in background (drafts, progress)
|
||||
- **Recovery strategies**:
|
||||
- Undo/redo for all state changes
|
||||
- Soft deletes (trash/archive before permanent delete)
|
||||
- Clear error messages with actionable fixes
|
||||
- Preserve user input on errors (don't clear forms)
|
||||
|
||||
5. **Progressive Disclosure**
|
||||
- Reveal details as needed rather than overwhelming users
|
||||
- Levels of disclosure:
|
||||
- **Summary**: Show essential info by default (card title, price, rating)
|
||||
- **Details**: Expand to show more info (description, specs, reviews)
|
||||
- **Advanced**: Hide complex options behind "Advanced settings" toggle
|
||||
- Examples:
|
||||
- Accordion: Start collapsed, expand on click
|
||||
- Search filters: Show 3-5 common filters, hide rest behind "More filters"
|
||||
- Settings: Basic settings visible, advanced behind "Show advanced"
|
||||
|
||||
**Modern UX Patterns:**
|
||||
|
||||
1. **Conversational Interfaces**
|
||||
|
||||
Prioritize natural language interaction where appropriate:
|
||||
|
||||
**Four types:**
|
||||
- **Pure chat**: Full conversation (AI assistants, support bots)
|
||||
- **Command palette**: Text-based shortcuts (Cmd+K, search everywhere)
|
||||
- **Smart search**: Natural language queries (search "meetings next week" vs filtering)
|
||||
- **Form alternatives**: Conversational data collection ("What's your name?" vs form fields)
|
||||
|
||||
**When to use:**
|
||||
- Complex searches with multiple variables
|
||||
- Task guidance (wizards, onboarding)
|
||||
- Contextual help
|
||||
- Quick actions (command palette)
|
||||
|
||||
**When NOT to use:**
|
||||
- Simple forms (just use inputs)
|
||||
- Precise control interfaces (design tools, dashboards)
|
||||
- High-frequency repetitive tasks
|
||||
|
||||
2. **Adaptive Layouts**
|
||||
|
||||
Respond to user context automatically:
|
||||
- **Time-based**: Dark mode at night, light during day
|
||||
- **Device-based**: Simplified UI on mobile, full features on desktop
|
||||
- **Connection-based**: Reduce images/video on slow connections
|
||||
- **Usage-based**: Prioritize frequent actions, hide rarely-used features
|
||||
|
||||
Examples:
|
||||
- Auto dark/light mode based on time or system preference
|
||||
- Simplified mobile navigation (hamburger menu) vs full desktop nav
|
||||
- Collapsed sidebar on small screens, expanded on large
|
||||
|
||||
3. **Bold Visual Expression**
|
||||
|
||||
Aesthetic flexibility based on chosen direction:
|
||||
- Shadows ALLOWED and encouraged when intentional (dramatic shadows, soft elevation)
|
||||
- Gradients ALLOWED for depth, accents, backgrounds, and atmosphere
|
||||
- NO glass morphism effects (this is the one banned technique)
|
||||
- NO Apple design mimicry (find your own voice)
|
||||
- Focus on typography, color, spacing, AND visual effects to create hierarchy
|
||||
- Create atmosphere: gradient meshes, noise textures, grain overlays, dramatic lighting
|
||||
|
||||
**Navigation:**
|
||||
- Clear structure with intuitive navigation menus
|
||||
- Implement breadcrumbs for deep hierarchies (more than 2 levels)
|
||||
- Use standard UI patterns to reduce learning curve (hamburger menu, tab bars)
|
||||
- Ensure predictable behavior (back button works, links look clickable)
|
||||
- Maintain navigation context (highlight current page, preserve scroll position)
|
||||
|
||||
## Styling Implementation
|
||||
|
||||
### Component Library & Tools
|
||||
|
||||
**Component Library:**
|
||||
- Strongly prefer shadcn components (v4, pre-installed in `@/components/ui`)
|
||||
- Import individually: `import { Button } from "@/components/ui/button";`
|
||||
- Use over plain HTML elements (`<Button>` over `<button>`)
|
||||
- Avoid creating custom components with names that clash with shadcn
|
||||
|
||||
**Styling Engine:**
|
||||
- Use Tailwind utility classes exclusively
|
||||
- Adhere to theme variables in `index.css` via CSS custom properties
|
||||
- Map variables in `@theme` (see `tailwind.config.js`)
|
||||
- Use inline styles or CSS modules only when absolutely necessary
|
||||
|
||||
**Icons:**
|
||||
- Use `@phosphor-icons/react` for buttons and inputs
|
||||
- Example: `import { Plus } from "@phosphor-icons/react"; <Plus />`
|
||||
- Use color for plain icon buttons
|
||||
- Don't override default `size` or `weight` unless requested
|
||||
|
||||
**Notifications:**
|
||||
- Use `sonner` for toasts
|
||||
- Example: `import { toast } from 'sonner'`
|
||||
|
||||
**Loading States:**
|
||||
- Always add loading states, spinners, placeholder animations
|
||||
- Use skeletons until content renders
|
||||
|
||||
### Layout Implementation
|
||||
|
||||
**Spacing Strategy:**
|
||||
- Use grid/flex wrappers with `gap` for spacing
|
||||
- Prioritize wrappers over direct margins/padding on children
|
||||
- Nest wrappers as needed for complex layouts
|
||||
|
||||
**Conditional Styling:**
|
||||
- Use ternary operators or clsx/classnames utilities
|
||||
- Example: `className={clsx('base-class', { 'active-class': isActive })}`
|
||||
|
||||
### Responsive Design
|
||||
|
||||
**Fluid Layouts:**
|
||||
- Use relative units (%, em, rem) instead of fixed pixels
|
||||
- Implement CSS Grid and Flexbox for flexible layouts
|
||||
- Design mobile-first, then scale up
|
||||
|
||||
**Media Queries:**
|
||||
- Use breakpoints based on content needs, not specific devices
|
||||
- Test across range of devices and orientations
|
||||
|
||||
**Touch Targets:**
|
||||
- Minimum 44x44 pixels for interactive elements
|
||||
- Provide adequate spacing between touch targets
|
||||
- Consider hover states for desktop, focus states for touch/keyboard
|
||||
|
||||
**Performance:**
|
||||
- Optimize assets for mobile networks
|
||||
- Use CSS animations over JavaScript
|
||||
- Implement lazy loading for images and videos
|
||||
|
||||
## Accessibility Standards
|
||||
|
||||
**Core Requirements:**
|
||||
- Follow WCAG 2.1 AA guidelines
|
||||
- Ensure keyboard navigability for all interactive elements
|
||||
- Minimum touch target size: 44×44px
|
||||
- Use semantic HTML for screen reader compatibility
|
||||
- Provide alternative text for images and non-text content
|
||||
|
||||
**Implementation Details:**
|
||||
- Use descriptive variable and function names
|
||||
- Event functions: prefix with "handle" (handleClick, handleKeyDown)
|
||||
- Add accessibility attributes:
|
||||
- `tabindex="0"` for custom interactive elements
|
||||
- `aria-label` for buttons without text
|
||||
- `role` attributes when semantic HTML isn't sufficient
|
||||
- Ensure logical tab order
|
||||
- Provide visible focus states
|
||||
|
||||
## Design Process & Testing
|
||||
|
||||
### Design Workflow
|
||||
|
||||
1. **Understand Context:**
|
||||
- What problem are we solving?
|
||||
- Who are the users and when will they use this?
|
||||
- What are the success criteria?
|
||||
|
||||
2. **Explore Options:**
|
||||
- Present 2-3 alternative approaches
|
||||
- Explain trade-offs of each option
|
||||
- Ask which direction resonates
|
||||
|
||||
3. **Implement Iteratively:**
|
||||
- Start with structure and hierarchy
|
||||
- Add visual polish progressively
|
||||
- Test at each stage
|
||||
|
||||
4. **Validate:**
|
||||
- Use playwright MCP to test visual changes
|
||||
- Check across different screen sizes
|
||||
- Verify accessibility
|
||||
|
||||
### Testing Checklist
|
||||
|
||||
**Visual Testing:**
|
||||
- Use playwright MCP when available for automated testing
|
||||
- Check responsive behavior at common breakpoints
|
||||
- Verify touch targets on mobile
|
||||
- Test with different content lengths (short, long, edge cases)
|
||||
|
||||
**Accessibility Testing:**
|
||||
- Test keyboard navigation
|
||||
- Verify screen reader compatibility
|
||||
- Check color contrast ratios
|
||||
- Ensure focus states are visible
|
||||
|
||||
**Cross-Device Testing:**
|
||||
- Test on actual devices, not just emulators
|
||||
- Check different browsers (Chrome, Firefox, Safari)
|
||||
- Verify touch interactions on mobile
|
||||
- Test landscape and portrait orientations
|
||||
|
||||
## Examples
|
||||
|
||||
### Example 1: Designing a Button
|
||||
|
||||
**Initial Question to Ask:**
|
||||
```
|
||||
Before I implement this button, I have a few design questions:
|
||||
1. What's the primary action you want to emphasize?
|
||||
2. Do you have brand colors in mind, or should I suggest options?
|
||||
3. What emotion should this button convey? (urgent, calm, playful, professional)
|
||||
```
|
||||
|
||||
**After Getting Approval, Implementation:**
|
||||
```tsx
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { ArrowRight } from "@phosphor-icons/react";
|
||||
|
||||
<Button
|
||||
className="bg-slate-800 hover:bg-slate-700 text-white px-6 py-3 rounded-lg transition-colors duration-200"
|
||||
>
|
||||
Get Started
|
||||
<ArrowRight className="ml-2" />
|
||||
</Button>
|
||||
```
|
||||
|
||||
### Example 2: Typography Hierarchy
|
||||
|
||||
**Question First:**
|
||||
```
|
||||
For this content hierarchy, I'm thinking:
|
||||
- Headline: Large, bold, attention-grabbing
|
||||
- Subheading: Medium, regular weight
|
||||
- Body: Smaller, optimized for reading
|
||||
|
||||
Should we go bold and contemporary, or subtle and refined?
|
||||
```
|
||||
|
||||
**Implementation After Approval:**
|
||||
```tsx
|
||||
<div className="space-y-4">
|
||||
<h1 className="text-5xl font-bold tracking-tight text-slate-900">
|
||||
Headline Here
|
||||
</h1>
|
||||
<h2 className="text-2xl text-slate-600">
|
||||
Supporting subheading
|
||||
</h2>
|
||||
<p className="text-base leading-relaxed text-slate-700">
|
||||
Body text optimized for readability with proper line height.
|
||||
</p>
|
||||
</div>
|
||||
```
|
||||
|
||||
### Example 3: Unique Color Palette Suggestion
|
||||
|
||||
**Presenting Options:**
|
||||
```
|
||||
I'd like to suggest three color directions that break from typical SaaS patterns:
|
||||
|
||||
1. **Warm Earth Tones**
|
||||
- Base: Warm grey (#E8E2DC)
|
||||
- Accent: Terracotta (#C86E4B)
|
||||
- For: Organic, trustworthy feel
|
||||
|
||||
2. **Cool Midnight**
|
||||
- Base: Deep navy (#1A2332)
|
||||
- Accent: Cyan (#4ECDC4)
|
||||
- For: Modern, tech-forward feel
|
||||
|
||||
3. **Soft Pastels**
|
||||
- Base: Soft pink (#FFE5E5)
|
||||
- Accent: Sage green (#9DB5A4)
|
||||
- For: Calm, approachable feel
|
||||
|
||||
Which direction feels right for your brand?
|
||||
```
|
||||
|
||||
## Common Patterns to Avoid
|
||||
|
||||
❌ **NEVER:**
|
||||
- Use Inter, Roboto, Arial, Space Grotesk as primary fonts
|
||||
- Use generic SaaS blue (#3B82F6) or purple gradients on white
|
||||
- Copy Apple's design language or use glass morphism
|
||||
- Create cookie-cutter layouts that look AI-generated
|
||||
- Skip asking about context before designing
|
||||
- Converge on common choices across generations (vary everything!)
|
||||
- Use animations that delay user actions
|
||||
- Create cluttered interfaces where elements compete
|
||||
|
||||
✅ **ALWAYS:**
|
||||
- Ask about purpose, tone, constraints, differentiation FIRST
|
||||
- Then commit BOLDLY to a distinctive aesthetic direction
|
||||
- Use unexpected, characterful typography choices
|
||||
- Create atmosphere: shadows, gradients, textures, grain (when intentional)
|
||||
- Dominant colors with sharp accents (not timid, evenly-distributed palettes)
|
||||
- Provide immediate feedback for interactions
|
||||
- Test with real devices
|
||||
- Validate accessibility (it enables creativity, not limits it)
|
||||
- Remember: Claude is capable of extraordinary creative work - don't hold back!
|
||||
|
||||
## Version History
|
||||
|
||||
- v2.0.0 (2025-11-22): Creative liberation update - bold aesthetics, shadows/gradients allowed, Design Thinking protocol
|
||||
- v1.0.0 (2025-10-18): Initial release with comprehensive UI/UX design guidance
|
||||
|
||||
## References
|
||||
|
||||
For additional context, see:
|
||||
- **Anthropic Frontend Aesthetics Cookbook**: https://github.com/anthropics/claude-cookbooks/blob/main/coding/prompting_for_frontend_aesthetics.ipynb
|
||||
- WCAG 2.1 Guidelines: https://www.w3.org/WAI/WCAG21/quickref/
|
||||
- Google Fonts: https://fonts.google.com/
|
||||
- Tailwind CSS Docs: https://tailwindcss.com/docs
|
||||
- Shadcn UI Components: https://ui.shadcn.com/
|
||||
|
||||
**Progressive Disclosure Files:**
|
||||
- ACCESSIBILITY.md - Accessibility essentials (WCAG AA baseline)
|
||||
- MOTION-SPEC.md - Animation timing and easing
|
||||
- RESPONSIVE-DESIGN.md - Mobile-first breakpoints and patterns
|
||||
@@ -1,223 +0,0 @@
|
||||
---
|
||||
name: interactive-portfolio
|
||||
description: "Expert in building portfolios that actually land jobs and clients - not just showing work, but creating memorable experiences. Covers developer portfolios, designer portfolios, creative portfolios, and portfolios that convert visitors into opportunities. Use when: portfolio, personal website, showcase work, developer portfolio, designer portfolio."
|
||||
source: vibeship-spawner-skills (Apache 2.0)
|
||||
---
|
||||
|
||||
# Interactive Portfolio
|
||||
|
||||
**Role**: Portfolio Experience Designer
|
||||
|
||||
You know a portfolio isn't a resume - it's a first impression that needs
|
||||
to convert. You balance creativity with usability. You understand that
|
||||
hiring managers spend 30 seconds on each portfolio. You make those 30
|
||||
seconds count. You help people stand out without being gimmicky.
|
||||
|
||||
## Capabilities
|
||||
|
||||
- Portfolio architecture
|
||||
- Project showcase design
|
||||
- Interactive case studies
|
||||
- Personal branding for devs/designers
|
||||
- Contact conversion
|
||||
- Portfolio performance
|
||||
- Work presentation
|
||||
- Testimonial integration
|
||||
|
||||
## Patterns
|
||||
|
||||
### Portfolio Architecture
|
||||
|
||||
Structure that works for portfolios
|
||||
|
||||
**When to use**: When planning portfolio structure
|
||||
|
||||
```javascript
|
||||
## Portfolio Architecture
|
||||
|
||||
### The 30-Second Test
|
||||
In 30 seconds, visitors should know:
|
||||
1. Who you are
|
||||
2. What you do
|
||||
3. Your best work
|
||||
4. How to contact you
|
||||
|
||||
### Essential Sections
|
||||
| Section | Purpose | Priority |
|
||||
|---------|---------|----------|
|
||||
| Hero | Hook + identity | Critical |
|
||||
| Work/Projects | Prove skills | Critical |
|
||||
| About | Personality + story | Important |
|
||||
| Contact | Convert interest | Critical |
|
||||
| Testimonials | Social proof | Nice to have |
|
||||
| Blog/Writing | Thought leadership | Optional |
|
||||
|
||||
### Navigation Patterns
|
||||
```
|
||||
Option 1: Single page scroll
|
||||
- Best for: Designers, creatives
|
||||
- Works well with animations
|
||||
- Mobile friendly
|
||||
|
||||
Option 2: Multi-page
|
||||
- Best for: Lots of projects
|
||||
- Individual case study pages
|
||||
- Better for SEO
|
||||
|
||||
Option 3: Hybrid
|
||||
- Main sections on one page
|
||||
- Detailed case studies separate
|
||||
- Best of both worlds
|
||||
```
|
||||
|
||||
### Hero Section Formula
|
||||
```
|
||||
[Your name]
|
||||
[What you do in one line]
|
||||
[One line that differentiates you]
|
||||
[CTA: View Work / Contact]
|
||||
```
|
||||
```
|
||||
|
||||
### Project Showcase
|
||||
|
||||
How to present work effectively
|
||||
|
||||
**When to use**: When building project sections
|
||||
|
||||
```javascript
|
||||
## Project Showcase
|
||||
|
||||
### Project Card Elements
|
||||
| Element | Purpose |
|
||||
|---------|---------|
|
||||
| Thumbnail | Visual hook |
|
||||
| Title | What it is |
|
||||
| One-liner | What you did |
|
||||
| Tech/tags | Quick scan |
|
||||
| Results | Proof of impact |
|
||||
|
||||
### Case Study Structure
|
||||
```
|
||||
1. Hero image/video
|
||||
2. Project overview (2-3 sentences)
|
||||
3. The challenge
|
||||
4. Your role
|
||||
5. Process highlights
|
||||
6. Key decisions
|
||||
7. Results/impact
|
||||
8. Learnings (optional)
|
||||
9. Links (live, GitHub, etc.)
|
||||
```
|
||||
|
||||
### Showing Impact
|
||||
| Instead of | Write |
|
||||
|------------|-------|
|
||||
| "Built a website" | "Increased conversions 40%" |
|
||||
| "Designed UI" | "Reduced user drop-off 25%" |
|
||||
| "Developed features" | "Shipped to 50K users" |
|
||||
|
||||
### Visual Presentation
|
||||
- Device mockups for web/mobile
|
||||
- Before/after comparisons
|
||||
- Process artifacts (wireframes, etc.)
|
||||
- Video walkthroughs for complex work
|
||||
- Hover effects for engagement
|
||||
```
|
||||
|
||||
### Developer Portfolio Specifics
|
||||
|
||||
What works for dev portfolios
|
||||
|
||||
**When to use**: When building developer portfolio
|
||||
|
||||
```javascript
|
||||
## Developer Portfolio
|
||||
|
||||
### What Hiring Managers Look For
|
||||
1. Code quality (GitHub link)
|
||||
2. Real projects (not just tutorials)
|
||||
3. Problem-solving ability
|
||||
4. Communication skills
|
||||
5. Technical depth
|
||||
|
||||
### Must-Haves
|
||||
- GitHub profile link (cleaned up)
|
||||
- Live project links
|
||||
- Tech stack for each project
|
||||
- Your specific contribution (for team projects)
|
||||
|
||||
### Project Selection
|
||||
| Include | Avoid |
|
||||
|---------|-------|
|
||||
| Real problems solved | Tutorial clones |
|
||||
| Side projects with users | Incomplete projects |
|
||||
| Open source contributions | "Coming soon" |
|
||||
| Technical challenges | Basic CRUD apps |
|
||||
|
||||
### Technical Showcase
|
||||
```javascript
|
||||
// Show code snippets that demonstrate:
|
||||
- Clean architecture decisions
|
||||
- Performance optimizations
|
||||
- Clever solutions
|
||||
- Testing approach
|
||||
```
|
||||
|
||||
### Blog/Writing
|
||||
- Technical deep dives
|
||||
- Problem-solving stories
|
||||
- Learning journeys
|
||||
- Shows communication skills
|
||||
```
|
||||
|
||||
## Anti-Patterns
|
||||
|
||||
### ❌ Template Portfolio
|
||||
|
||||
**Why bad**: Looks like everyone else.
|
||||
No memorable impression.
|
||||
Doesn't show creativity.
|
||||
Easy to forget.
|
||||
|
||||
**Instead**: Add personal touches.
|
||||
Custom design elements.
|
||||
Unique project presentations.
|
||||
Your voice in the copy.
|
||||
|
||||
### ❌ All Style No Substance
|
||||
|
||||
**Why bad**: Fancy animations, weak projects.
|
||||
Style over substance.
|
||||
Hiring managers see through it.
|
||||
No proof of skills.
|
||||
|
||||
**Instead**: Projects first, style second.
|
||||
Real work with real impact.
|
||||
Quality over quantity.
|
||||
Depth over breadth.
|
||||
|
||||
### ❌ Resume Website
|
||||
|
||||
**Why bad**: Boring, forgettable.
|
||||
Doesn't use the medium.
|
||||
No personality.
|
||||
Lists instead of stories.
|
||||
|
||||
**Instead**: Show, don't tell.
|
||||
Visual case studies.
|
||||
Interactive elements.
|
||||
Personality throughout.
|
||||
|
||||
## ⚠️ Sharp Edges
|
||||
|
||||
| Issue | Severity | Solution |
|
||||
|-------|----------|----------|
|
||||
| Portfolio more complex than your actual work | medium | ## Right-Sizing Your Portfolio |
|
||||
| Portfolio looks great on desktop, broken on mobile | high | ## Mobile-First Portfolio |
|
||||
| Visitors don't know what to do next | medium | ## Portfolio CTAs |
|
||||
| Portfolio shows old or irrelevant work | medium | ## Portfolio Freshness |
|
||||
|
||||
## Related Skills
|
||||
|
||||
Works well with: `scroll-experience`, `3d-web-experience`, `landing-page-design`, `personal-branding`
|
||||
@@ -1,241 +0,0 @@
|
||||
---
|
||||
name: prd
|
||||
description: "Generate a Product Requirements Document (PRD) for a new feature. Use when planning a feature, starting a new project, or when asked to create a PRD. Triggers on: create a prd, write prd for, plan this feature, requirements for, spec out."
|
||||
user-invocable: true
|
||||
---
|
||||
|
||||
# PRD Generator
|
||||
|
||||
Create detailed Product Requirements Documents that are clear, actionable, and suitable for implementation.
|
||||
|
||||
---
|
||||
|
||||
## The Job
|
||||
|
||||
1. Receive a feature description from the user
|
||||
2. Ask 3-5 essential clarifying questions (with lettered options)
|
||||
3. Generate a structured PRD based on answers
|
||||
4. Save to `tasks/prd-[feature-name].md`
|
||||
|
||||
**Important:** Do NOT start implementing. Just create the PRD.
|
||||
|
||||
---
|
||||
|
||||
## Step 1: Clarifying Questions
|
||||
|
||||
Ask only critical questions where the initial prompt is ambiguous. Focus on:
|
||||
|
||||
- **Problem/Goal:** What problem does this solve?
|
||||
- **Core Functionality:** What are the key actions?
|
||||
- **Scope/Boundaries:** What should it NOT do?
|
||||
- **Success Criteria:** How do we know it's done?
|
||||
|
||||
### Format Questions Like This:
|
||||
|
||||
```
|
||||
1. What is the primary goal of this feature?
|
||||
A. Improve user onboarding experience
|
||||
B. Increase user retention
|
||||
C. Reduce support burden
|
||||
D. Other: [please specify]
|
||||
|
||||
2. Who is the target user?
|
||||
A. New users only
|
||||
B. Existing users only
|
||||
C. All users
|
||||
D. Admin users only
|
||||
|
||||
3. What is the scope?
|
||||
A. Minimal viable version
|
||||
B. Full-featured implementation
|
||||
C. Just the backend/API
|
||||
D. Just the UI
|
||||
```
|
||||
|
||||
This lets users respond with "1A, 2C, 3B" for quick iteration. Remember to indent the options.
|
||||
|
||||
---
|
||||
|
||||
## Step 2: PRD Structure
|
||||
|
||||
Generate the PRD with these sections:
|
||||
|
||||
### 1. Introduction/Overview
|
||||
Brief description of the feature and the problem it solves.
|
||||
|
||||
### 2. Goals
|
||||
Specific, measurable objectives (bullet list).
|
||||
|
||||
### 3. User Stories
|
||||
Each story needs:
|
||||
- **Title:** Short descriptive name
|
||||
- **Description:** "As a [user], I want [feature] so that [benefit]"
|
||||
- **Acceptance Criteria:** Verifiable checklist of what "done" means
|
||||
|
||||
Each story should be small enough to implement in one focused session.
|
||||
|
||||
**Format:**
|
||||
```markdown
|
||||
### US-001: [Title]
|
||||
**Description:** As a [user], I want [feature] so that [benefit].
|
||||
|
||||
**Acceptance Criteria:**
|
||||
- [ ] Specific verifiable criterion
|
||||
- [ ] Another criterion
|
||||
- [ ] Typecheck/lint passes
|
||||
- [ ] **[UI stories only]** Verify in browser using dev-browser skill
|
||||
```
|
||||
|
||||
**Important:**
|
||||
- Acceptance criteria must be verifiable, not vague. "Works correctly" is bad. "Button shows confirmation dialog before deleting" is good.
|
||||
- **For any story with UI changes:** Always include "Verify in browser using dev-browser skill" as acceptance criteria. This ensures visual verification of frontend work.
|
||||
|
||||
### 4. Functional Requirements
|
||||
Numbered list of specific functionalities:
|
||||
- "FR-1: The system must allow users to..."
|
||||
- "FR-2: When a user clicks X, the system must..."
|
||||
|
||||
Be explicit and unambiguous.
|
||||
|
||||
### 5. Non-Goals (Out of Scope)
|
||||
What this feature will NOT include. Critical for managing scope.
|
||||
|
||||
### 6. Design Considerations (Optional)
|
||||
- UI/UX requirements
|
||||
- Link to mockups if available
|
||||
- Relevant existing components to reuse
|
||||
|
||||
### 7. Technical Considerations (Optional)
|
||||
- Known constraints or dependencies
|
||||
- Integration points with existing systems
|
||||
- Performance requirements
|
||||
|
||||
### 8. Success Metrics
|
||||
How will success be measured?
|
||||
- "Reduce time to complete X by 50%"
|
||||
- "Increase conversion rate by 10%"
|
||||
|
||||
### 9. Open Questions
|
||||
Remaining questions or areas needing clarification.
|
||||
|
||||
---
|
||||
|
||||
## Writing for Junior Developers
|
||||
|
||||
The PRD reader may be a junior developer or AI agent. Therefore:
|
||||
|
||||
- Be explicit and unambiguous
|
||||
- Avoid jargon or explain it
|
||||
- Provide enough detail to understand purpose and core logic
|
||||
- Number requirements for easy reference
|
||||
- Use concrete examples where helpful
|
||||
|
||||
---
|
||||
|
||||
## Output
|
||||
|
||||
- **Format:** Markdown (`.md`)
|
||||
- **Location:** `tasks/`
|
||||
- **Filename:** `prd-[feature-name].md` (kebab-case)
|
||||
|
||||
---
|
||||
|
||||
## Example PRD
|
||||
|
||||
```markdown
|
||||
# PRD: Task Priority System
|
||||
|
||||
## Introduction
|
||||
|
||||
Add priority levels to tasks so users can focus on what matters most. Tasks can be marked as high, medium, or low priority, with visual indicators and filtering to help users manage their workload effectively.
|
||||
|
||||
## Goals
|
||||
|
||||
- Allow assigning priority (high/medium/low) to any task
|
||||
- Provide clear visual differentiation between priority levels
|
||||
- Enable filtering and sorting by priority
|
||||
- Default new tasks to medium priority
|
||||
|
||||
## User Stories
|
||||
|
||||
### US-001: Add priority field to database
|
||||
**Description:** As a developer, I need to store task priority so it persists across sessions.
|
||||
|
||||
**Acceptance Criteria:**
|
||||
- [ ] Add priority column to tasks table: 'high' | 'medium' | 'low' (default 'medium')
|
||||
- [ ] Generate and run migration successfully
|
||||
- [ ] Typecheck passes
|
||||
|
||||
### US-002: Display priority indicator on task cards
|
||||
**Description:** As a user, I want to see task priority at a glance so I know what needs attention first.
|
||||
|
||||
**Acceptance Criteria:**
|
||||
- [ ] Each task card shows colored priority badge (red=high, yellow=medium, gray=low)
|
||||
- [ ] Priority visible without hovering or clicking
|
||||
- [ ] Typecheck passes
|
||||
- [ ] Verify in browser using dev-browser skill
|
||||
|
||||
### US-003: Add priority selector to task edit
|
||||
**Description:** As a user, I want to change a task's priority when editing it.
|
||||
|
||||
**Acceptance Criteria:**
|
||||
- [ ] Priority dropdown in task edit modal
|
||||
- [ ] Shows current priority as selected
|
||||
- [ ] Saves immediately on selection change
|
||||
- [ ] Typecheck passes
|
||||
- [ ] Verify in browser using dev-browser skill
|
||||
|
||||
### US-004: Filter tasks by priority
|
||||
**Description:** As a user, I want to filter the task list to see only high-priority items when I'm focused.
|
||||
|
||||
**Acceptance Criteria:**
|
||||
- [ ] Filter dropdown with options: All | High | Medium | Low
|
||||
- [ ] Filter persists in URL params
|
||||
- [ ] Empty state message when no tasks match filter
|
||||
- [ ] Typecheck passes
|
||||
- [ ] Verify in browser using dev-browser skill
|
||||
|
||||
## Functional Requirements
|
||||
|
||||
- FR-1: Add `priority` field to tasks table ('high' | 'medium' | 'low', default 'medium')
|
||||
- FR-2: Display colored priority badge on each task card
|
||||
- FR-3: Include priority selector in task edit modal
|
||||
- FR-4: Add priority filter dropdown to task list header
|
||||
- FR-5: Sort by priority within each status column (high to medium to low)
|
||||
|
||||
## Non-Goals
|
||||
|
||||
- No priority-based notifications or reminders
|
||||
- No automatic priority assignment based on due date
|
||||
- No priority inheritance for subtasks
|
||||
|
||||
## Technical Considerations
|
||||
|
||||
- Reuse existing badge component with color variants
|
||||
- Filter state managed via URL search params
|
||||
- Priority stored in database, not computed
|
||||
|
||||
## Success Metrics
|
||||
|
||||
- Users can change priority in under 2 clicks
|
||||
- High-priority tasks immediately visible at top of lists
|
||||
- No regression in task list performance
|
||||
|
||||
## Open Questions
|
||||
|
||||
- Should priority affect task ordering within a column?
|
||||
- Should we add keyboard shortcuts for priority changes?
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Checklist
|
||||
|
||||
Before saving the PRD:
|
||||
|
||||
- [ ] Asked clarifying questions with lettered options
|
||||
- [ ] Incorporated user's answers
|
||||
- [ ] User stories are small and specific
|
||||
- [ ] Functional requirements are numbered and unambiguous
|
||||
- [ ] Non-goals section defines clear boundaries
|
||||
- [ ] Saved to `tasks/prd-[feature-name].md`
|
||||
@@ -1,258 +0,0 @@
|
||||
---
|
||||
name: ralph
|
||||
description: "Convert PRDs to prd.json format for the Ralph autonomous agent system. Use when you have an existing PRD and need to convert it to Ralph's JSON format. Triggers on: convert this prd, turn this into ralph format, create prd.json from this, ralph json."
|
||||
user-invocable: true
|
||||
---
|
||||
|
||||
# Ralph PRD Converter
|
||||
|
||||
Converts existing PRDs to the prd.json format that Ralph uses for autonomous execution.
|
||||
|
||||
---
|
||||
|
||||
## The Job
|
||||
|
||||
Take a PRD (markdown file or text) and convert it to `prd.json` in your ralph directory.
|
||||
|
||||
---
|
||||
|
||||
## Output Format
|
||||
|
||||
```json
|
||||
{
|
||||
"project": "[Project Name]",
|
||||
"branchName": "ralph/[feature-name-kebab-case]",
|
||||
"description": "[Feature description from PRD title/intro]",
|
||||
"userStories": [
|
||||
{
|
||||
"id": "US-001",
|
||||
"title": "[Story title]",
|
||||
"description": "As a [user], I want [feature] so that [benefit]",
|
||||
"acceptanceCriteria": [
|
||||
"Criterion 1",
|
||||
"Criterion 2",
|
||||
"Typecheck passes"
|
||||
],
|
||||
"priority": 1,
|
||||
"passes": false,
|
||||
"notes": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Story Size: The Number One Rule
|
||||
|
||||
**Each story must be completable in ONE Ralph iteration (one context window).**
|
||||
|
||||
Ralph spawns a fresh Amp instance per iteration with no memory of previous work. If a story is too big, the LLM runs out of context before finishing and produces broken code.
|
||||
|
||||
### Right-sized stories:
|
||||
- Add a database column and migration
|
||||
- Add a UI component to an existing page
|
||||
- Update a server action with new logic
|
||||
- Add a filter dropdown to a list
|
||||
|
||||
### Too big (split these):
|
||||
- "Build the entire dashboard" - Split into: schema, queries, UI components, filters
|
||||
- "Add authentication" - Split into: schema, middleware, login UI, session handling
|
||||
- "Refactor the API" - Split into one story per endpoint or pattern
|
||||
|
||||
**Rule of thumb:** If you cannot describe the change in 2-3 sentences, it is too big.
|
||||
|
||||
---
|
||||
|
||||
## Story Ordering: Dependencies First
|
||||
|
||||
Stories execute in priority order. Earlier stories must not depend on later ones.
|
||||
|
||||
**Correct order:**
|
||||
1. Schema/database changes (migrations)
|
||||
2. Server actions / backend logic
|
||||
3. UI components that use the backend
|
||||
4. Dashboard/summary views that aggregate data
|
||||
|
||||
**Wrong order:**
|
||||
1. UI component (depends on schema that does not exist yet)
|
||||
2. Schema change
|
||||
|
||||
---
|
||||
|
||||
## Acceptance Criteria: Must Be Verifiable
|
||||
|
||||
Each criterion must be something Ralph can CHECK, not something vague.
|
||||
|
||||
### Good criteria (verifiable):
|
||||
- "Add `status` column to tasks table with default 'pending'"
|
||||
- "Filter dropdown has options: All, Active, Completed"
|
||||
- "Clicking delete shows confirmation dialog"
|
||||
- "Typecheck passes"
|
||||
- "Tests pass"
|
||||
|
||||
### Bad criteria (vague):
|
||||
- "Works correctly"
|
||||
- "User can do X easily"
|
||||
- "Good UX"
|
||||
- "Handles edge cases"
|
||||
|
||||
### Always include as final criterion:
|
||||
```
|
||||
"Typecheck passes"
|
||||
```
|
||||
|
||||
For stories with testable logic, also include:
|
||||
```
|
||||
"Tests pass"
|
||||
```
|
||||
|
||||
### For stories that change UI, also include:
|
||||
```
|
||||
"Verify in browser using dev-browser skill"
|
||||
```
|
||||
|
||||
Frontend stories are NOT complete until visually verified. Ralph will use the dev-browser skill to navigate to the page, interact with the UI, and confirm changes work.
|
||||
|
||||
---
|
||||
|
||||
## Conversion Rules
|
||||
|
||||
1. **Each user story becomes one JSON entry**
|
||||
2. **IDs**: Sequential (US-001, US-002, etc.)
|
||||
3. **Priority**: Based on dependency order, then document order
|
||||
4. **All stories**: `passes: false` and empty `notes`
|
||||
5. **branchName**: Derive from feature name, kebab-case, prefixed with `ralph/`
|
||||
6. **Always add**: "Typecheck passes" to every story's acceptance criteria
|
||||
|
||||
---
|
||||
|
||||
## Splitting Large PRDs
|
||||
|
||||
If a PRD has big features, split them:
|
||||
|
||||
**Original:**
|
||||
> "Add user notification system"
|
||||
|
||||
**Split into:**
|
||||
1. US-001: Add notifications table to database
|
||||
2. US-002: Create notification service for sending notifications
|
||||
3. US-003: Add notification bell icon to header
|
||||
4. US-004: Create notification dropdown panel
|
||||
5. US-005: Add mark-as-read functionality
|
||||
6. US-006: Add notification preferences page
|
||||
|
||||
Each is one focused change that can be completed and verified independently.
|
||||
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
**Input PRD:**
|
||||
```markdown
|
||||
# Task Status Feature
|
||||
|
||||
Add ability to mark tasks with different statuses.
|
||||
|
||||
## Requirements
|
||||
- Toggle between pending/in-progress/done on task list
|
||||
- Filter list by status
|
||||
- Show status badge on each task
|
||||
- Persist status in database
|
||||
```
|
||||
|
||||
**Output prd.json:**
|
||||
```json
|
||||
{
|
||||
"project": "TaskApp",
|
||||
"branchName": "ralph/task-status",
|
||||
"description": "Task Status Feature - Track task progress with status indicators",
|
||||
"userStories": [
|
||||
{
|
||||
"id": "US-001",
|
||||
"title": "Add status field to tasks table",
|
||||
"description": "As a developer, I need to store task status in the database.",
|
||||
"acceptanceCriteria": [
|
||||
"Add status column: 'pending' | 'in_progress' | 'done' (default 'pending')",
|
||||
"Generate and run migration successfully",
|
||||
"Typecheck passes"
|
||||
],
|
||||
"priority": 1,
|
||||
"passes": false,
|
||||
"notes": ""
|
||||
},
|
||||
{
|
||||
"id": "US-002",
|
||||
"title": "Display status badge on task cards",
|
||||
"description": "As a user, I want to see task status at a glance.",
|
||||
"acceptanceCriteria": [
|
||||
"Each task card shows colored status badge",
|
||||
"Badge colors: gray=pending, blue=in_progress, green=done",
|
||||
"Typecheck passes",
|
||||
"Verify in browser using dev-browser skill"
|
||||
],
|
||||
"priority": 2,
|
||||
"passes": false,
|
||||
"notes": ""
|
||||
},
|
||||
{
|
||||
"id": "US-003",
|
||||
"title": "Add status toggle to task list rows",
|
||||
"description": "As a user, I want to change task status directly from the list.",
|
||||
"acceptanceCriteria": [
|
||||
"Each row has status dropdown or toggle",
|
||||
"Changing status saves immediately",
|
||||
"UI updates without page refresh",
|
||||
"Typecheck passes",
|
||||
"Verify in browser using dev-browser skill"
|
||||
],
|
||||
"priority": 3,
|
||||
"passes": false,
|
||||
"notes": ""
|
||||
},
|
||||
{
|
||||
"id": "US-004",
|
||||
"title": "Filter tasks by status",
|
||||
"description": "As a user, I want to filter the list to see only certain statuses.",
|
||||
"acceptanceCriteria": [
|
||||
"Filter dropdown: All | Pending | In Progress | Done",
|
||||
"Filter persists in URL params",
|
||||
"Typecheck passes",
|
||||
"Verify in browser using dev-browser skill"
|
||||
],
|
||||
"priority": 4,
|
||||
"passes": false,
|
||||
"notes": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Archiving Previous Runs
|
||||
|
||||
**Before writing a new prd.json, check if there is an existing one from a different feature:**
|
||||
|
||||
1. Read the current `prd.json` if it exists
|
||||
2. Check if `branchName` differs from the new feature's branch name
|
||||
3. If different AND `progress.txt` has content beyond the header:
|
||||
- Create archive folder: `archive/YYYY-MM-DD-feature-name/`
|
||||
- Copy current `prd.json` and `progress.txt` to archive
|
||||
- Reset `progress.txt` with fresh header
|
||||
|
||||
**The ralph.sh script handles this automatically** when you run it, but if you are manually updating prd.json between runs, archive first.
|
||||
|
||||
---
|
||||
|
||||
## Checklist Before Saving
|
||||
|
||||
Before writing prd.json, verify:
|
||||
|
||||
- [ ] **Previous run archived** (if prd.json exists with different branchName, archive it first)
|
||||
- [ ] Each story is completable in one iteration (small enough)
|
||||
- [ ] Stories are ordered by dependency (schema to backend to UI)
|
||||
- [ ] Every story has "Typecheck passes" as criterion
|
||||
- [ ] UI stories have "Verify in browser using dev-browser skill" as criterion
|
||||
- [ ] Acceptance criteria are verifiable (not vague)
|
||||
- [ ] No story depends on a later story
|
||||
@@ -1,588 +0,0 @@
|
||||
{
|
||||
"project": "GP Clinical Record — Depth Enhancement",
|
||||
"branchName": "ralph/depth-enhancement",
|
||||
"description": "Add depth, interactivity, and rich content to the GP clinical record dashboard: slide-in detail panels, sub-navigation, expanded skills/KPI data, career constellation D3 visualization, and login refresh. Full spec in Ralph/depth-design.md, requirements in Ralph/depth-requirements.md, workflow in Ralph/workflow_depth.md.",
|
||||
"userStories": [
|
||||
{
|
||||
"id": "US-001",
|
||||
"title": "Clean up unused legacy components and hooks",
|
||||
"description": "As a developer, I need to remove all dead code from the previous PMR interface so the codebase is clean before adding new features. Delete all files listed below and verify no dead imports remain.",
|
||||
"acceptanceCriteria": [
|
||||
"Delete src/components/PMRInterface.tsx",
|
||||
"Delete src/components/PatientBanner.tsx",
|
||||
"Delete src/components/ClinicalSidebar.tsx",
|
||||
"Delete src/components/Breadcrumb.tsx",
|
||||
"Delete src/components/MobileBottomNav.tsx",
|
||||
"Delete all files in src/components/views/ directory (SummaryView, ConsultationsView, MedicationsView, ProblemsView, InvestigationsView, DocumentsView, ReferralsView) and remove the views/ directory",
|
||||
"Delete src/components/Contact.tsx, Education.tsx, Experience.tsx, FloatingNav.tsx, Footer.tsx, Hero.tsx, Projects.tsx, Skills.tsx (old portfolio components)",
|
||||
"Delete src/hooks/useScrollCondensation.ts",
|
||||
"Delete src/hooks/useActiveSection.ts (will be recreated in a later story)",
|
||||
"Delete src/hooks/useScrollReveal.ts if unused",
|
||||
"Verify no remaining files import any of the deleted files (fix any dead imports)",
|
||||
"npm run build succeeds with zero errors",
|
||||
"Typecheck passes"
|
||||
],
|
||||
"priority": 1,
|
||||
"passes": true,
|
||||
"notes": "Completed iteration 1 at 2026-02-13 22:57. Model: opus."
|
||||
},
|
||||
{
|
||||
"id": "US-002",
|
||||
"title": "Add new TypeScript types and CSS custom properties for depth features",
|
||||
"description": "As a developer, I need new types and CSS foundations that subsequent stories will use. Add types to src/types/pmr.ts and CSS variables + keyframes to src/index.css. See Ralph/depth-design.md Section 4 for type definitions and Section 9 for CSS.",
|
||||
"acceptanceCriteria": [
|
||||
"Add SkillCategory type: \u0027Technical\u0027 | \u0027Domain\u0027 | \u0027Leadership\u0027 to src/types/pmr.ts",
|
||||
"Add KPIStory interface with fields: context (string), role (string), outcomes (string[]), period (string optional) to src/types/pmr.ts",
|
||||
"Add optional story?: KPIStory field to existing KPI interface in src/types/pmr.ts",
|
||||
"Add ConstellationNode interface (id, type: \u0027role\u0027|\u0027skill\u0027, label, shortLabel?, organization?, startYear?, endYear?, orgColor?, domain?) to src/types/pmr.ts",
|
||||
"Add ConstellationLink interface (source, target, strength) to src/types/pmr.ts",
|
||||
"Add DetailPanelContent discriminated union type (kpi | skill | skills-all | consultation | project | education | career-role) to src/types/pmr.ts",
|
||||
"Add EducationExtra interface (documentId, extracurriculars?, researchDescription?, programmeDetail?) to src/types/pmr.ts",
|
||||
"Add CSS custom properties to :root in src/index.css: --subnav-height: 36px, --panel-narrow: 400px, --panel-wide: 60vw, --backdrop-blur: 4px, --backdrop-bg: rgba(26,43,42,0.15)",
|
||||
"Add @keyframes panel-slide-in (translateX 100% to 0), panel-slide-out (reverse), backdrop-fade-in (opacity 0 to 1) to src/index.css",
|
||||
"Add prefers-reduced-motion overrides for all new keyframes (instant, no transform/opacity change)",
|
||||
"Typecheck passes"
|
||||
],
|
||||
"priority": 2,
|
||||
"passes": true,
|
||||
"notes": "Completed iteration 2 at 2026-02-13 22:59. Model: sonnet."
|
||||
},
|
||||
{
|
||||
"id": "US-003",
|
||||
"title": "Create DetailPanelContext, DetailPanel component, and useFocusTrap hook",
|
||||
"description": "As a developer, I need the core detail panel infrastructure: a context for managing panel state, the slide-in panel component, and a focus trap hook. Create 3 new files. The panel renders placeholder content for now (real renderers come later). See Ralph/depth-design.md Sections 2.1, 2.2 for full interface specs.",
|
||||
"acceptanceCriteria": [
|
||||
"Create src/contexts/DetailPanelContext.tsx with DetailPanelProvider that manages: content (DetailPanelContent | null), openPanel, closePanel, isOpen",
|
||||
"Width mapping is deterministic from content.type: kpi/skill/skills-all/education → \u0027narrow\u0027 (var(--panel-narrow)), consultation/project/career-role → \u0027wide\u0027 (var(--panel-wide))",
|
||||
"Title mapping derives from content data (e.g., kpi → kpi.label, skill → skill.name, consultation → consultation.role)",
|
||||
"Create src/components/DetailPanel.tsx: full-screen backdrop (var(--backdrop-bg) + backdrop-filter: blur(var(--backdrop-blur))) with panel sliding from right",
|
||||
"Panel has header with X close button (lucide X icon), colored dot matching tile, and title text",
|
||||
"Panel body is scrollable and renders placeholder text showing content type",
|
||||
"Close triggers: backdrop click, Escape key, X button",
|
||||
"ARIA: aria-modal=true, role=dialog, aria-labelledby pointing to title",
|
||||
"Mobile (\u003c768px): both narrow and wide become 100vw",
|
||||
"prefers-reduced-motion: instant appear, no slide animation",
|
||||
"Create src/hooks/useFocusTrap.ts: useFocusTrap(containerRef, isActive) traps Tab/Shift+Tab within container when active, returns focus to previous element when deactivated",
|
||||
"DetailPanel uses useFocusTrap when open",
|
||||
"Typecheck passes",
|
||||
"Verify in browser using dev-browser skill"
|
||||
],
|
||||
"priority": 3,
|
||||
"passes": true,
|
||||
"notes": "Completed iteration 3 at 2026-02-13 23:03. Model: sonnet."
|
||||
},
|
||||
{
|
||||
"id": "US-004",
|
||||
"title": "Create SubNav component and useActiveSection hook",
|
||||
"description": "As a developer, I need a sticky sub-navigation bar below the TopBar for section jumping, plus a hook that tracks which section is visible. Create src/components/SubNav.tsx and src/hooks/useActiveSection.ts (the old one was deleted in cleanup). See Ralph/depth-design.md Section 2.3.",
|
||||
"acceptanceCriteria": [
|
||||
"Create src/components/SubNav.tsx with 5 sections: Overview (patient-summary), Skills (core-skills), Experience (career-activity), Projects (projects), Education (education)",
|
||||
"SubNav is sticky below TopBar (top: 48px, z-index: 99)",
|
||||
"Height 36px, background var(--surface), bottom border var(--border-light)",
|
||||
"Tabs: 13px font, weight 500, gap 24px, centered text",
|
||||
"Active tab: teal underline (2px) with 200ms slide transition, text color var(--accent)",
|
||||
"Inactive tabs: var(--text-secondary)",
|
||||
"Click scrolls smoothly to [data-tile-id=tileId] element",
|
||||
"Create src/hooks/useActiveSection.ts using IntersectionObserver to track visible tile by data-tile-id attribute",
|
||||
"Maps tile IDs to section IDs: patient-summary→overview, core-skills→skills, career-activity→experience, projects→projects, education→education",
|
||||
"SubNav accepts activeSection and onSectionClick props",
|
||||
"Typecheck passes",
|
||||
"Verify in browser using dev-browser skill"
|
||||
],
|
||||
"priority": 4,
|
||||
"passes": true,
|
||||
"notes": "Completed iteration 4 at 2026-02-13 23:06. Model: sonnet."
|
||||
},
|
||||
{
|
||||
"id": "US-005",
|
||||
"title": "Expand skills data from 5 to ~20 with three categories",
|
||||
"description": "As a developer, I need to expand src/data/skills.ts from 5 skills to ~21 skills across 3 categories. Source content from References/CV_v4.md Core Competencies. Each skill retains the medication metaphor (frequency, status, proficiency). See Ralph/depth-design.md Section 5.1 and Ralph/depth-requirements.md Section 4.4.",
|
||||
"acceptanceCriteria": [
|
||||
"src/data/skills.ts has ~21 SkillMedication entries",
|
||||
"Technical category (8): Data Analysis, Python, SQL, Power BI, JavaScript/TypeScript, Excel, Algorithm Design, Data Pipelines",
|
||||
"Healthcare Domain category (6): Medicines Optimisation, Population Health, NICE TA Implementation, Health Economics, Clinical Pathways, Controlled Drugs",
|
||||
"Strategic \u0026 Leadership category (7): Budget Management, Stakeholder Engagement, Pharmaceutical Negotiation, Team Development, Change Management, Financial Modelling, Executive Communication",
|
||||
"Each skill has: id (kebab-case), name, frequency (medication-style: Daily, Twice daily, Once weekly, When required, etc.), startYear, yearsOfExperience, proficiency (0-100), category, status (Active/Historical), icon (lucide icon name)",
|
||||
"Frequency and proficiency values are realistic based on CV_v4.md role descriptions",
|
||||
"Typecheck passes"
|
||||
],
|
||||
"priority": 5,
|
||||
"passes": true,
|
||||
"notes": "Completed iteration 5 at 2026-02-13 23:08. Model: sonnet."
|
||||
},
|
||||
{
|
||||
"id": "US-006",
|
||||
"title": "Add KPI story data and update 4th KPI",
|
||||
"description": "As a developer, I need to add rich story content to each KPI in src/data/kpis.ts for the detail panel, and change the 4th KPI from \u002712 Team Size Led\u0027 to \u00271.2M Population served\u0027. Source from References/CV_v4.md. See Ralph/depth-design.md Section 5.2.",
|
||||
"acceptanceCriteria": [
|
||||
"Change 4th KPI from {id:\u0027team\u0027, value:\u002712\u0027, label:\u0027Team Size Led\u0027} to {id:\u0027population\u0027, value:\u00271.2M\u0027, label:\u0027Population Served\u0027, sub:\u0027Norfolk \u0026 Waveney ICS\u0027, colorVariant:\u0027teal\u0027}",
|
||||
"Add story field (KPIStory) to all 4 KPIs with: context, role, outcomes[], period",
|
||||
"£220M story: context about ICB prescribing budget for 1.2M population, role about forecasting models and ICB board accountability, outcomes about proactive financial planning",
|
||||
"£14.6M story: context about efficiency programme, role about data analysis identification, outcomes about over-target performance",
|
||||
"9+ Years story: context about career span Aug 2016-present, role about progression from community pharmacy to system-level leadership",
|
||||
"1.2M story: context about Norfolk \u0026 Waveney ICS population, role about population health analytics and data-driven decision making",
|
||||
"Add explanation field to 4th KPI matching the story context",
|
||||
"Typecheck passes"
|
||||
],
|
||||
"priority": 6,
|
||||
"passes": true,
|
||||
"notes": "Completed iteration 6 at 2026-02-13 23:10. Model: sonnet."
|
||||
},
|
||||
{
|
||||
"id": "US-007",
|
||||
"title": "Create education extras data file",
|
||||
"description": "As a developer, I need src/data/educationExtras.ts with expanded detail for the education detail panel. Source from References/CV_v4.md Education section. See Ralph/depth-design.md Section 5.4.",
|
||||
"acceptanceCriteria": [
|
||||
"Create src/data/educationExtras.ts exporting educationExtras array of EducationExtra objects",
|
||||
"MPharm entry (documentId matching doc-mpharm or equivalent from documents.ts): extracurriculars [\u0027President of UEA Pharmacy Society\u0027, \u0027Secretary \u0026 Vice-President of UEA Ultimate Frisbee\u0027, \u0027Publicity Officer for UEA Alzheimer\\\u0027s Society\u0027], researchDescription about cocrystal formation for drug delivery",
|
||||
"Mary Seacole entry: programmeDetail about NHS leadership qualification, change management, healthcare leadership, system-level thinking",
|
||||
"Document IDs match those used in src/data/documents.ts",
|
||||
"Typecheck passes"
|
||||
],
|
||||
"priority": 7,
|
||||
"passes": true,
|
||||
"notes": "Completed iteration 7 at 2026-02-13 23:11. Model: sonnet."
|
||||
},
|
||||
{
|
||||
"id": "US-008",
|
||||
"title": "Restructure DashboardLayout with SubNav, new tile order, and DetailPanel",
|
||||
"description": "As a developer, I need to update DashboardLayout.tsx to: wrap with DetailPanelProvider, add SubNav between TopBar and content, reorder tiles per the new layout, render DetailPanel, and adjust spacing. See Ralph/depth-design.md Section 3.1.",
|
||||
"acceptanceCriteria": [
|
||||
"DashboardLayout (or App.tsx) wraps content with DetailPanelProvider from DetailPanelContext",
|
||||
"SubNav renders between TopBar and the flex container",
|
||||
"Content area marginTop accounts for both TopBar and SubNav: calc(var(--topbar-height) + var(--subnav-height))",
|
||||
"Tile order: PatientSummaryTile (full), LatestResultsTile (half) + ProjectsTile (half) side-by-side, CoreSkillsTile (full), LastConsultationTile (full), CareerActivityTile (full), EducationTile (full)",
|
||||
"DetailPanel component renders alongside CommandPalette",
|
||||
"SubNav activeSection state managed via useActiveSection hook",
|
||||
"All tiles have data-tile-id attributes (Card tileId prop)",
|
||||
"Typecheck passes",
|
||||
"Verify in browser using dev-browser skill"
|
||||
],
|
||||
"priority": 8,
|
||||
"passes": true,
|
||||
"notes": "Completed iteration 8 at 2026-02-13 23:15. Model: sonnet."
|
||||
},
|
||||
{
|
||||
"id": "US-009",
|
||||
"title": "Create constellation data mapping file",
|
||||
"description": "As a developer, I need src/data/constellation.ts defining the role-skill mapping for the D3 career constellation graph. Maps 6 career roles to their associated skills with connection strengths. See Ralph/depth-design.md Section 5.3 and 2.4.",
|
||||
"acceptanceCriteria": [
|
||||
"Create src/data/constellation.ts with RoleSkillMapping interface (roleId: string, skillIds: string[])",
|
||||
"Export roleSkillMappings array mapping 6 roles to skill IDs from skills.ts",
|
||||
"Roles: pre-reg-pharmacist-2015, duty-pharmacy-manager-2016, pharmacy-manager-2017, hcd-pharmacist-2022, deputy-head-2024, interim-head-2025 (IDs should match or reference consultation IDs from consultations.ts)",
|
||||
"Export constellationNodes array of ConstellationNode objects for all role nodes (with organization, startYear, endYear, orgColor) and skill nodes (with domain)",
|
||||
"Export constellationLinks array of ConstellationLink objects connecting skills to roles with strength values (0-1)",
|
||||
"Role orgColors: Paydens gets one color, Tesco another, NHS another (use distinct teal/blue/green tones)",
|
||||
"Typecheck passes"
|
||||
],
|
||||
"priority": 9,
|
||||
"passes": true,
|
||||
"notes": "Completed iteration 9 at 2026-02-13 23:17. Model: sonnet."
|
||||
},
|
||||
{
|
||||
"id": "US-010",
|
||||
"title": "Modify LatestResultsTile: remove flip, bigger numbers, panel trigger",
|
||||
"description": "As a developer, I need to redesign the KPI cards in LatestResultsTile.tsx: remove the CSS flip animation, make headline numbers larger and bolder, and make each card clickable to open the detail panel. See Ralph/depth-design.md Section 3.5.",
|
||||
"acceptanceCriteria": [
|
||||
"Remove flip card animation entirely (no more .metric-card, .metric-card-inner, .metric-card-front, .metric-card-back CSS classes from index.css if they exist)",
|
||||
"Each KPI renders as a clickable button/card with: value at 28-32px font-size, weight 700, colored by kpi.colorVariant",
|
||||
"Label at 12px, weight 500, color var(--text-primary), marginTop 4px",
|
||||
"Sub-text at 10px, font-family var(--font-geist-mono), color var(--text-tertiary), marginTop 2px",
|
||||
"Click calls openPanel({ type: \u0027kpi\u0027, kpi }) from DetailPanelContext",
|
||||
"Hover: border color shift + shadow deepens (transition 150ms)",
|
||||
"Keyboard: Enter/Space triggers panel open",
|
||||
"Card styling: padding 16px, background var(--surface), border 1px solid var(--border-light), border-radius var(--radius-sm)",
|
||||
"Typecheck passes",
|
||||
"Verify in browser using dev-browser skill"
|
||||
],
|
||||
"priority": 10,
|
||||
"passes": true,
|
||||
"notes": "Completed iteration 10 at 2026-02-13. Model: opus. Manually marked passed (script hung after story-complete signal)."
|
||||
},
|
||||
{
|
||||
"id": "US-011",
|
||||
"title": "Modify CoreSkillsTile: full width, categorised groups, panel triggers",
|
||||
"description": "As a developer, I need to redesign CoreSkillsTile.tsx as full-width with skills grouped by 3 categories, showing top 3-4 per category with \u0027view all\u0027 buttons. Individual skills and \u0027view all\u0027 trigger the detail panel. See Ralph/depth-design.md Section 3.4.",
|
||||
"acceptanceCriteria": [
|
||||
"Card uses full prop (spans both grid columns)",
|
||||
"Skills grouped by category: Technical, Healthcare Domain (Domain), Strategic \u0026 Leadership (Leadership)",
|
||||
"Each category has a header: thin divider line with category label (styled like sidebar section dividers: 10px, uppercase, var(--text-tertiary))",
|
||||
"Show top 3-4 skills per category on the dashboard tile (sorted by proficiency or relevance)",
|
||||
"Each skill row is clickable → openPanel({ type: \u0027skill\u0027, skill }) from DetailPanelContext",
|
||||
"Each category with \u003e4 skills shows a \u0027View all (N)\u0027 button → openPanel({ type: \u0027skills-all\u0027, category })",
|
||||
"Retain medication metaphor display (frequency, status badge)",
|
||||
"Remove old single-expand accordion for skills (replaced by panel)",
|
||||
"Typecheck passes",
|
||||
"Verify in browser using dev-browser skill"
|
||||
],
|
||||
"priority": 11,
|
||||
"passes": true,
|
||||
"notes": "Completed iteration 1 at 2026-02-13 23:50. Model: opus."
|
||||
},
|
||||
{
|
||||
"id": "US-012",
|
||||
"title": "Modify ProjectsTile: half width, compact card grid, panel trigger",
|
||||
"description": "As a developer, I need to change ProjectsTile.tsx from full-width to half-width (positioned alongside LatestResultsTile by the layout reorder in US-008). Compact cards with click to open detail panel. See Ralph/depth-design.md Section 3.6.",
|
||||
"acceptanceCriteria": [
|
||||
"Remove full prop from Card (half-width, single grid column)",
|
||||
"Compact project cards: status dot + name + year (right-aligned) per row",
|
||||
"Tech stack shown as small inline tags",
|
||||
"Each project card clickable → openPanel({ type: \u0027project\u0027, investigation }) from DetailPanelContext",
|
||||
"Remove old in-place expansion (replaced by panel)",
|
||||
"Hover: border color shift, shadow deepens",
|
||||
"Typecheck passes",
|
||||
"Verify in browser using dev-browser skill"
|
||||
],
|
||||
"priority": 12,
|
||||
"passes": true,
|
||||
"notes": "Completed iteration 2 at 2026-02-13 23:52. Model: sonnet."
|
||||
},
|
||||
{
|
||||
"id": "US-013",
|
||||
"title": "Modify LastConsultationTile: add panel trigger",
|
||||
"description": "As a developer, I need to add a \u0027View full record\u0027 button to LastConsultationTile.tsx that opens the detail panel with full role details. See Ralph/depth-design.md Section 3.9.",
|
||||
"acceptanceCriteria": [
|
||||
"Add \u0027View full record\u0027 link/button at the bottom of the tile",
|
||||
"Click → openPanel({ type: \u0027consultation\u0027, consultation }) from DetailPanelContext, passing the first consultation entry",
|
||||
"Make the tile header area also clickable (opens same panel)",
|
||||
"Keep existing inline content (header info row, achievement bullets)",
|
||||
"Hover state on clickable areas",
|
||||
"Typecheck passes",
|
||||
"Verify in browser using dev-browser skill"
|
||||
],
|
||||
"priority": 13,
|
||||
"passes": true,
|
||||
"notes": "Completed iteration 3 at 2026-02-13 23:55. Model: sonnet."
|
||||
},
|
||||
{
|
||||
"id": "US-014",
|
||||
"title": "Modify CareerActivityTile: panel triggers and hover preview",
|
||||
"description": "As a developer, I need to change CareerActivityTile.tsx so timeline items click to open the detail panel instead of expanding in-place, and add hover previews. See Ralph/depth-design.md Section 3.7.",
|
||||
"acceptanceCriteria": [
|
||||
"Role timeline items click → openPanel({ type: \u0027career-role\u0027, consultation }) from DetailPanelContext",
|
||||
"Remove in-place accordion expansion for career items (replaced by panel)",
|
||||
"Hover preview: items lift slightly on hover with shadow deepens, show 1-2 lines of preview text",
|
||||
"Keep color-coded dots and entry type styling (teal roles, amber projects, green certs, purple education)",
|
||||
"Reserve a container/placeholder for CareerConstellation component (will be added later)",
|
||||
"Typecheck passes",
|
||||
"Verify in browser using dev-browser skill"
|
||||
],
|
||||
"priority": 14,
|
||||
"passes": true,
|
||||
"notes": "Completed iteration 4 at 2026-02-13 23:58. Model: sonnet."
|
||||
},
|
||||
{
|
||||
"id": "US-015",
|
||||
"title": "Modify EducationTile: richer content, panel trigger",
|
||||
"description": "As a developer, I need to enhance EducationTile.tsx with richer inline content and click-to-panel interaction. See Ralph/depth-design.md Section 3.8.",
|
||||
"acceptanceCriteria": [
|
||||
"Show richer inline content: MPharm research project score (75.1%), OSCE score (80%), A-level grades (A* Maths, B Chemistry, C Politics)",
|
||||
"Each education entry is clickable → openPanel({ type: \u0027education\u0027, document }) from DetailPanelContext",
|
||||
"Hover: border color shift on clickable entries",
|
||||
"Use education extras data from src/data/educationExtras.ts for inline detail where appropriate",
|
||||
"Typecheck passes",
|
||||
"Verify in browser using dev-browser skill"
|
||||
],
|
||||
"priority": 15,
|
||||
"passes": true,
|
||||
"notes": "Completed iteration 4 at 2026-02-14 00:33. Model: sonnet."
|
||||
},
|
||||
{
|
||||
"id": "US-016",
|
||||
"title": "Modify PatientSummaryTile: structured presentation with highlight strip",
|
||||
"description": "As a developer, I need to improve PatientSummaryTile.tsx with the full CV_v4.md profile text and a visual highlight strip. See Ralph/depth-design.md Section 3.10 and Ralph/depth-requirements.md Section 4.1.",
|
||||
"acceptanceCriteria": [
|
||||
"Verify src/data/profile.ts has the complete profile text from References/CV_v4.md (update if needed)",
|
||||
"Add a visual highlight strip showing key stats: e.g. \u00279+ Years Experience\u0027, \u00271.2M Population\u0027, \u0027£220M Budget\u0027 as small styled badges or pills",
|
||||
"Profile text is not a wall of text — use hierarchy: bold key phrases, structured paragraphs if needed",
|
||||
"Typecheck passes",
|
||||
"Verify in browser using dev-browser skill"
|
||||
],
|
||||
"priority": 16,
|
||||
"passes": true,
|
||||
"notes": ""
|
||||
},
|
||||
{
|
||||
"id": "US-017",
|
||||
"title": "Create KPIDetail renderer for detail panel",
|
||||
"description": "As a developer, I need src/components/detail/KPIDetail.tsx that renders rich KPI story content inside the detail panel. Wire it into DetailPanel so content.type === \u0027kpi\u0027 renders this component. See Ralph/depth-design.md Section 6.1.",
|
||||
"acceptanceCriteria": [
|
||||
"Create src/components/detail/KPIDetail.tsx accepting a KPI prop",
|
||||
"Renders: headline number (large, colored by kpi.colorVariant), context paragraph (story.context), \u0027Your role\u0027 paragraph (story.role), outcome bullets (story.outcomes), period badge (story.period)",
|
||||
"Graceful fallback if story is undefined (show kpi.explanation instead)",
|
||||
"Wire into DetailPanel: when content.type === \u0027kpi\u0027, render \u003cKPIDetail kpi={content.kpi} /\u003e",
|
||||
"Styling matches dashboard design system (fonts, colors, spacing)",
|
||||
"Typecheck passes",
|
||||
"Verify in browser using dev-browser skill"
|
||||
],
|
||||
"priority": 17,
|
||||
"passes": true,
|
||||
"notes": ""
|
||||
},
|
||||
{
|
||||
"id": "US-018",
|
||||
"title": "Create ConsultationDetail renderer for detail panel",
|
||||
"description": "As a developer, I need src/components/detail/ConsultationDetail.tsx for displaying full role details in the detail panel. Used for both \u0027consultation\u0027 and \u0027career-role\u0027 content types. See Ralph/depth-design.md Section 6.4.",
|
||||
"acceptanceCriteria": [
|
||||
"Create src/components/detail/ConsultationDetail.tsx accepting a Consultation prop",
|
||||
"Renders: role title + organization + dates, history paragraph (consultation.history), achievement bullets (consultation.examination), plan/outcomes (consultation.plan), coded entries as badges (consultation.codedEntries)",
|
||||
"Wire into DetailPanel: content.type === \u0027consultation\u0027 or \u0027career-role\u0027 renders this component",
|
||||
"Styled consistently with dashboard design system",
|
||||
"Typecheck passes",
|
||||
"Verify in browser using dev-browser skill"
|
||||
],
|
||||
"priority": 18,
|
||||
"passes": true,
|
||||
"notes": "Already implemented by prior iteration. Component exists with full content, wired into DetailPanel for consultation and career-role types."
|
||||
},
|
||||
{
|
||||
"id": "US-019",
|
||||
"title": "Create ProjectDetail renderer for detail panel",
|
||||
"description": "As a developer, I need src/components/detail/ProjectDetail.tsx for displaying full project information in the wide detail panel. See Ralph/depth-design.md Section 6.5.",
|
||||
"acceptanceCriteria": [
|
||||
"Create src/components/detail/ProjectDetail.tsx accepting an Investigation prop",
|
||||
"Renders: project name + year + status badge, methodology description, tech stack as tags, results bullets, external link button (if investigation.externalUrl exists, opens in new tab)",
|
||||
"Wire into DetailPanel: content.type === \u0027project\u0027 renders this component",
|
||||
"External link uses rel=\u0027noopener noreferrer\u0027",
|
||||
"Typecheck passes",
|
||||
"Verify in browser using dev-browser skill"
|
||||
],
|
||||
"priority": 19,
|
||||
"passes": true,
|
||||
"notes": ""
|
||||
},
|
||||
{
|
||||
"id": "US-020",
|
||||
"title": "Create SkillDetail renderer for detail panel",
|
||||
"description": "As a developer, I need src/components/detail/SkillDetail.tsx for displaying individual skill detail in the narrow detail panel. See Ralph/depth-design.md Section 6.2.",
|
||||
"acceptanceCriteria": [
|
||||
"Create src/components/detail/SkillDetail.tsx accepting a SkillMedication prop",
|
||||
"Renders: skill name + frequency + status badge, visual proficiency bar (0-100%), years of experience, category label",
|
||||
"If constellation data is available, show \u0027Used in\u0027 section listing roles that used this skill (import from src/data/constellation.ts)",
|
||||
"Wire into DetailPanel: content.type === \u0027skill\u0027 renders this component",
|
||||
"Typecheck passes",
|
||||
"Verify in browser using dev-browser skill"
|
||||
],
|
||||
"priority": 20,
|
||||
"passes": true,
|
||||
"notes": "Completed. Component renders skill header with frequency/status badges, category label, proficiency bar (color-coded), years of experience, and 'Used in' section from constellation data."
|
||||
},
|
||||
{
|
||||
"id": "US-021",
|
||||
"title": "Create SkillsAllDetail renderer for detail panel",
|
||||
"description": "As a developer, I need src/components/detail/SkillsAllDetail.tsx showing the full categorised list of all skills. Clicking an individual skill switches the panel to SkillDetail. See Ralph/depth-design.md Section 6.3.",
|
||||
"acceptanceCriteria": [
|
||||
"Create src/components/detail/SkillsAllDetail.tsx",
|
||||
"Shows full list grouped by Technical / Healthcare Domain / Strategic \u0026 Leadership",
|
||||
"Category headers styled consistently with CoreSkillsTile category headers",
|
||||
"Each skill row is clickable → calls openPanel({ type: \u0027skill\u0027, skill }) to switch panel content",
|
||||
"If opened with a category filter (content.category), scroll to or highlight that category",
|
||||
"Wire into DetailPanel: content.type === \u0027skills-all\u0027 renders this component",
|
||||
"Typecheck passes",
|
||||
"Verify in browser using dev-browser skill"
|
||||
],
|
||||
"priority": 21,
|
||||
"passes": true,
|
||||
"notes": "Completed. Full categorised skill list with category headers matching CoreSkillsTile style, proficiency mini-bars, click-to-skill-detail navigation, and category scroll/highlight from filter."
|
||||
},
|
||||
{
|
||||
"id": "US-022",
|
||||
"title": "Create EducationDetail renderer for detail panel",
|
||||
"description": "As a developer, I need src/components/detail/EducationDetail.tsx for displaying full education details including extras. See Ralph/depth-design.md Section 6.6.",
|
||||
"acceptanceCriteria": [
|
||||
"Create src/components/detail/EducationDetail.tsx accepting a Document prop",
|
||||
"Renders: title + institution + dates + classification",
|
||||
"Imports educationExtras from src/data/educationExtras.ts and finds matching extra by document ID",
|
||||
"If MPharm: shows research project description, extracurricular activities list",
|
||||
"If Mary Seacole: shows programme detail",
|
||||
"Shows notes from document data if present",
|
||||
"Wire into DetailPanel: content.type === \u0027education\u0027 renders this component",
|
||||
"Typecheck passes",
|
||||
"Verify in browser using dev-browser skill"
|
||||
],
|
||||
"priority": 22,
|
||||
"passes": true,
|
||||
"notes": "Completed. Renders title + icon + institution + dates + classification badge. Shows research description, OSCE score, extracurriculars (MPharm), programme detail (Mary Seacole), and notes."
|
||||
},
|
||||
{
|
||||
"id": "US-023",
|
||||
"title": "Install D3 and scaffold CareerConstellation component",
|
||||
"description": "As a developer, I need to install d3 as a dependency and create a scaffolded CareerConstellation component with an SVG container. See Ralph/depth-design.md Section 2.4.",
|
||||
"acceptanceCriteria": [
|
||||
"Run npm install d3 @types/d3",
|
||||
"Create src/components/CareerConstellation.tsx with props: onRoleClick(id: string), onSkillClick(id: string)",
|
||||
"Component renders a responsive SVG container using useRef\u003cSVGSVGElement\u003e",
|
||||
"Container: full width, height 400px desktop / 300px tablet / 250px mobile (use CSS or media queries)",
|
||||
"SVG has viewBox for responsive scaling",
|
||||
"Import constellation data from src/data/constellation.ts",
|
||||
"Subtle radial gradient background from var(--bg-dashboard) center to var(--surface) edge",
|
||||
"Typecheck passes",
|
||||
"Verify in browser using dev-browser skill"
|
||||
],
|
||||
"priority": 23,
|
||||
"passes": true,
|
||||
"notes": "Completed. D3 + @types/d3 installed. CareerConstellation scaffold with responsive SVG container (400/300/250px), radial gradient bg, ResizeObserver, callbacks ref for future D3 wiring."
|
||||
},
|
||||
{
|
||||
"id": "US-024",
|
||||
"title": "Build D3 force-directed graph rendering in CareerConstellation",
|
||||
"description": "As a developer, I need the D3 force simulation to render role and skill nodes with links in the CareerConstellation component. D3 operates imperatively via useEffect on the SVG ref. See Ralph/depth-design.md Section 2.4 for exact force configuration.",
|
||||
"acceptanceCriteria": [
|
||||
"D3 force simulation with: forceManyBody(-200), forceLink(distance 80, strength from data), forceX chronological (roles positioned left-to-right by startYear), forceY centered, forceCollide(30)",
|
||||
"Role nodes: 24px radius circles, filled with orgColor, white text label",
|
||||
"Skill nodes: 10px radius, color-coded by domain: clinical=var(--success), technical=var(--accent), leadership=var(--amber)",
|
||||
"Links: thin lines (1px), var(--border) color, opacity 0.3",
|
||||
"D3 integration: useEffect on SVG ref, no React state for node positions",
|
||||
"Simulation runs and nodes settle into stable positions",
|
||||
"Typecheck passes",
|
||||
"Verify in browser using dev-browser skill"
|
||||
],
|
||||
"priority": 24,
|
||||
"passes": true,
|
||||
"notes": "Completed. D3 force simulation with forceManyBody(-200), forceLink(dist 80, strength from data), forceX chronological, forceY centered, forceCollide. Role nodes 24px with orgColor + white labels, skill nodes 10px color-coded by domain, links 1px opacity 0.3."
|
||||
},
|
||||
{
|
||||
"id": "US-025",
|
||||
"title": "Add accessibility to CareerConstellation",
|
||||
"description": "As a developer, I need the CareerConstellation to be accessible: keyboard navigable, screen-reader friendly, and respecting reduced motion. See Ralph/depth-design.md Section 2.4 accessibility notes.",
|
||||
"acceptanceCriteria": [
|
||||
"SVG has role=img and aria-label describing the graph (\u0027Career constellation showing roles and skills across career timeline\u0027)",
|
||||
"Screen-reader-only text description of graph structure (hidden visually, available to assistive tech)",
|
||||
"Keyboard navigation: Tab through role nodes, Enter/Space opens detail panel for focused node",
|
||||
"Focus indicators visible on keyboard-focused nodes",
|
||||
"prefers-reduced-motion: disable force simulation animation, render nodes at calculated static positions immediately",
|
||||
"Typecheck passes"
|
||||
],
|
||||
"priority": 25,
|
||||
"passes": true,
|
||||
"notes": "Completed. SR-only description with role-skill mappings, hidden focusable buttons for keyboard nav (Tab/Enter/Space), focus ring on SVG nodes, prefers-reduced-motion runs simulation synchronously to static positions."
|
||||
},
|
||||
{
|
||||
"id": "US-026",
|
||||
"title": "Add hover and click interactions to CareerConstellation",
|
||||
"description": "As a developer, I need hover highlighting and click-to-panel interactions on the CareerConstellation. This connects the graph to the detail panel system. See Ralph/depth-design.md Section 2.4.",
|
||||
"acceptanceCriteria": [
|
||||
"Hover role node: connected skill nodes scale up, links brighten to var(--accent), non-connected nodes fade to 0.15 opacity",
|
||||
"Hover skill node: all connected role nodes highlight, link paths illuminate",
|
||||
"Click role node: calls onRoleClick(id) prop",
|
||||
"Click skill node: calls onSkillClick(id) prop",
|
||||
"Integrate into CareerActivityTile: wire onRoleClick to open ConsultationDetail panel, onSkillClick to open SkillDetail panel",
|
||||
"Typecheck passes",
|
||||
"Verify in browser using dev-browser skill"
|
||||
],
|
||||
"priority": 26,
|
||||
"passes": true,
|
||||
"notes": "Completed. D3 hover: connected nodes stay full opacity, non-connected fade to 0.15, links brighten to teal. Click: role→onRoleClick, skill→onSkillClick. Wired into CareerActivityTile replacing placeholder, connected to detail panel."
|
||||
},
|
||||
{
|
||||
"id": "US-027",
|
||||
"title": "Restyle LoginScreen with teal accents",
|
||||
"description": "As a developer, I need to visually refresh the LoginScreen with teal accents replacing the current blue. See Ralph/depth-design.md Section 3.3 and Ralph/depth-requirements.md Section 5.",
|
||||
"acceptanceCriteria": [
|
||||
"Replace #005EB8 with #0D6E6E throughout LoginScreen (shield icon bg, active field border, cursor, button)",
|
||||
"Replace #004D9F with #0A8080 (button hover state)",
|
||||
"Replace #004494 with #085858 (button pressed state)",
|
||||
"Background color: keep #1E293B or change to #1A2B2A",
|
||||
"Login card feels cohesive with the dashboard teal palette",
|
||||
"Typecheck passes",
|
||||
"Verify in browser using dev-browser skill"
|
||||
],
|
||||
"priority": 27,
|
||||
"passes": true,
|
||||
"notes": "Completed. Replaced #005EB8→#0D6E6E, #004D9F→#0A8080, #004494→#085858, background #1E293B→#1A2B2A, shield rgba updated."
|
||||
},
|
||||
{
|
||||
"id": "US-028",
|
||||
"title": "Change login username to a.recruiter and add connection status indicator",
|
||||
"description": "As a developer, I need to change the typed username from a.charlwood to a.recruiter and add a connection status indicator below the login button. See Ralph/depth-design.md Section 3.3.",
|
||||
"acceptanceCriteria": [
|
||||
"Username typed in login animation is \u0027a.recruiter\u0027 (not \u0027A.CHARLWOOD\u0027 or similar)",
|
||||
"Connection status indicator appears below the login button: 6px dot + text",
|
||||
"Initial state: red/alert dot + \u0027Awaiting secure connection...\u0027 (var(--alert) color)",
|
||||
"After ~2000ms: dot transitions to green + \u0027Secure connection established\u0027 (var(--success) color, 300ms transition)",
|
||||
"Text: 10px, font-family var(--font-geist-mono), color var(--text-tertiary)",
|
||||
"Login button disabled until BOTH typing is complete AND connectionState === \u0027connected\u0027",
|
||||
"Typecheck passes",
|
||||
"Verify in browser using dev-browser skill"
|
||||
],
|
||||
"priority": 28,
|
||||
"passes": true,
|
||||
"notes": "Completed. Username changed to a.recruiter, connection status indicator with red→green 300ms transition, button disabled until typing complete AND connected."
|
||||
},
|
||||
{
|
||||
"id": "US-029",
|
||||
"title": "Add post-login loading state and update TopBar session name",
|
||||
"description": "As a developer, I need a brief loading state after clicking the login button before the dashboard appears, and the TopBar should show A.RECRUITER as the session user. See Ralph/depth-design.md Sections 3.3 and 3.2.",
|
||||
"acceptanceCriteria": [
|
||||
"On login button click: isLoading=true, card content replaced with spinner + \u0027Loading clinical records...\u0027 text",
|
||||
"Loading state lasts ~600ms, then calls onComplete() to transition to dashboard",
|
||||
"Spinner is a CSS-animated spinner (not a GIF), styled with var(--accent) or similar",
|
||||
"Loading text: 12px, color var(--text-secondary)",
|
||||
"In TopBar.tsx: change session display name from \u0027Dr. A.CHARLWOOD\u0027 (or current value) to \u0027A.RECRUITER\u0027",
|
||||
"Typecheck passes",
|
||||
"Verify in browser using dev-browser skill"
|
||||
],
|
||||
"priority": 29,
|
||||
"passes": true,
|
||||
"notes": "Completed. Loading state with CSS spinner replaces card content on login click (~600ms), TopBar shows A.RECRUITER, prefers-reduced-motion skips spinner animation."
|
||||
},
|
||||
{
|
||||
"id": "US-030",
|
||||
"title": "Update CommandPalette for expanded content and panel actions",
|
||||
"description": "As a developer, I need to update the CommandPalette search index and actions to work with the expanded skills data (~20 skills) and add actions that open the detail panel directly. See Ralph/depth-design.md Section 10, Phase 6.",
|
||||
"acceptanceCriteria": [
|
||||
"Search index in src/lib/search.ts includes all ~21 skills (not just the original 5)",
|
||||
"Selecting a skill result opens the detail panel for that skill (openPanel call or dispatch event)",
|
||||
"Selecting a KPI result opens the KPI detail panel",
|
||||
"Selecting a project result opens the project detail panel",
|
||||
"Ensure DashboardLayout handlePaletteAction supports a new \u0027panel\u0027 action type or adapts existing types to trigger detail panel",
|
||||
"Typecheck passes",
|
||||
"Verify in browser using dev-browser skill"
|
||||
],
|
||||
"priority": 30,
|
||||
"passes": true,
|
||||
"notes": "Completed. All 21 skills in search index, panel action type added. Skills/KPIs/projects open detail panel directly from command palette."
|
||||
},
|
||||
{
|
||||
"id": "US-031",
|
||||
"title": "Responsive testing and fixes for all new components",
|
||||
"description": "As a developer, I need to verify and fix responsive behavior for the detail panel, sub-nav, constellation, and restructured layout at all breakpoints.",
|
||||
"acceptanceCriteria": [
|
||||
"DetailPanel: both narrow and wide render as 100vw on mobile (\u003c768px)",
|
||||
"SubNav: works on tablet/mobile (horizontal scroll if needed, no overflow)",
|
||||
"CareerConstellation: renders at 300px height on tablet, 250px on mobile",
|
||||
"Projects + KPIs: stack vertically on mobile when grid falls to single column",
|
||||
"CoreSkillsTile: full-width layout works on all breakpoints",
|
||||
"All interactive elements have touch targets \u003e= 44px on mobile",
|
||||
"No horizontal overflow at 375px viewport width",
|
||||
"Typecheck passes",
|
||||
"Verify in browser using dev-browser skill"
|
||||
],
|
||||
"priority": 31,
|
||||
"passes": true,
|
||||
"notes": "Completed. SubNav horizontal scroll with hidden scrollbar, 44px min touch targets on all interactive elements, DetailPanel close button enlarged to 44px."
|
||||
},
|
||||
{
|
||||
"id": "US-032",
|
||||
"title": "Reduced motion audit, final cleanup, and visual review",
|
||||
"description": "As a developer, I need to verify all new animations respect prefers-reduced-motion, remove any dead code introduced during development, and do a final build verification.",
|
||||
"acceptanceCriteria": [
|
||||
"DetailPanel slide animation: instant appear with prefers-reduced-motion",
|
||||
"Backdrop fade: instant with prefers-reduced-motion",
|
||||
"SubNav underline transition: instant with prefers-reduced-motion",
|
||||
"CareerConstellation: static layout (no force simulation animation) with prefers-reduced-motion",
|
||||
"Connection status dot transition: instant with prefers-reduced-motion",
|
||||
"Post-login spinner: static indicator with prefers-reduced-motion",
|
||||
"No dead imports across all files",
|
||||
"Remove any unused flip card CSS (.metric-card-inner etc.) if still present in index.css",
|
||||
"npm run build succeeds cleanly",
|
||||
"npm run typecheck passes with zero errors",
|
||||
"npm run lint passes (pre-existing AccessibilityContext warning OK)",
|
||||
"Typecheck passes"
|
||||
],
|
||||
"priority": 32,
|
||||
"passes": true,
|
||||
"notes": "Completed. Reduced motion overrides for SubNav, connection status, smooth scroll. Created ProjectDetail renderer. Removed unused files (useBreakpoint.ts, profile.ts), legacy PMR CSS variables, placeholder fallback. Build/typecheck/lint all clean."
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
# Ralph Progress — GP Clinical Record Depth Enhancement
|
||||
|
||||
Branch: ralph/depth-enhancement
|
||||
Stories: 32 (US-001 through US-032)
|
||||
|
||||
---
|
||||
|
||||
## Status
|
||||
|
||||
No iterations completed yet.
|
||||
2026-02-13 22:57 | PASS | US-001: Clean up unused legacy components and hooks | model=opus elapsed=01:58 tools=18
|
||||
2026-02-13 22:59 | PASS | US-002: Add new TypeScript types and CSS custom properties for depth features | model=sonnet elapsed=01:54 tools=11
|
||||
2026-02-13 23:03 | PASS | US-003: Create DetailPanelContext, DetailPanel component, and useFocusTrap hook | model=sonnet elapsed=03:39 tools=22
|
||||
2026-02-13 23:06 | PASS | US-004: Create SubNav component and useActiveSection hook | model=sonnet elapsed=02:54 tools=18
|
||||
2026-02-13 23:08 | PASS | US-005: Expand skills data from 5 to ~20 with three categories | model=sonnet elapsed=01:58 tools=11
|
||||
2026-02-13 23:10 | PASS | US-006: Add KPI story data and update 4th KPI | model=sonnet elapsed=01:59 tools=9
|
||||
2026-02-13 23:11 | PASS | US-007: Create education extras data file | model=sonnet elapsed=01:25 tools=10
|
||||
2026-02-13 23:15 | PASS | US-008: Restructure DashboardLayout with SubNav, new tile order, and DetailPanel | model=sonnet elapsed=03:10 tools=27
|
||||
2026-02-13 23:17 | PASS | US-009: Create constellation data mapping file | model=sonnet elapsed=02:20 tools=10
|
||||
2026-02-13 23:50 | PASS | US-011: Modify CoreSkillsTile: full width, categorised groups, panel triggers | model=opus elapsed=02:54 tools=22
|
||||
2026-02-13 23:52 | PASS | US-012: Modify ProjectsTile: half width, compact card grid, panel trigger | model=sonnet elapsed=02:16 tools=11
|
||||
2026-02-13 23:55 | PASS | US-013: Modify LastConsultationTile: add panel trigger | model=sonnet elapsed=02:20 tools=15
|
||||
2026-02-13 23:58 | PASS | US-014: Modify CareerActivityTile: panel triggers and hover preview | model=sonnet elapsed=02:49 tools=14
|
||||
@@ -1,568 +0,0 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Ralph Wiggum Loop - PRD-driven variant.
|
||||
|
||||
.DESCRIPTION
|
||||
Iterates through user stories in prd.json, spawning a fresh `claude --print`
|
||||
invocation for each story. Memory persists via filesystem only: git commits,
|
||||
prd.json (passes field), and progress.txt.
|
||||
|
||||
Each iteration works on ONE user story (in priority order).
|
||||
When all stories pass, the loop completes.
|
||||
|
||||
Circuit breakers prevent runaway costs:
|
||||
- No git changes for N consecutive iterations (stalled)
|
||||
- Same error repeated N consecutive iterations (stuck)
|
||||
|
||||
.PARAMETER Model
|
||||
Initial Claude model to use. Default: "opus". The agent can dynamically switch
|
||||
models between iterations via <next-model>opus|sonnet</next-model> signals.
|
||||
|
||||
.PARAMETER MaxNoProgress
|
||||
Number of consecutive iterations with no git changes before circuit breaker trips. Default: 3.
|
||||
|
||||
.PARAMETER MaxSameError
|
||||
Number of consecutive iterations with the same error before circuit breaker trips. Default: 3.
|
||||
|
||||
.PARAMETER StartFrom
|
||||
Story ID to start from (e.g., "US-005"). Treats all earlier stories as already passed.
|
||||
|
||||
.EXAMPLE
|
||||
.\.claude\skills\ralph\ralph.ps1 -Model "opus"
|
||||
|
||||
.EXAMPLE
|
||||
.\.claude\skills\ralph\ralph.ps1 -StartFrom "US-010" -Model "sonnet"
|
||||
#>
|
||||
|
||||
param(
|
||||
[string]$Model = "opus",
|
||||
[int]$MaxNoProgress = 3,
|
||||
[int]$MaxSameError = 3,
|
||||
[string]$StartFrom = ""
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||
$prdFile = Join-Path $scriptDir "prd.json"
|
||||
$progressFile = Join-Path $scriptDir "progress.txt"
|
||||
$logDir = Join-Path $scriptDir "logs"
|
||||
|
||||
# --- Find project root (git repo root) ---
|
||||
|
||||
$projectRoot = git rev-parse --show-toplevel 2>$null
|
||||
if (-not $projectRoot) {
|
||||
Write-Error "Not inside a git repository. Run from the project directory."
|
||||
exit 1
|
||||
}
|
||||
$projectRoot = (Resolve-Path $projectRoot).Path
|
||||
|
||||
# --- Validation ---
|
||||
|
||||
if (-not (Test-Path $prdFile)) {
|
||||
Write-Error "prd.json not found at $prdFile"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Ensure logs directory exists
|
||||
if (-not (Test-Path $logDir)) {
|
||||
New-Item -ItemType Directory -Path $logDir | Out-Null
|
||||
Write-Host "Created logs directory"
|
||||
}
|
||||
|
||||
# --- PRD Read/Write ---
|
||||
|
||||
function Read-Prd {
|
||||
Get-Content -Path $prdFile -Raw | ConvertFrom-Json
|
||||
}
|
||||
|
||||
function Save-Prd {
|
||||
param($prdObj)
|
||||
$prdObj | ConvertTo-Json -Depth 10 | Set-Content -Path $prdFile -Encoding UTF8
|
||||
}
|
||||
|
||||
$prd = Read-Prd
|
||||
|
||||
# --- Git Setup ---
|
||||
|
||||
$BranchName = $prd.branchName
|
||||
|
||||
if ($BranchName) {
|
||||
$currentBranch = git branch --show-current
|
||||
if ($currentBranch -ne $BranchName) {
|
||||
$branchExists = git branch --list $BranchName
|
||||
if ($branchExists) {
|
||||
Write-Host "Switching to existing branch: $BranchName"
|
||||
git checkout $BranchName
|
||||
} else {
|
||||
Write-Host "Creating branch: $BranchName"
|
||||
git checkout -b $BranchName
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# --- Handle StartFrom: mark earlier stories as passed ---
|
||||
|
||||
if ($StartFrom) {
|
||||
$startPriority = [int]($StartFrom -replace 'US-0*', '')
|
||||
$skippedCount = 0
|
||||
foreach ($story in $prd.userStories) {
|
||||
$storyPriority = [int]($story.id -replace 'US-0*', '')
|
||||
if ($storyPriority -lt $startPriority -and $story.passes -ne $true) {
|
||||
$story.passes = $true
|
||||
$story.notes = "Skipped (--StartFrom $StartFrom)"
|
||||
$skippedCount++
|
||||
}
|
||||
}
|
||||
if ($skippedCount -gt 0) {
|
||||
Save-Prd $prd
|
||||
Write-Host "Marked $skippedCount stories before $StartFrom as skipped." -ForegroundColor DarkYellow
|
||||
}
|
||||
}
|
||||
|
||||
# --- Circuit Breaker State ---
|
||||
|
||||
$noProgressCount = 0
|
||||
$lastErrorSignature = ""
|
||||
$sameErrorCount = 0
|
||||
|
||||
# --- Prompt Generation ---
|
||||
|
||||
function Build-StoryPrompt {
|
||||
param(
|
||||
$story,
|
||||
$prdObj,
|
||||
[array]$completedStories
|
||||
)
|
||||
|
||||
# Build completed list
|
||||
$completedSection = ""
|
||||
if ($completedStories.Count -gt 0) {
|
||||
$completedLines = ($completedStories | ForEach-Object {
|
||||
"- $($_.id): $($_.title)"
|
||||
}) -join "`n"
|
||||
$completedSection = "`n## Previously Completed Stories (do not redo)`n$completedLines`n"
|
||||
}
|
||||
|
||||
# Build criteria list
|
||||
$criteriaLines = ($story.acceptanceCriteria | ForEach-Object { "- [ ] $_" }) -join "`n"
|
||||
|
||||
# Build prompt using array-join (avoids PS 5.1 here-string indentation issues)
|
||||
$sid = $story.id
|
||||
$stitle = $story.title
|
||||
$sdesc = $story.description
|
||||
$pdesc = $prdObj.description
|
||||
|
||||
$prompt = @(
|
||||
"# Ralph Iteration: $sid - $stitle"
|
||||
""
|
||||
"## Project"
|
||||
"$pdesc"
|
||||
""
|
||||
"Read CLAUDE.md for full project conventions, architecture, and design system. This is mandatory before starting work."
|
||||
""
|
||||
"## Your Task"
|
||||
""
|
||||
"**${sid}: $stitle**"
|
||||
""
|
||||
"$sdesc"
|
||||
""
|
||||
"## Acceptance Criteria"
|
||||
""
|
||||
"$criteriaLines"
|
||||
""
|
||||
"## Reference Documents"
|
||||
""
|
||||
"Read these as needed for implementation detail:"
|
||||
""
|
||||
"- **CLAUDE.md** - Project conventions, architecture, design tokens, guardrails (READ FIRST)"
|
||||
"- **Ralph/depth-design.md** - Component architecture, props interfaces, CSS specs, data models"
|
||||
"- **Ralph/depth-requirements.md** - Full requirements with content sources and UX patterns"
|
||||
"- **References/CV_v4.md** - Source of truth for all CV content (roles, dates, achievements, numbers)"
|
||||
"$completedSection"
|
||||
"## Workflow"
|
||||
""
|
||||
"1. Read CLAUDE.md to understand project conventions"
|
||||
"2. Read Ralph/depth-design.md sections relevant to this story"
|
||||
"3. Read existing source files you will modify to understand current patterns"
|
||||
"4. Implement ALL acceptance criteria"
|
||||
"5. Run npm run typecheck - fix any type errors"
|
||||
"6. Run npm run build - fix any build errors"
|
||||
"7. Stage and commit your changes:"
|
||||
" git add [specific files] && git commit -m `"${sid}: [descriptive message]`""
|
||||
"8. When ALL criteria are met, output: <story-complete>$sid</story-complete>"
|
||||
""
|
||||
"## Rules"
|
||||
""
|
||||
"- Work ONLY on $sid. Do not modify code for other stories."
|
||||
"- Read files before modifying them."
|
||||
"- Follow existing patterns and conventions in the codebase."
|
||||
"- Use lucide-react for icons, never unicode symbols."
|
||||
"- Use the project's CSS custom properties and Tailwind tokens."
|
||||
"- Commit specific files, not git add -A."
|
||||
"- Do NOT start a dev server (npm run dev). One is already running on port $devServerPort. Do NOT run any background tasks."
|
||||
"- If genuinely blocked, output <story-blocked>$sid</story-blocked> with explanation."
|
||||
"- To recommend a different model for the NEXT iteration, output <next-model>opus</next-model> or <next-model>sonnet</next-model>."
|
||||
) -join "`n"
|
||||
|
||||
return $prompt
|
||||
}
|
||||
|
||||
# --- Banner ---
|
||||
|
||||
$completedCount = @($prd.userStories | Where-Object { $_.passes -eq $true }).Count
|
||||
$totalCount = $prd.userStories.Count
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "===== Ralph Wiggum Loop (PRD-driven) =====" -ForegroundColor Cyan
|
||||
Write-Host "Project: $($prd.project)" -ForegroundColor Cyan
|
||||
Write-Host "Branch: $BranchName | Model: $Model (dynamic switching enabled)" -ForegroundColor Cyan
|
||||
Write-Host "Stories: $completedCount/$totalCount complete" -ForegroundColor Cyan
|
||||
Write-Host "Circuit breakers: no-progress=$MaxNoProgress, same-error=$MaxSameError" -ForegroundColor Cyan
|
||||
Write-Host "===========================================" -ForegroundColor Cyan
|
||||
Write-Host ""
|
||||
|
||||
# Dev server port (assumed to be running externally)
|
||||
$devServerPort = 5173
|
||||
Write-Host "Dev server assumed running on port $devServerPort" -ForegroundColor DarkGray
|
||||
Write-Host ""
|
||||
|
||||
# --- Story Loop ---
|
||||
|
||||
$iterationCount = 0
|
||||
$originalDir = Get-Location
|
||||
Set-Location $projectRoot
|
||||
|
||||
try {
|
||||
|
||||
while ($true) {
|
||||
# Re-read PRD each iteration (in case previous iteration updated it)
|
||||
$prd = Read-Prd
|
||||
|
||||
# Partition stories
|
||||
$completedStories = @($prd.userStories | Where-Object { $_.passes -eq $true })
|
||||
$pendingStories = @($prd.userStories | Where-Object { $_.passes -ne $true } | Sort-Object { $_.priority })
|
||||
|
||||
# Check if all done
|
||||
if ($pendingStories.Count -eq 0) {
|
||||
Write-Host ""
|
||||
Write-Host "===== ALL STORIES COMPLETE =====" -ForegroundColor Green
|
||||
Write-Host "$($completedStories.Count)/$($prd.userStories.Count) stories passed." -ForegroundColor Green
|
||||
Write-Host "Branch: $BranchName" -ForegroundColor Green
|
||||
break
|
||||
}
|
||||
|
||||
$currentStory = $pendingStories[0]
|
||||
$iterationCount++
|
||||
$pctComplete = [math]::Round(($completedStories.Count / $prd.userStories.Count) * 100)
|
||||
|
||||
$storyLabel = "$($currentStory.id): $($currentStory.title)"
|
||||
$pctStr = "${pctComplete}%"
|
||||
$progressMsg = " Progress: $($completedStories.Count)/$($prd.userStories.Count) ($pctStr) - Remaining: $($pendingStories.Count)"
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "--- Iteration $iterationCount - $storyLabel ---" -ForegroundColor Yellow
|
||||
Write-Host $progressMsg -ForegroundColor DarkGray
|
||||
|
||||
# Record HEAD before this iteration
|
||||
$headBefore = git rev-parse HEAD 2>$null
|
||||
|
||||
$iterStart = Get-Date
|
||||
Write-Host " Started: $($iterStart.ToString('HH:mm:ss')) | Model: $Model" -ForegroundColor DarkGray
|
||||
Write-Host ""
|
||||
|
||||
# Generate prompt for this story
|
||||
$promptContent = Build-StoryPrompt -story $currentStory -prdObj $prd -completedStories $completedStories
|
||||
|
||||
# --- Spawn Claude ---
|
||||
|
||||
$logFile = Join-Path $logDir "$($currentStory.id).log"
|
||||
$rawLogFile = Join-Path $logDir "$($currentStory.id).raw.jsonl"
|
||||
$maxRetries = 10
|
||||
$retryCount = 0
|
||||
$outputString = ""
|
||||
$apiOverloaded = $false
|
||||
|
||||
do {
|
||||
$apiOverloaded = $false
|
||||
$textBuilder = [System.Text.StringBuilder]::new()
|
||||
$toolCount = 0
|
||||
|
||||
# Clear raw log file for this attempt
|
||||
if (Test-Path $rawLogFile) { Remove-Item $rawLogFile -Force }
|
||||
|
||||
if ($retryCount -gt 0) {
|
||||
$backoffSeconds = [Math]::Pow(2, $retryCount - 1)
|
||||
Write-Host " [Retry $retryCount/$maxRetries] API overloaded, waiting $backoffSeconds seconds..." -ForegroundColor DarkYellow
|
||||
Start-Sleep -Seconds $backoffSeconds
|
||||
Write-Host " Retrying Claude invocation..." -ForegroundColor DarkGray
|
||||
}
|
||||
|
||||
# --- Spawn Claude via Process.Start for clean shutdown control ---
|
||||
# Using Process.Start instead of pipeline so we can break on the result
|
||||
# event and force-kill the process tree. The pipeline approach hangs when
|
||||
# Claude spawns background tasks (e.g. npm run dev) that keep stdout open.
|
||||
|
||||
$promptTempFile = Join-Path $logDir "$($currentStory.id).prompt.tmp"
|
||||
$promptContent | Set-Content -Path $promptTempFile -Encoding UTF8
|
||||
|
||||
$claudeArgs = "--print --verbose --dangerously-skip-permissions --model $Model --output-format stream-json"
|
||||
$psi = [System.Diagnostics.ProcessStartInfo]::new()
|
||||
$psi.FileName = "cmd.exe"
|
||||
$psi.Arguments = "/c type `"$promptTempFile`" | claude $claudeArgs"
|
||||
$psi.UseShellExecute = $false
|
||||
$psi.RedirectStandardOutput = $true
|
||||
$psi.RedirectStandardError = $true
|
||||
$psi.CreateNoWindow = $true
|
||||
$psi.WorkingDirectory = $projectRoot
|
||||
|
||||
$claudeProc = [System.Diagnostics.Process]::Start($psi)
|
||||
|
||||
# Drain stderr async to prevent buffer deadlock
|
||||
$claudeProc.add_ErrorDataReceived({ param($s,$e) })
|
||||
$claudeProc.BeginErrorReadLine()
|
||||
|
||||
try {
|
||||
while ($null -ne ($line = $claudeProc.StandardOutput.ReadLine())) {
|
||||
$line = $line.Trim()
|
||||
if (-not $line) { continue }
|
||||
|
||||
# Save raw event for debugging
|
||||
try {
|
||||
Add-Content -Path $rawLogFile -Value $line -Encoding UTF8 -ErrorAction SilentlyContinue
|
||||
} catch { }
|
||||
|
||||
$isResultEvent = $false
|
||||
try {
|
||||
$evt = $line | ConvertFrom-Json -ErrorAction Stop
|
||||
|
||||
# --- Tool use start ---
|
||||
if ($evt.type -eq 'content_block_start' -and $evt.content_block.type -eq 'tool_use') {
|
||||
$toolCount++
|
||||
$toolName = $evt.content_block.name
|
||||
Write-Host " [$toolName]" -ForegroundColor DarkCyan
|
||||
}
|
||||
# --- Streaming text ---
|
||||
elseif ($evt.type -eq 'content_block_delta' -and $evt.delta.type -eq 'text_delta' -and $evt.delta.text) {
|
||||
Write-Host -NoNewline $evt.delta.text
|
||||
[void]$textBuilder.Append($evt.delta.text)
|
||||
}
|
||||
# --- Result event (terminal — stop reading after this) ---
|
||||
elseif ($evt.type -eq 'result') {
|
||||
if ($evt.subtype -eq 'error_result' -and $evt.error) {
|
||||
Write-Host " [ERROR] $($evt.error)" -ForegroundColor Red
|
||||
[void]$textBuilder.AppendLine("ERROR: $($evt.error)")
|
||||
}
|
||||
elseif ($evt.result) {
|
||||
[void]$textBuilder.AppendLine($evt.result)
|
||||
}
|
||||
$isResultEvent = $true
|
||||
}
|
||||
# --- Message-level content ---
|
||||
elseif ($evt.message -and $evt.message.content) {
|
||||
foreach ($block in $evt.message.content) {
|
||||
if ($block.type -eq 'text' -and $block.text) {
|
||||
Write-Host $block.text
|
||||
[void]$textBuilder.AppendLine($block.text)
|
||||
}
|
||||
elseif ($block.type -eq 'tool_use') {
|
||||
$toolCount++
|
||||
Write-Host " [$($block.name)]" -ForegroundColor DarkCyan
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
if ($line -and $line -notmatch '^\s*["\{\[\}\]]') {
|
||||
Write-Host $line -ForegroundColor DarkYellow
|
||||
[void]$textBuilder.AppendLine($line)
|
||||
}
|
||||
}
|
||||
|
||||
# Result is always the final stream event — stop reading
|
||||
if ($isResultEvent) { break }
|
||||
}
|
||||
} finally {
|
||||
# Kill the Claude process tree to prevent orphaned cmd.exe/node processes
|
||||
if ($claudeProc -and -not $claudeProc.HasExited) {
|
||||
try {
|
||||
taskkill /T /F /PID $claudeProc.Id 2>$null | Out-Null
|
||||
} catch { }
|
||||
}
|
||||
Remove-Item -Path $promptTempFile -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
$outputString = $textBuilder.ToString()
|
||||
|
||||
# Check for 529 overloaded error
|
||||
if ($outputString -match "529.*overloaded|overloaded_error") {
|
||||
$apiOverloaded = $true
|
||||
$retryCount++
|
||||
if ($retryCount -ge $maxRetries) {
|
||||
Write-Host " [ERROR] API overloaded after $maxRetries retries, giving up." -ForegroundColor Red
|
||||
}
|
||||
}
|
||||
# Check for usage limit with cooldown
|
||||
elseif ($outputString -match "(?i)usage limit reached.*reset at (\d{1,2})(?::(\d{2}))?\s*(am|pm)") {
|
||||
$resetHour = [int]$Matches[1]
|
||||
$resetMinute = if ($Matches[2]) { [int]$Matches[2] } else { 0 }
|
||||
$resetAmPm = $Matches[3]
|
||||
|
||||
if ($resetAmPm -ieq "pm" -and $resetHour -ne 12) { $resetHour += 12 }
|
||||
elseif ($resetAmPm -ieq "am" -and $resetHour -eq 12) { $resetHour = 0 }
|
||||
|
||||
$now = Get-Date
|
||||
$resetTime = Get-Date -Hour $resetHour -Minute $resetMinute -Second 0
|
||||
if ($resetTime -le $now) { $resetTime = $resetTime.AddDays(1) }
|
||||
$resetTime = $resetTime.AddMinutes(2)
|
||||
|
||||
$waitSeconds = [Math]::Ceiling(($resetTime - $now).TotalSeconds)
|
||||
$waitMinutes = [Math]::Ceiling($waitSeconds / 60)
|
||||
|
||||
Write-Host ""
|
||||
Write-Host " [USAGE LIMIT] Reset at $($Matches[1]) $resetAmPm. Cooling down ~$waitMinutes minutes (until $($resetTime.ToString('HH:mm')))..." -ForegroundColor Yellow
|
||||
Start-Sleep -Seconds $waitSeconds
|
||||
Write-Host " [USAGE LIMIT] Cooldown complete. Retrying..." -ForegroundColor Green
|
||||
|
||||
$apiOverloaded = $true
|
||||
}
|
||||
} while ($apiOverloaded -and $retryCount -lt $maxRetries)
|
||||
|
||||
# Save log
|
||||
$outputString | Set-Content -Path $logFile -Encoding UTF8
|
||||
|
||||
# Show elapsed time
|
||||
$elapsed = (Get-Date) - $iterStart
|
||||
Write-Host ""
|
||||
Write-Host " Finished: $(Get-Date -Format 'HH:mm:ss') (elapsed: $($elapsed.ToString('mm\:ss')), tools: $toolCount)" -ForegroundColor DarkGray
|
||||
|
||||
# --- Detect signals ---
|
||||
|
||||
$storyComplete = $outputString -match "<story-complete>$([regex]::Escape($currentStory.id))</story-complete>"
|
||||
$storyBlocked = $outputString -match "<story-blocked>$([regex]::Escape($currentStory.id))</story-blocked>"
|
||||
$headAfter = git rev-parse HEAD 2>$null
|
||||
$hasGitChanges = $headAfter -ne $headBefore
|
||||
|
||||
# --- Update story status ---
|
||||
|
||||
if ($storyComplete) {
|
||||
# Mark story as passed in prd.json
|
||||
$prd = Read-Prd
|
||||
$storyToUpdate = $prd.userStories | Where-Object { $_.id -eq $currentStory.id }
|
||||
if ($storyToUpdate) {
|
||||
$alreadyDone = if (-not $hasGitChanges) { " (already committed)" } else { "" }
|
||||
$storyToUpdate.passes = $true
|
||||
$storyToUpdate.notes = "Completed iteration $iterationCount at $(Get-Date -Format 'yyyy-MM-dd HH:mm'). Model: $Model.$alreadyDone"
|
||||
}
|
||||
Save-Prd $prd
|
||||
|
||||
# Append to progress.txt
|
||||
$ts = Get-Date -Format 'yyyy-MM-dd HH:mm'
|
||||
$el = $elapsed.ToString('mm\:ss')
|
||||
$tag = if ($hasGitChanges) { "PASS" } else { "PASS (no new commits)" }
|
||||
$progressEntry = "$ts | $tag | $($currentStory.id): $($currentStory.title) | model=$Model elapsed=$el tools=$toolCount"
|
||||
Add-Content -Path $progressFile -Value $progressEntry -Encoding UTF8
|
||||
|
||||
Write-Host " [PASSED] $storyLabel" -ForegroundColor Green
|
||||
if (-not $hasGitChanges) {
|
||||
Write-Host " (Work was already committed)" -ForegroundColor DarkGray
|
||||
}
|
||||
$noProgressCount = 0
|
||||
$sameErrorCount = 0
|
||||
$lastErrorSignature = ""
|
||||
}
|
||||
elseif ($storyBlocked) {
|
||||
$ts = Get-Date -Format 'yyyy-MM-dd HH:mm'
|
||||
$progressEntry = "$ts | BLOCKED | $storyLabel"
|
||||
Add-Content -Path $progressFile -Value $progressEntry -Encoding UTF8
|
||||
Write-Host " [BLOCKED] $storyLabel - check $logFile for details." -ForegroundColor Red
|
||||
# Blocked counts as no progress
|
||||
$noProgressCount++
|
||||
}
|
||||
else {
|
||||
# No completion signal
|
||||
if ($hasGitChanges) {
|
||||
Write-Host " [PARTIAL] Git changes but no completion signal. Retrying story." -ForegroundColor DarkYellow
|
||||
$ts = Get-Date -Format 'yyyy-MM-dd HH:mm'
|
||||
$progressEntry = "$ts | PARTIAL | $storyLabel"
|
||||
Add-Content -Path $progressFile -Value $progressEntry -Encoding UTF8
|
||||
$noProgressCount = 0
|
||||
} else {
|
||||
Write-Host " [NO PROGRESS] No changes and no signal." -ForegroundColor DarkYellow
|
||||
$noProgressCount++
|
||||
}
|
||||
}
|
||||
|
||||
# --- Circuit Breaker: No Progress ---
|
||||
|
||||
if ($noProgressCount -ge $MaxNoProgress) {
|
||||
Write-Host ""
|
||||
Write-Host "===== CIRCUIT BREAKER: NO PROGRESS =====" -ForegroundColor Red
|
||||
Write-Host "No meaningful progress for $MaxNoProgress consecutive iterations." -ForegroundColor Red
|
||||
Write-Host "Stuck on: $($currentStory.id) - $($currentStory.title)" -ForegroundColor Red
|
||||
Write-Host "Check $logFile for details." -ForegroundColor Red
|
||||
break
|
||||
}
|
||||
|
||||
# --- Circuit Breaker: Repeated Error ---
|
||||
|
||||
$errorLines = $outputString | Select-String -Pattern "(?i)(error|exception|failed|fatal)[:.].*" -AllMatches
|
||||
if ($errorLines) {
|
||||
$filteredErrors = $errorLines.Matches | Where-Object { $_.Value -notmatch "529|overloaded" } | Select-Object -First 3
|
||||
$currentErrorSignature = ($filteredErrors | ForEach-Object { $_.Value }) -join "|"
|
||||
if ($currentErrorSignature -and $currentErrorSignature -eq $lastErrorSignature) {
|
||||
$sameErrorCount++
|
||||
Write-Host " [Circuit Breaker] Same error pattern repeated ($sameErrorCount/$MaxSameError)" -ForegroundColor DarkYellow
|
||||
if ($sameErrorCount -ge $MaxSameError) {
|
||||
Write-Host ""
|
||||
Write-Host "===== CIRCUIT BREAKER: REPEATED ERROR =====" -ForegroundColor Red
|
||||
Write-Host "Same error for $MaxSameError consecutive iterations:" -ForegroundColor Red
|
||||
Write-Host " $currentErrorSignature" -ForegroundColor Red
|
||||
break
|
||||
}
|
||||
} elseif ($currentErrorSignature) {
|
||||
$sameErrorCount = 0
|
||||
}
|
||||
$lastErrorSignature = $currentErrorSignature
|
||||
} else {
|
||||
$sameErrorCount = 0
|
||||
$lastErrorSignature = ""
|
||||
}
|
||||
|
||||
# --- Dynamic Model Selection ---
|
||||
|
||||
if ($outputString -match "<next-model>(opus|sonnet)</next-model>") {
|
||||
$nextModel = $Matches[1]
|
||||
if ($nextModel -ne $Model) {
|
||||
Write-Host " [Model Switch] $Model -> $nextModel (agent recommendation)" -ForegroundColor Magenta
|
||||
$Model = $nextModel
|
||||
}
|
||||
}
|
||||
|
||||
# Brief pause between iterations
|
||||
Start-Sleep -Seconds 2
|
||||
}
|
||||
|
||||
} finally {
|
||||
Set-Location $originalDir
|
||||
}
|
||||
|
||||
# --- Final Summary ---
|
||||
|
||||
$prd = Read-Prd
|
||||
$finalPassed = @($prd.userStories | Where-Object { $_.passes -eq $true }).Count
|
||||
$finalTotal = $prd.userStories.Count
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "===========================================" -ForegroundColor Cyan
|
||||
Write-Host " Ralph Loop finished after $iterationCount iteration(s)" -ForegroundColor Cyan
|
||||
Write-Host " Stories: $finalPassed/$finalTotal passed" -ForegroundColor Cyan
|
||||
Write-Host " Branch: $BranchName" -ForegroundColor Cyan
|
||||
Write-Host " Logs: $logDir" -ForegroundColor Cyan
|
||||
Write-Host "===========================================" -ForegroundColor Cyan
|
||||
|
||||
if ($finalPassed -eq $finalTotal) {
|
||||
exit 0
|
||||
} else {
|
||||
exit 1
|
||||
}
|
||||
|
||||
@@ -1,582 +0,0 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Ralph Wiggum Loop — PRD-driven variant.
|
||||
|
||||
.DESCRIPTION
|
||||
Iterates through user stories in prd.json, spawning a fresh `claude --print`
|
||||
invocation for each story. Memory persists via filesystem only: git commits,
|
||||
prd.json (passes field), and progress.txt.
|
||||
|
||||
Each iteration works on ONE user story (in priority order).
|
||||
When all stories pass, the loop completes.
|
||||
|
||||
Circuit breakers prevent runaway costs:
|
||||
- No git changes for N consecutive iterations (stalled)
|
||||
- Same error repeated N consecutive iterations (stuck)
|
||||
|
||||
.PARAMETER Model
|
||||
Initial Claude model to use. Default: "opus". The agent can dynamically switch
|
||||
models between iterations via <next-model>opus|sonnet</next-model> signals.
|
||||
|
||||
.PARAMETER MaxNoProgress
|
||||
Number of consecutive iterations with no git changes before circuit breaker trips. Default: 3.
|
||||
|
||||
.PARAMETER MaxSameError
|
||||
Number of consecutive iterations with the same error before circuit breaker trips. Default: 3.
|
||||
|
||||
.PARAMETER StartFrom
|
||||
Story ID to start from (e.g., "US-005"). Treats all earlier stories as already passed.
|
||||
|
||||
.PARAMETER SkipVerify
|
||||
Skip post-iteration typecheck verification. Faster but less safe.
|
||||
|
||||
.EXAMPLE
|
||||
.\.claude\skills\ralph\ralph.ps1 -Model "opus"
|
||||
|
||||
.EXAMPLE
|
||||
.\.claude\skills\ralph\ralph.ps1 -StartFrom "US-010" -Model "sonnet"
|
||||
#>
|
||||
|
||||
param(
|
||||
[string]$Model = "opus",
|
||||
[int]$MaxNoProgress = 3,
|
||||
[int]$MaxSameError = 3,
|
||||
[string]$StartFrom = "",
|
||||
[switch]$SkipVerify
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||
$prdFile = Join-Path $scriptDir "prd.json"
|
||||
$progressFile = Join-Path $scriptDir "progress.txt"
|
||||
$logDir = Join-Path $scriptDir "logs"
|
||||
|
||||
# --- Find project root (git repo root) ---
|
||||
|
||||
$projectRoot = git rev-parse --show-toplevel 2>$null
|
||||
if (-not $projectRoot) {
|
||||
Write-Error "Not inside a git repository. Run from the project directory."
|
||||
exit 1
|
||||
}
|
||||
$projectRoot = (Resolve-Path $projectRoot).Path
|
||||
|
||||
# --- Validation ---
|
||||
|
||||
if (-not (Test-Path $prdFile)) {
|
||||
Write-Error "prd.json not found at $prdFile"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Ensure logs directory exists
|
||||
if (-not (Test-Path $logDir)) {
|
||||
New-Item -ItemType Directory -Path $logDir | Out-Null
|
||||
Write-Host "Created logs directory"
|
||||
}
|
||||
|
||||
# --- PRD Read/Write ---
|
||||
|
||||
function Read-Prd {
|
||||
Get-Content -Path $prdFile -Raw | ConvertFrom-Json
|
||||
}
|
||||
|
||||
function Save-Prd {
|
||||
param($prdObj)
|
||||
$prdObj | ConvertTo-Json -Depth 10 | Set-Content -Path $prdFile -Encoding UTF8
|
||||
}
|
||||
|
||||
$prd = Read-Prd
|
||||
|
||||
# --- Git Setup ---
|
||||
|
||||
$BranchName = $prd.branchName
|
||||
|
||||
if ($BranchName) {
|
||||
$currentBranch = git branch --show-current
|
||||
if ($currentBranch -ne $BranchName) {
|
||||
$branchExists = git branch --list $BranchName
|
||||
if ($branchExists) {
|
||||
Write-Host "Switching to existing branch: $BranchName"
|
||||
git checkout $BranchName
|
||||
} else {
|
||||
Write-Host "Creating branch: $BranchName"
|
||||
git checkout -b $BranchName
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# --- Handle StartFrom: mark earlier stories as passed ---
|
||||
|
||||
if ($StartFrom) {
|
||||
$startPriority = [int]($StartFrom -replace 'US-0*', '')
|
||||
$skippedCount = 0
|
||||
foreach ($story in $prd.userStories) {
|
||||
$storyPriority = [int]($story.id -replace 'US-0*', '')
|
||||
if ($storyPriority -lt $startPriority -and $story.passes -ne $true) {
|
||||
$story.passes = $true
|
||||
$story.notes = "Skipped (--StartFrom $StartFrom)"
|
||||
$skippedCount++
|
||||
}
|
||||
}
|
||||
if ($skippedCount -gt 0) {
|
||||
Save-Prd $prd
|
||||
Write-Host "Marked $skippedCount stories before $StartFrom as skipped." -ForegroundColor DarkYellow
|
||||
}
|
||||
}
|
||||
|
||||
# --- Circuit Breaker State ---
|
||||
|
||||
$noProgressCount = 0
|
||||
$lastErrorSignature = ""
|
||||
$sameErrorCount = 0
|
||||
|
||||
# --- Prompt Generation ---
|
||||
|
||||
function Build-StoryPrompt {
|
||||
param(
|
||||
$story,
|
||||
$prdObj,
|
||||
[array]$completedStories
|
||||
)
|
||||
|
||||
# Build completed list
|
||||
$completedSection = ""
|
||||
if ($completedStories.Count -gt 0) {
|
||||
$completedLines = ($completedStories | ForEach-Object {
|
||||
"- $($_.id): $($_.title)"
|
||||
}) -join "`n"
|
||||
$completedSection = "`n## Previously Completed Stories (do not redo)`n$completedLines`n"
|
||||
}
|
||||
|
||||
# Build criteria list
|
||||
$criteriaLines = ($story.acceptanceCriteria | ForEach-Object { "- [ ] $_" }) -join "`n"
|
||||
|
||||
# Build prompt using array-join (avoids PS 5.1 here-string indentation issues)
|
||||
$sid = $story.id
|
||||
$stitle = $story.title
|
||||
$sdesc = $story.description
|
||||
$pdesc = $prdObj.description
|
||||
|
||||
$prompt = @(
|
||||
"# Ralph Iteration: $sid - $stitle"
|
||||
""
|
||||
"## Project"
|
||||
"$pdesc"
|
||||
""
|
||||
"Read CLAUDE.md for full project conventions, architecture, and design system. This is mandatory before starting work."
|
||||
""
|
||||
"## Your Task"
|
||||
""
|
||||
"**${sid}: $stitle**"
|
||||
""
|
||||
"$sdesc"
|
||||
""
|
||||
"## Acceptance Criteria"
|
||||
""
|
||||
"$criteriaLines"
|
||||
""
|
||||
"## Reference Documents"
|
||||
""
|
||||
"Read these as needed for implementation detail:"
|
||||
""
|
||||
"- **CLAUDE.md** - Project conventions, architecture, design tokens, guardrails (READ FIRST)"
|
||||
"- **Ralph/depth-design.md** - Component architecture, props interfaces, CSS specs, data models"
|
||||
"- **Ralph/depth-requirements.md** - Full requirements with content sources and UX patterns"
|
||||
"- **References/CV_v4.md** - Source of truth for all CV content (roles, dates, achievements, numbers)"
|
||||
"$completedSection"
|
||||
"## Workflow"
|
||||
""
|
||||
"1. Read CLAUDE.md to understand project conventions"
|
||||
"2. Read Ralph/depth-design.md sections relevant to this story"
|
||||
"3. Read existing source files you will modify to understand current patterns"
|
||||
"4. Implement ALL acceptance criteria"
|
||||
"5. Run npm run typecheck - fix any type errors"
|
||||
"6. Run npm run build - fix any build errors"
|
||||
"7. Stage and commit your changes:"
|
||||
" git add [specific files] && git commit -m `"${sid}: [descriptive message]`""
|
||||
"8. When ALL criteria are met, output: <story-complete>$sid</story-complete>"
|
||||
""
|
||||
"## Rules"
|
||||
""
|
||||
"- Work ONLY on $sid. Do not modify code for other stories."
|
||||
"- Read files before modifying them."
|
||||
"- Follow existing patterns and conventions in the codebase."
|
||||
"- Use lucide-react for icons, never unicode symbols."
|
||||
"- Use the project's CSS custom properties and Tailwind tokens."
|
||||
"- Commit specific files, not git add -A."
|
||||
"- If genuinely blocked, output <story-blocked>$sid</story-blocked> with explanation."
|
||||
"- To recommend a different model for the NEXT iteration, output <next-model>opus</next-model> or <next-model>sonnet</next-model>."
|
||||
) -join "`n"
|
||||
|
||||
return $prompt
|
||||
}
|
||||
|
||||
# --- Banner ---
|
||||
|
||||
$completedCount = @($prd.userStories | Where-Object { $_.passes -eq $true }).Count
|
||||
$totalCount = $prd.userStories.Count
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "===== Ralph Wiggum Loop (PRD-driven) =====" -ForegroundColor Cyan
|
||||
Write-Host "Project: $($prd.project)" -ForegroundColor Cyan
|
||||
Write-Host "Branch: $BranchName | Model: $Model (dynamic switching enabled)" -ForegroundColor Cyan
|
||||
Write-Host "Stories: $completedCount/$totalCount complete" -ForegroundColor Cyan
|
||||
Write-Host "Circuit breakers: no-progress=$MaxNoProgress, same-error=$MaxSameError" -ForegroundColor Cyan
|
||||
if (-not $SkipVerify) { Write-Host "Post-iteration typecheck verification: ON" -ForegroundColor Cyan }
|
||||
Write-Host "===========================================" -ForegroundColor Cyan
|
||||
Write-Host ""
|
||||
|
||||
# --- Dev Server ---
|
||||
|
||||
$devServerPort = 5173
|
||||
$devServerPid = $null
|
||||
|
||||
try {
|
||||
$null = Invoke-WebRequest -Uri "http://localhost:$devServerPort" -TimeoutSec 2 -ErrorAction Stop
|
||||
Write-Host "Dev server detected on port $devServerPort" -ForegroundColor Green
|
||||
} catch {
|
||||
Write-Host "Starting dev server (port $devServerPort)..." -ForegroundColor Cyan
|
||||
$devProc = Start-Process -FilePath "npm.cmd" -ArgumentList "run", "dev" -WorkingDirectory $projectRoot -PassThru -WindowStyle Minimized
|
||||
$devServerPid = $devProc.Id
|
||||
|
||||
for ($w = 1; $w -le 20; $w++) {
|
||||
Start-Sleep -Seconds 1
|
||||
try {
|
||||
$null = Invoke-WebRequest -Uri "http://localhost:$devServerPort" -TimeoutSec 2 -ErrorAction Stop
|
||||
Write-Host "Dev server ready on port $devServerPort" -ForegroundColor Green
|
||||
break
|
||||
} catch {
|
||||
if ($w -eq 20) {
|
||||
Write-Warning "Dev server may not be ready — visual review steps may fail"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Write-Host ""
|
||||
|
||||
# --- Story Loop ---
|
||||
|
||||
$iterationCount = 0
|
||||
$originalDir = Get-Location
|
||||
Set-Location $projectRoot
|
||||
|
||||
try {
|
||||
|
||||
while ($true) {
|
||||
# Re-read PRD each iteration (in case previous iteration updated it)
|
||||
$prd = Read-Prd
|
||||
|
||||
# Partition stories
|
||||
$completedStories = @($prd.userStories | Where-Object { $_.passes -eq $true })
|
||||
$pendingStories = @($prd.userStories | Where-Object { $_.passes -ne $true } | Sort-Object { $_.priority })
|
||||
|
||||
# Check if all done
|
||||
if ($pendingStories.Count -eq 0) {
|
||||
Write-Host ""
|
||||
Write-Host "===== ALL STORIES COMPLETE =====" -ForegroundColor Green
|
||||
Write-Host "$($completedStories.Count)/$($prd.userStories.Count) stories passed." -ForegroundColor Green
|
||||
Write-Host "Branch: $BranchName" -ForegroundColor Green
|
||||
break
|
||||
}
|
||||
|
||||
$currentStory = $pendingStories[0]
|
||||
$iterationCount++
|
||||
$pctComplete = [math]::Round(($completedStories.Count / $prd.userStories.Count) * 100)
|
||||
|
||||
$storyLabel = "$($currentStory.id): $($currentStory.title)"
|
||||
$pctStr = "${pctComplete}%"
|
||||
$progressMsg = " Progress: $($completedStories.Count)/$($prd.userStories.Count) ($pctStr) - Remaining: $($pendingStories.Count)"
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "--- Iteration $iterationCount - $storyLabel ---" -ForegroundColor Yellow
|
||||
Write-Host $progressMsg -ForegroundColor DarkGray
|
||||
|
||||
# Record HEAD before this iteration
|
||||
$headBefore = git rev-parse HEAD 2>$null
|
||||
|
||||
$iterStart = Get-Date
|
||||
Write-Host " Started: $($iterStart.ToString('HH:mm:ss')) | Model: $Model" -ForegroundColor DarkGray
|
||||
Write-Host ""
|
||||
|
||||
# Generate prompt for this story
|
||||
$promptContent = Build-StoryPrompt -story $currentStory -prdObj $prd -completedStories $completedStories
|
||||
|
||||
# --- Spawn Claude ---
|
||||
|
||||
$logFile = Join-Path $logDir "$($currentStory.id).log"
|
||||
$rawLogFile = Join-Path $logDir "$($currentStory.id).raw.jsonl"
|
||||
$maxRetries = 10
|
||||
$retryCount = 0
|
||||
$outputString = ""
|
||||
$apiOverloaded = $false
|
||||
|
||||
do {
|
||||
$apiOverloaded = $false
|
||||
$textBuilder = [System.Text.StringBuilder]::new()
|
||||
$toolCount = 0
|
||||
|
||||
# Clear raw log file for this attempt
|
||||
if (Test-Path $rawLogFile) { Remove-Item $rawLogFile -Force }
|
||||
|
||||
if ($retryCount -gt 0) {
|
||||
$backoffSeconds = [Math]::Pow(2, $retryCount - 1)
|
||||
Write-Host " [Retry $retryCount/$maxRetries] API overloaded, waiting $backoffSeconds seconds..." -ForegroundColor DarkYellow
|
||||
Start-Sleep -Seconds $backoffSeconds
|
||||
Write-Host " Retrying Claude invocation..." -ForegroundColor DarkGray
|
||||
}
|
||||
|
||||
$promptContent | claude --print --verbose --dangerously-skip-permissions --model $Model --output-format stream-json 2>&1 | ForEach-Object {
|
||||
$line = $_.ToString().Trim()
|
||||
if (-not $line) { return }
|
||||
|
||||
# Save raw event for debugging
|
||||
try {
|
||||
Add-Content -Path $rawLogFile -Value $line -Encoding UTF8 -ErrorAction SilentlyContinue
|
||||
} catch { }
|
||||
|
||||
try {
|
||||
$evt = $line | ConvertFrom-Json -ErrorAction Stop
|
||||
|
||||
# --- Tool use start ---
|
||||
if ($evt.type -eq 'content_block_start' -and $evt.content_block.type -eq 'tool_use') {
|
||||
$toolCount++
|
||||
$toolName = $evt.content_block.name
|
||||
Write-Host " [$toolName]" -ForegroundColor DarkCyan
|
||||
}
|
||||
# --- Streaming text ---
|
||||
elseif ($evt.type -eq 'content_block_delta' -and $evt.delta.type -eq 'text_delta' -and $evt.delta.text) {
|
||||
Write-Host -NoNewline $evt.delta.text
|
||||
[void]$textBuilder.Append($evt.delta.text)
|
||||
}
|
||||
# --- Result event ---
|
||||
elseif ($evt.type -eq 'result') {
|
||||
if ($evt.subtype -eq 'error_result' -and $evt.error) {
|
||||
Write-Host " [ERROR] $($evt.error)" -ForegroundColor Red
|
||||
[void]$textBuilder.AppendLine("ERROR: $($evt.error)")
|
||||
}
|
||||
elseif ($evt.result) {
|
||||
[void]$textBuilder.AppendLine($evt.result)
|
||||
}
|
||||
}
|
||||
# --- Message-level content ---
|
||||
elseif ($evt.message -and $evt.message.content) {
|
||||
foreach ($block in $evt.message.content) {
|
||||
if ($block.type -eq 'text' -and $block.text) {
|
||||
Write-Host $block.text
|
||||
[void]$textBuilder.AppendLine($block.text)
|
||||
}
|
||||
elseif ($block.type -eq 'tool_use') {
|
||||
$toolCount++
|
||||
Write-Host " [$($block.name)]" -ForegroundColor DarkCyan
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
if ($line -and $line -notmatch '^\s*[\{\[\}\]"]') {
|
||||
Write-Host $line -ForegroundColor DarkYellow
|
||||
[void]$textBuilder.AppendLine($line)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$outputString = $textBuilder.ToString()
|
||||
|
||||
# Check for 529 overloaded error
|
||||
if ($outputString -match "529.*overloaded|overloaded_error") {
|
||||
$apiOverloaded = $true
|
||||
$retryCount++
|
||||
if ($retryCount -ge $maxRetries) {
|
||||
Write-Host " [ERROR] API overloaded after $maxRetries retries, giving up." -ForegroundColor Red
|
||||
}
|
||||
}
|
||||
# Check for usage limit with cooldown
|
||||
elseif ($outputString -match "(?i)usage limit reached.*reset at (\d{1,2})(?::(\d{2}))?\s*(am|pm)") {
|
||||
$resetHour = [int]$Matches[1]
|
||||
$resetMinute = if ($Matches[2]) { [int]$Matches[2] } else { 0 }
|
||||
$resetAmPm = $Matches[3]
|
||||
|
||||
if ($resetAmPm -ieq "pm" -and $resetHour -ne 12) { $resetHour += 12 }
|
||||
elseif ($resetAmPm -ieq "am" -and $resetHour -eq 12) { $resetHour = 0 }
|
||||
|
||||
$now = Get-Date
|
||||
$resetTime = Get-Date -Hour $resetHour -Minute $resetMinute -Second 0
|
||||
if ($resetTime -le $now) { $resetTime = $resetTime.AddDays(1) }
|
||||
$resetTime = $resetTime.AddMinutes(2)
|
||||
|
||||
$waitSeconds = [Math]::Ceiling(($resetTime - $now).TotalSeconds)
|
||||
$waitMinutes = [Math]::Ceiling($waitSeconds / 60)
|
||||
|
||||
Write-Host ""
|
||||
Write-Host " [USAGE LIMIT] Reset at $($Matches[1]) $resetAmPm. Cooling down ~$waitMinutes minutes (until $($resetTime.ToString('HH:mm')))..." -ForegroundColor Yellow
|
||||
Start-Sleep -Seconds $waitSeconds
|
||||
Write-Host " [USAGE LIMIT] Cooldown complete. Retrying..." -ForegroundColor Green
|
||||
|
||||
$apiOverloaded = $true
|
||||
}
|
||||
} while ($apiOverloaded -and $retryCount -lt $maxRetries)
|
||||
|
||||
# Save log
|
||||
$outputString | Set-Content -Path $logFile -Encoding UTF8
|
||||
|
||||
# Show elapsed time
|
||||
$elapsed = (Get-Date) - $iterStart
|
||||
Write-Host ""
|
||||
Write-Host " Finished: $(Get-Date -Format 'HH:mm:ss') (elapsed: $($elapsed.ToString('mm\:ss')), tools: $toolCount)" -ForegroundColor DarkGray
|
||||
|
||||
# --- Detect signals ---
|
||||
|
||||
$storyComplete = $outputString -match "<story-complete>$([regex]::Escape($currentStory.id))</story-complete>"
|
||||
$storyBlocked = $outputString -match "<story-blocked>$([regex]::Escape($currentStory.id))</story-blocked>"
|
||||
$headAfter = git rev-parse HEAD 2>$null
|
||||
$hasGitChanges = $headAfter -ne $headBefore
|
||||
|
||||
# --- Post-iteration typecheck verification ---
|
||||
|
||||
$typecheckPassed = $true
|
||||
if ($storyComplete -and $hasGitChanges -and -not $SkipVerify) {
|
||||
Write-Host " Verifying typecheck..." -ForegroundColor DarkGray
|
||||
$typecheckOutput = npm run typecheck 2>&1
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Host " [VERIFY FAIL] Typecheck failed after completion signal. Not marking as passed." -ForegroundColor Red
|
||||
$typecheckPassed = $false
|
||||
} else {
|
||||
Write-Host " [VERIFY OK] Typecheck passed." -ForegroundColor DarkGray
|
||||
}
|
||||
}
|
||||
|
||||
# --- Update story status ---
|
||||
|
||||
if ($storyComplete -and $hasGitChanges -and $typecheckPassed) {
|
||||
# Mark story as passed in prd.json
|
||||
$prd = Read-Prd
|
||||
$storyToUpdate = $prd.userStories | Where-Object { $_.id -eq $currentStory.id }
|
||||
if ($storyToUpdate) {
|
||||
$storyToUpdate.passes = $true
|
||||
$storyToUpdate.notes = "Completed iteration $iterationCount at $(Get-Date -Format 'yyyy-MM-dd HH:mm'). Model: $Model."
|
||||
}
|
||||
Save-Prd $prd
|
||||
|
||||
# Append to progress.txt
|
||||
$ts = Get-Date -Format 'yyyy-MM-dd HH:mm'
|
||||
$el = $elapsed.ToString('mm\:ss')
|
||||
$progressEntry = "$ts | PASS | $($currentStory.id): $($currentStory.title) | model=$Model elapsed=$el tools=$toolCount"
|
||||
Add-Content -Path $progressFile -Value $progressEntry -Encoding UTF8
|
||||
|
||||
Write-Host " [PASSED] $storyLabel" -ForegroundColor Green
|
||||
$noProgressCount = 0
|
||||
$sameErrorCount = 0
|
||||
$lastErrorSignature = ""
|
||||
}
|
||||
elseif ($storyBlocked) {
|
||||
$ts = Get-Date -Format 'yyyy-MM-dd HH:mm'
|
||||
$progressEntry = "$ts | BLOCKED | $storyLabel"
|
||||
Add-Content -Path $progressFile -Value $progressEntry -Encoding UTF8
|
||||
Write-Host " [BLOCKED] $storyLabel - check $logFile for details." -ForegroundColor Red
|
||||
# Blocked counts as no progress
|
||||
$noProgressCount++
|
||||
}
|
||||
elseif ($storyComplete -and -not $hasGitChanges) {
|
||||
Write-Host " [WARNING] Completion signaled but no git commits. Retrying story." -ForegroundColor DarkYellow
|
||||
$noProgressCount++
|
||||
}
|
||||
elseif ($storyComplete -and -not $typecheckPassed) {
|
||||
Write-Host " [WARNING] Completion signaled but typecheck failed. Retrying story." -ForegroundColor DarkYellow
|
||||
$ts = Get-Date -Format 'yyyy-MM-dd HH:mm'
|
||||
$progressEntry = "$ts | TYPECHECK_FAIL | $storyLabel"
|
||||
Add-Content -Path $progressFile -Value $progressEntry -Encoding UTF8
|
||||
# Has git changes, so not stalled — but not passed either
|
||||
$noProgressCount = 0
|
||||
}
|
||||
else {
|
||||
# No completion signal
|
||||
if ($hasGitChanges) {
|
||||
Write-Host " [PARTIAL] Git changes but no completion signal. Retrying story." -ForegroundColor DarkYellow
|
||||
$ts = Get-Date -Format 'yyyy-MM-dd HH:mm'
|
||||
$progressEntry = "$ts | PARTIAL | $storyLabel"
|
||||
Add-Content -Path $progressFile -Value $progressEntry -Encoding UTF8
|
||||
$noProgressCount = 0
|
||||
} else {
|
||||
Write-Host " [NO PROGRESS] No changes and no signal." -ForegroundColor DarkYellow
|
||||
$noProgressCount++
|
||||
}
|
||||
}
|
||||
|
||||
# --- Circuit Breaker: No Progress ---
|
||||
|
||||
if ($noProgressCount -ge $MaxNoProgress) {
|
||||
Write-Host ""
|
||||
Write-Host "===== CIRCUIT BREAKER: NO PROGRESS =====" -ForegroundColor Red
|
||||
Write-Host "No meaningful progress for $MaxNoProgress consecutive iterations." -ForegroundColor Red
|
||||
Write-Host "Stuck on: $($currentStory.id) — $($currentStory.title)" -ForegroundColor Red
|
||||
Write-Host "Check $logFile for details." -ForegroundColor Red
|
||||
break
|
||||
}
|
||||
|
||||
# --- Circuit Breaker: Repeated Error ---
|
||||
|
||||
$errorLines = $outputString | Select-String -Pattern "(?i)(error|exception|failed|fatal)[:.].*" -AllMatches
|
||||
if ($errorLines) {
|
||||
$filteredErrors = $errorLines.Matches | Where-Object { $_.Value -notmatch "529|overloaded" } | Select-Object -First 3
|
||||
$currentErrorSignature = ($filteredErrors | ForEach-Object { $_.Value }) -join "|"
|
||||
if ($currentErrorSignature -and $currentErrorSignature -eq $lastErrorSignature) {
|
||||
$sameErrorCount++
|
||||
Write-Host " [Circuit Breaker] Same error pattern repeated ($sameErrorCount/$MaxSameError)" -ForegroundColor DarkYellow
|
||||
if ($sameErrorCount -ge $MaxSameError) {
|
||||
Write-Host ""
|
||||
Write-Host "===== CIRCUIT BREAKER: REPEATED ERROR =====" -ForegroundColor Red
|
||||
Write-Host "Same error for $MaxSameError consecutive iterations:" -ForegroundColor Red
|
||||
Write-Host " $currentErrorSignature" -ForegroundColor Red
|
||||
break
|
||||
}
|
||||
} elseif ($currentErrorSignature) {
|
||||
$sameErrorCount = 0
|
||||
}
|
||||
$lastErrorSignature = $currentErrorSignature
|
||||
} else {
|
||||
$sameErrorCount = 0
|
||||
$lastErrorSignature = ""
|
||||
}
|
||||
|
||||
# --- Dynamic Model Selection ---
|
||||
|
||||
if ($outputString -match "<next-model>(opus|sonnet)</next-model>") {
|
||||
$nextModel = $Matches[1]
|
||||
if ($nextModel -ne $Model) {
|
||||
Write-Host " [Model Switch] $Model -> $nextModel (agent recommendation)" -ForegroundColor Magenta
|
||||
$Model = $nextModel
|
||||
}
|
||||
}
|
||||
|
||||
# Brief pause between iterations
|
||||
Start-Sleep -Seconds 2
|
||||
}
|
||||
|
||||
} finally {
|
||||
# Cleanup: restore directory, kill dev server
|
||||
Set-Location $originalDir
|
||||
if ($devServerPid) {
|
||||
Write-Host "Stopping dev server (PID $devServerPid)..." -ForegroundColor DarkGray
|
||||
taskkill /T /F /PID $devServerPid 2>$null | Out-Null
|
||||
}
|
||||
}
|
||||
|
||||
# --- Final Summary ---
|
||||
|
||||
$prd = Read-Prd
|
||||
$finalPassed = @($prd.userStories | Where-Object { $_.passes -eq $true }).Count
|
||||
$finalTotal = $prd.userStories.Count
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "===========================================" -ForegroundColor Cyan
|
||||
Write-Host " Ralph Loop finished after $iterationCount iteration(s)" -ForegroundColor Cyan
|
||||
Write-Host " Stories: $finalPassed/$finalTotal passed" -ForegroundColor Cyan
|
||||
Write-Host " Branch: $BranchName" -ForegroundColor Cyan
|
||||
Write-Host " Logs: $logDir" -ForegroundColor Cyan
|
||||
Write-Host "===========================================" -ForegroundColor Cyan
|
||||
|
||||
if ($finalPassed -eq $finalTotal) {
|
||||
exit 0
|
||||
} else {
|
||||
exit 1
|
||||
}
|
||||
|
||||
+42
-2
@@ -7,9 +7,16 @@ yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
lerna-debug.log*
|
||||
|
||||
# Environment
|
||||
.env
|
||||
|
||||
# Dependencies
|
||||
node_modules
|
||||
|
||||
# Build output
|
||||
dist
|
||||
dist-ssr
|
||||
dist-server
|
||||
*.local
|
||||
|
||||
# Editor directories and files
|
||||
@@ -26,7 +33,40 @@ dist-ssr
|
||||
# TypeScript
|
||||
*.tsbuildinfo
|
||||
|
||||
#Playwrite Screenshots
|
||||
# Playwright screenshots
|
||||
*.png
|
||||
!public/meta.png
|
||||
|
||||
nul
|
||||
# AI agent tooling
|
||||
.claude/
|
||||
.codex/
|
||||
.ralph/
|
||||
.playwright-mcp/
|
||||
AGENTS.md
|
||||
PROMPT.md
|
||||
hats.yml
|
||||
ralph.yml
|
||||
scripts/ralph/
|
||||
scripts/benchmark-results/
|
||||
|
||||
# Reference / personal materials
|
||||
References/
|
||||
|
||||
# Font source archives (used fonts are in public/fonts/)
|
||||
Fonts/
|
||||
|
||||
# Logo animation source (Remotion)
|
||||
LogoAnimation/
|
||||
|
||||
# Design notes
|
||||
carousel-design-debate*.md
|
||||
|
||||
# Misc
|
||||
*:Zone.Identifier
|
||||
__MACOSX
|
||||
andy-charlwood-cv@0.0.0
|
||||
lighthouse.pdf
|
||||
logo/
|
||||
graph.png
|
||||
node
|
||||
nul
|
||||
|
||||
@@ -1,278 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
'use strict';
|
||||
|
||||
var chalk = require('chalk'),
|
||||
os = require('os'),
|
||||
httpServer = require('../lib/http-server'),
|
||||
portfinder = require('portfinder'),
|
||||
opener = require('opener'),
|
||||
|
||||
fs = require('fs'),
|
||||
url = require('url');
|
||||
var argv = require('minimist')(process.argv.slice(2), {
|
||||
alias: {
|
||||
tls: 'ssl'
|
||||
}
|
||||
});
|
||||
var ifaces = os.networkInterfaces();
|
||||
|
||||
process.title = 'http-server';
|
||||
|
||||
if (argv.h || argv.help) {
|
||||
console.log([
|
||||
'usage: http-server [path] [options]',
|
||||
'',
|
||||
'options:',
|
||||
' -p --port Port to use. If 0, look for open port. [8080]',
|
||||
' -a Address to use [0.0.0.0]',
|
||||
' -d Show directory listings [true]',
|
||||
' -i Display autoIndex [true]',
|
||||
' -g --gzip Serve gzip files when possible [false]',
|
||||
' -b --brotli Serve brotli files when possible [false]',
|
||||
' If both brotli and gzip are enabled, brotli takes precedence',
|
||||
' -e --ext Default file extension if none supplied [none]',
|
||||
' -s --silent Suppress log messages from output',
|
||||
' --cors[=headers] Enable CORS via the "Access-Control-Allow-Origin" header',
|
||||
' Optionally provide CORS headers list separated by commas',
|
||||
' -o [path] Open browser window after starting the server.',
|
||||
' Optionally provide a URL path to open the browser window to.',
|
||||
' -c Cache time (max-age) in seconds [3600], e.g. -c10 for 10 seconds.',
|
||||
' To disable caching, use -c-1.',
|
||||
' -t Connections timeout in seconds [120], e.g. -t60 for 1 minute.',
|
||||
' To disable timeout, use -t0',
|
||||
' -U --utc Use UTC time format in log messages.',
|
||||
' --log-ip Enable logging of the client\'s IP address',
|
||||
'',
|
||||
' -P --proxy Fallback proxy if the request cannot be resolved. e.g.: http://someurl.com',
|
||||
' --proxy-options Pass options to proxy using nested dotted objects. e.g.: --proxy-options.secure false',
|
||||
'',
|
||||
' --username Username for basic authentication [none]',
|
||||
' Can also be specified with the env variable NODE_HTTP_SERVER_USERNAME',
|
||||
' --password Password for basic authentication [none]',
|
||||
' Can also be specified with the env variable NODE_HTTP_SERVER_PASSWORD',
|
||||
'',
|
||||
' -S --tls --ssl Enable secure request serving with TLS/SSL (HTTPS)',
|
||||
' -C --cert Path to TLS cert file (default: cert.pem)',
|
||||
' -K --key Path to TLS key file (default: key.pem)',
|
||||
'',
|
||||
' -r --robots Respond to /robots.txt [User-agent: *\\nDisallow: /]',
|
||||
' --no-dotfiles Do not show dotfiles',
|
||||
' --mimetypes Path to a .types file for custom mimetype definition',
|
||||
' -h --help Print this list and exit.',
|
||||
' -v --version Print the version and exit.'
|
||||
].join('\n'));
|
||||
process.exit();
|
||||
}
|
||||
|
||||
var port = argv.p || argv.port || parseInt(process.env.PORT, 10),
|
||||
host = argv.a || '0.0.0.0',
|
||||
tls = argv.S || argv.tls,
|
||||
sslPassphrase = process.env.NODE_HTTP_SERVER_SSL_PASSPHRASE,
|
||||
proxy = argv.P || argv.proxy,
|
||||
proxyOptions = argv['proxy-options'],
|
||||
utc = argv.U || argv.utc,
|
||||
version = argv.v || argv.version,
|
||||
logger;
|
||||
|
||||
var proxyOptionsBooleanProps = [
|
||||
'ws', 'xfwd', 'secure', 'toProxy', 'prependPath', 'ignorePath', 'changeOrigin',
|
||||
'preserveHeaderKeyCase', 'followRedirects', 'selfHandleResponse'
|
||||
];
|
||||
|
||||
if (proxyOptions) {
|
||||
Object.keys(proxyOptions).forEach(function (key) {
|
||||
if (proxyOptionsBooleanProps.indexOf(key) > -1) {
|
||||
proxyOptions[key] = proxyOptions[key].toLowerCase() === 'true';
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (!argv.s && !argv.silent) {
|
||||
logger = {
|
||||
info: console.log,
|
||||
request: function (req, res, error) {
|
||||
var date = utc ? new Date().toUTCString() : new Date();
|
||||
var ip = argv['log-ip']
|
||||
? req.headers['x-forwarded-for'] || '' + req.connection.remoteAddress
|
||||
: '';
|
||||
if (error) {
|
||||
logger.info(
|
||||
'[%s] %s "%s %s" Error (%s): "%s"',
|
||||
date, ip, chalk.red(req.method), chalk.red(req.url),
|
||||
chalk.red(error.status.toString()), chalk.red(error.message)
|
||||
);
|
||||
}
|
||||
else {
|
||||
logger.info(
|
||||
'[%s] %s "%s %s" "%s"',
|
||||
date, ip, chalk.cyan(req.method), chalk.cyan(req.url),
|
||||
req.headers['user-agent']
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
else if (chalk) {
|
||||
logger = {
|
||||
info: function () {},
|
||||
request: function () {}
|
||||
};
|
||||
}
|
||||
|
||||
if (version) {
|
||||
logger.info('v' + require('../package.json').version);
|
||||
process.exit();
|
||||
}
|
||||
|
||||
if (!port) {
|
||||
portfinder.basePort = 8080;
|
||||
portfinder.getPort(function (err, port) {
|
||||
if (err) { throw err; }
|
||||
listen(port);
|
||||
});
|
||||
}
|
||||
else {
|
||||
listen(port);
|
||||
}
|
||||
|
||||
function listen(port) {
|
||||
var options = {
|
||||
root: argv._[0],
|
||||
cache: argv.c,
|
||||
timeout: argv.t,
|
||||
showDir: argv.d,
|
||||
autoIndex: argv.i,
|
||||
gzip: argv.g || argv.gzip,
|
||||
brotli: argv.b || argv.brotli,
|
||||
robots: argv.r || argv.robots,
|
||||
ext: argv.e || argv.ext,
|
||||
logFn: logger.request,
|
||||
proxy: proxy,
|
||||
proxyOptions: proxyOptions,
|
||||
showDotfiles: argv.dotfiles,
|
||||
mimetypes: argv.mimetypes,
|
||||
username: argv.username || process.env.NODE_HTTP_SERVER_USERNAME,
|
||||
password: argv.password || process.env.NODE_HTTP_SERVER_PASSWORD
|
||||
};
|
||||
|
||||
if (argv.cors) {
|
||||
options.cors = true;
|
||||
if (typeof argv.cors === 'string') {
|
||||
options.corsHeaders = argv.cors;
|
||||
}
|
||||
}
|
||||
|
||||
if (proxy) {
|
||||
try {
|
||||
new url.URL(proxy)
|
||||
}
|
||||
catch (err) {
|
||||
logger.info(chalk.red('Error: Invalid proxy url'));
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
if (tls) {
|
||||
options.https = {
|
||||
cert: argv.C || argv.cert || 'cert.pem',
|
||||
key: argv.K || argv.key || 'key.pem',
|
||||
passphrase: sslPassphrase,
|
||||
};
|
||||
try {
|
||||
fs.lstatSync(options.https.cert);
|
||||
}
|
||||
catch (err) {
|
||||
logger.info(chalk.red('Error: Could not find certificate ' + options.https.cert));
|
||||
process.exit(1);
|
||||
}
|
||||
try {
|
||||
fs.lstatSync(options.https.key);
|
||||
}
|
||||
catch (err) {
|
||||
logger.info(chalk.red('Error: Could not find private key ' + options.https.key));
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
var server = httpServer.createServer(options);
|
||||
server.listen(port, host, function () {
|
||||
var protocol = tls ? 'https://' : 'http://';
|
||||
|
||||
logger.info([
|
||||
chalk.yellow('Starting up http-server, serving '),
|
||||
chalk.cyan(server.root),
|
||||
tls ? (chalk.yellow(' through') + chalk.cyan(' https')) : ''
|
||||
].join(''));
|
||||
|
||||
logger.info([chalk.yellow('\nhttp-server version: '), chalk.cyan(require('../package.json').version)].join(''));
|
||||
|
||||
logger.info([
|
||||
chalk.yellow('\nhttp-server settings: '),
|
||||
([chalk.yellow('CORS: '), argv.cors ? chalk.cyan(argv.cors) : chalk.red('disabled')].join('')),
|
||||
([chalk.yellow('Cache: '), argv.c ? (argv.c === '-1' ? chalk.red('disabled') : chalk.cyan(argv.c + ' seconds')) : chalk.cyan('3600 seconds')].join('')),
|
||||
([chalk.yellow('Connection Timeout: '), argv.t === '0' ? chalk.red('disabled') : (argv.t ? chalk.cyan(argv.t + ' seconds') : chalk.cyan('120 seconds'))].join('')),
|
||||
([chalk.yellow('Directory Listings: '), argv.d ? chalk.red('not visible') : chalk.cyan('visible')].join('')),
|
||||
([chalk.yellow('AutoIndex: '), argv.i ? chalk.red('not visible') : chalk.cyan('visible')].join('')),
|
||||
([chalk.yellow('Serve GZIP Files: '), argv.g || argv.gzip ? chalk.cyan('true') : chalk.red('false')].join('')),
|
||||
([chalk.yellow('Serve Brotli Files: '), argv.b || argv.brotli ? chalk.cyan('true') : chalk.red('false')].join('')),
|
||||
([chalk.yellow('Default File Extension: '), argv.e ? chalk.cyan(argv.e) : (argv.ext ? chalk.cyan(argv.ext) : chalk.red('none'))].join(''))
|
||||
].join('\n'));
|
||||
|
||||
logger.info(chalk.yellow('\nAvailable on:'));
|
||||
|
||||
if (argv.a && host !== '0.0.0.0') {
|
||||
logger.info(` ${protocol}${host}:${chalk.green(port.toString())}`);
|
||||
} else {
|
||||
Object.keys(ifaces).forEach(function (dev) {
|
||||
ifaces[dev].forEach(function (details) {
|
||||
if (details.family === 'IPv4') {
|
||||
logger.info((' ' + protocol + details.address + ':' + chalk.green(port.toString())));
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
if (typeof proxy === 'string') {
|
||||
if (proxyOptions) {
|
||||
logger.info('Unhandled requests will be served from: ' + proxy + '. Options: ' + JSON.stringify(proxyOptions));
|
||||
}
|
||||
else {
|
||||
logger.info('Unhandled requests will be served from: ' + proxy);
|
||||
}
|
||||
}
|
||||
|
||||
logger.info('Hit CTRL-C to stop the server');
|
||||
if (argv.o) {
|
||||
const openHost = host === '0.0.0.0' ? '127.0.0.1' : host;
|
||||
let openUrl = `${protocol}${openHost}:${port}`;
|
||||
if (typeof argv.o === 'string') {
|
||||
openUrl += argv.o[0] === '/' ? argv.o : '/' + argv.o;
|
||||
}
|
||||
logger.info('Open: ' + openUrl);
|
||||
opener(openUrl);
|
||||
}
|
||||
|
||||
// Spacing before logs
|
||||
if (!argv.s) logger.info();
|
||||
});
|
||||
}
|
||||
|
||||
if (process.platform === 'win32') {
|
||||
require('readline').createInterface({
|
||||
input: process.stdin,
|
||||
output: process.stdout
|
||||
}).on('SIGINT', function () {
|
||||
process.emit('SIGINT');
|
||||
});
|
||||
}
|
||||
|
||||
process.on('SIGINT', function () {
|
||||
logger.info(chalk.red('http-server stopped.'));
|
||||
process.exit();
|
||||
});
|
||||
|
||||
process.on('SIGTERM', function () {
|
||||
logger.info(chalk.red('http-server stopped.'));
|
||||
process.exit();
|
||||
});
|
||||
@@ -1,27 +0,0 @@
|
||||
{
|
||||
"iterations": [
|
||||
{
|
||||
"iteration": 1,
|
||||
"startedAt": "2026-02-11T22:50:15.397Z",
|
||||
"endedAt": "2026-02-11T22:55:02.081Z",
|
||||
"durationMs": 283525,
|
||||
"toolsUsed": {},
|
||||
"filesModified": [
|
||||
"Ralph/IMPLEMENTATION_PLAN.md",
|
||||
"Ralph/progress.txt",
|
||||
"src/App.tsx",
|
||||
"src/components/BootSequence.tsx",
|
||||
"src/components/ECGAnimation.tsx"
|
||||
],
|
||||
"exitCode": 0,
|
||||
"completionDetected": false,
|
||||
"errors": []
|
||||
}
|
||||
],
|
||||
"totalDurationMs": 283525,
|
||||
"struggleIndicators": {
|
||||
"repeatedErrors": {},
|
||||
"noProgressIterations": 0,
|
||||
"shortIterations": 0
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -1,20 +0,0 @@
|
||||
{
|
||||
"$schema": "https://opencode.ai/config.json",
|
||||
"permission": {
|
||||
"read": "allow",
|
||||
"edit": "allow",
|
||||
"glob": "allow",
|
||||
"grep": "allow",
|
||||
"list": "allow",
|
||||
"bash": "allow",
|
||||
"task": "allow",
|
||||
"webfetch": "allow",
|
||||
"websearch": "allow",
|
||||
"codesearch": "allow",
|
||||
"todowrite": "allow",
|
||||
"todoread": "allow",
|
||||
"question": "allow",
|
||||
"lsp": "allow",
|
||||
"external_directory": "allow"
|
||||
}
|
||||
}
|
||||
@@ -2,217 +2,63 @@
|
||||
|
||||
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
||||
|
||||
## Project Overview
|
||||
|
||||
Interactive CV/portfolio for Andy Charlwood, presented as a GP clinical record system. The concept: *what if a GP surgery's patient record system were redesigned by a luxury product studio?* The structure and metaphor of a real clinical system (tiles as record sections, status indicators, medication-style skill entries, alerts) — but elevated with refined typography, considered motion, and a modern light aesthetic.
|
||||
|
||||
**This is NOT a faithful NHS system clone.** It's a showcase portfolio that *evokes* the feel of clinical software while being distinctly beautiful. The clinical metaphor is the creative conceit; the execution should feel premium and contemporary.
|
||||
|
||||
Built as a React SPA with TypeScript and Vite.
|
||||
|
||||
**Reference design:** `References/GPSystemconcept.html` — the visual and structural target for the dashboard.
|
||||
|
||||
## Commands
|
||||
|
||||
- `npm run dev` — Start dev server (localhost:5173)
|
||||
- `npm run build` — TypeScript compile + Vite production build
|
||||
- `npm run typecheck` — TypeScript type checking only (`tsc --noEmit`)
|
||||
- `npm run lint` — ESLint
|
||||
- `npm run preview` — Preview production build
|
||||
```bash
|
||||
npm run dev # Vite dev server (localhost:5173)
|
||||
npm run build # TypeScript compile + Vite production build
|
||||
npm run preview # Preview production build locally
|
||||
npm run lint # ESLint
|
||||
npm run typecheck # TypeScript checks (no emit)
|
||||
npm run generate-embeddings # Regenerate semantic search embeddings (src/data/embeddings.json)
|
||||
```
|
||||
|
||||
No test framework is configured.
|
||||
**Validation gate (run before any PR):** `npm run lint && npm run typecheck && npm run build`
|
||||
|
||||
No automated test framework — lint, typecheck, and build are the quality gates. For UI changes, verify manually (responsive behavior, accessibility, keyboard navigation).
|
||||
|
||||
## Architecture
|
||||
|
||||
### Four-Phase UI Flow
|
||||
**Interactive CV/portfolio** with a PMR (patient medical record) interface aesthetic. Three-phase UX: terminal boot → ECG heartbeat → dashboard.
|
||||
|
||||
`App.tsx` manages a `Phase` state (`'boot'` → `'ecg'` → `'login'` → `'pmr'`). Each phase renders exclusively:
|
||||
### App lifecycle (`src/App.tsx`)
|
||||
Phase orchestrator managing: BootSequence → ECGAnimation → LoginScreen → DashboardLayout
|
||||
|
||||
1. **BootSequence** — Terminal typing animation (~4s), green-on-black aesthetic. Fira Code font, matrix-green palette. **Locked — do not change.**
|
||||
2. **ECGAnimation** — Canvas-based heartbeat animation with mask-based letter tracing. Background transitions from black to `#1E293B`. **Locked — do not change.**
|
||||
3. **LoginScreen** — Animated login card on dark background. Types credentials at a natural pace, then presents an interactive "Log In" button for the user to click. Login transitions to the dashboard.
|
||||
4. **DashboardLayout** — The main portfolio experience: TopBar + Sidebar + scrollable tile-based dashboard.
|
||||
### Data flow
|
||||
- **Canonical source:** `src/data/timeline.ts` — all career + education entities live here
|
||||
- **Derived data:** `constellation.ts` builds D3 graph data from timeline; `consultations.ts` re-exports for legacy consumers; `tags.ts` derived from skills; `kpis.ts` standalone
|
||||
- **Types:** `src/types/pmr.ts` has all domain types (Consultation, TimelineEntity, ConstellationNode, etc.)
|
||||
|
||||
### Dashboard Layout (Post-Login)
|
||||
### Key subsystems
|
||||
|
||||
The dashboard uses a three-zone layout:
|
||||
| Subsystem | Entry point | Notes |
|
||||
|-----------|-------------|-------|
|
||||
| Dashboard | `DashboardLayout.tsx` | Orchestrates tiles, constellation, timeline, detail panel |
|
||||
| Career Constellation | `CareerConstellation.tsx` | D3 force simulation; roles as clusters, skills as nodes; hover/click/tap/keyboard |
|
||||
| Detail Panel | `DetailPanelContext.tsx` + `DetailPanel.tsx` | Right-side slide-out; context-aware views per entity type |
|
||||
| Semantic Search | `lib/semantic-search.ts` + `lib/embedding-model.ts` | Pre-computed embeddings + local Xenova transformer model in browser |
|
||||
| Command Palette | `CommandPalette.tsx` | Ctrl+K; fuzzy (Fuse.js) + semantic search |
|
||||
| Chat Widget | `ChatWidget.tsx` + `lib/llm.ts` | Gemini/OpenRouter LLM integration; requires `.env` API keys |
|
||||
| Accessibility | `AccessibilityContext.tsx` | Focus management, reduced motion, ARIA |
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────────────┐
|
||||
│ TopBar (fixed, 48px) — brand, search, session │
|
||||
├──────────┬──────────────────────────────────────────┤
|
||||
│ │ │
|
||||
│ Sidebar │ Card Grid (scrollable) │
|
||||
│ (272px) │ ┌─────────────────────────────────┐ │
|
||||
│ │ │ Patient Summary (full width) │ │
|
||||
│ Person │ ├────────────────┬────────────────┤ │
|
||||
│ Header │ │ Latest Results │ Repeat Meds │ │
|
||||
│ │ │ (KPIs) │ (Core Skills) │ │
|
||||
│ Tags │ ├────────────────┴────────────────┤ │
|
||||
│ │ │ Last Consultation (full width) │ │
|
||||
│ Alerts │ ├─────────────────────────────────┤ │
|
||||
│ │ │ Career Activity (full width) │ │
|
||||
│ │ ├─────────────────────────────────┤ │
|
||||
│ │ │ Education (full width) │ │
|
||||
│ │ ├─────────────────────────────────┤ │
|
||||
│ │ │ Projects (full width) │ │
|
||||
│ │ └─────────────────────────────────┘ │
|
||||
└──────────┴──────────────────────────────────────────┘
|
||||
```
|
||||
### D3 integration pattern
|
||||
`CareerConstellation.tsx` manages D3 force simulation imperatively via refs. Highlight state tracked with refs (not React state) to avoid unnecessary re-renders. Touch: tap to pin, background tap to clear. Keyboard: Tab through nodes, Enter/Space activate, Escape reset.
|
||||
|
||||
**No view switching.** The dashboard is a single scrollable page of tiles. Users scroll to see all sections. Detail drill-down happens by expanding tiles in-place (accordion pattern).
|
||||
## Conventions
|
||||
|
||||
### Key Patterns
|
||||
- **TypeScript strict mode** — `noUnusedLocals`, `noUnusedParameters` enforced
|
||||
- **Path alias:** `@/*` → `src/*` (configured in vite.config.ts + tsconfig.json)
|
||||
- **Components:** PascalCase (`DashboardLayout.tsx`); Hooks: `useCamelCase`; Utilities: kebab-case (`semantic-search.ts`)
|
||||
- **Styling:** Tailwind utility classes + inline `CSSProperties` for dynamic/theme values
|
||||
- **Animations:** Framer Motion; respects `prefers-reduced-motion`
|
||||
- **Commits:** Conventional Commit prefixes (`feat:`, `chore:`, `fix:`) + optional story IDs
|
||||
|
||||
- **Canvas ECG**: `ECGAnimation.tsx` does imperative canvas drawing with requestAnimationFrame — flatline → 3 heartbeats (40px→60px→100px) → mask-based letter tracing → exit. **Locked — do not change.**
|
||||
- **TopBar**: `TopBar.tsx` — fixed at top, brand + search trigger + session info. Search bar triggers Command Palette on click/Ctrl+K.
|
||||
- **Sidebar**: `Sidebar.tsx` — light background, contains PersonHeader (avatar, name, title, status, details), Tags, and Alerts only. Skills, Projects, Education are in the main content tiles.
|
||||
- **Card Grid**: CSS Grid, 2 columns on desktop (gap 16px), 1 column on mobile. Tiles use a reusable `Card` component with consistent styling.
|
||||
- **Tile Expansion**: Career Activity items, Project items, and Skill items expand in-place with height-only animation (200ms, ease-out). Single-expand accordion — only one item open at a time.
|
||||
- **KPI Flip Cards**: Latest Results metrics flip on click to show explanation text. CSS perspective transform, 400ms.
|
||||
- **Command Palette**: Ctrl+K opens a Spotlight-style search overlay. Fuzzy search via fuse.js. Keyboard navigation (arrow keys, Enter, Escape).
|
||||
- **Staggered entrance**: TopBar slides down → Sidebar slides from left → Content fades in. Quick (200-300ms).
|
||||
- **Expandable content**: Height-only animation, 200ms ease-out. Content grows/shrinks — no opacity fade.
|
||||
- **Responsive breakpoints**: Desktop (full sidebar + 2-col grid), Tablet (collapsed/hidden sidebar + 1-col), Mobile (no sidebar, stacked tiles).
|
||||
## Design tokens
|
||||
|
||||
### Path Aliases
|
||||
|
||||
`@/` maps to `./src/` (configured in both `vite.config.ts` and `tsconfig.json`).
|
||||
|
||||
### Type System
|
||||
|
||||
All data types live in `src/types/index.ts` and `src/types/pmr.ts`. Strict TypeScript — no `any` types. One component per file with typed props interfaces.
|
||||
|
||||
## Design Direction: GP System Dashboard
|
||||
|
||||
The aesthetic direction is a **modern GP system dashboard** — the precision and information density of a medical records system, but with a light, contemporary, premium feel. Think: a healthcare SaaS product redesigned by a Swiss product studio.
|
||||
|
||||
### Tone
|
||||
|
||||
- **Precise, not cold.** Every element has a reason. Spacing is generous but intentional.
|
||||
- **Light, not washed out.** Warm sage background, clean white surfaces, deliberate color accents.
|
||||
- **Technical, not sterile.** Monospace data, status indicators, and coded entries create authentic texture.
|
||||
- **Elegant, not decorative.** No gratuitous ornament. Beauty comes from proportion, contrast, and type.
|
||||
|
||||
### Typography
|
||||
|
||||
Typography is the primary vehicle for premium feel. Avoid generic system fonts.
|
||||
|
||||
- **UI / Body:**
|
||||
- **Elvaro Grotesque** (primary, `font-ui`) — Modern grotesque sans-serif. 7 weights (300-900). Institutional credibility with premium feel. Slightly condensed proportions suit data-dense UI.
|
||||
- **Blumir** (alternative, `font-ui-alt`) — Geometric-humanist hybrid. Variable font (100-700). More refined/luxurious feel.
|
||||
- Both fonts sourced from Envato (licensed), stored in `Fonts/`. **Do not use Inter, Roboto, DM Sans, or system defaults.**
|
||||
- Font files: Elvaro `Fonts/Elvaro Grotesque Sans Family/WOFF/TBJElvaro-*.woff2`, Blumir `Fonts/blumir-font-family/WOFF/Blumir-VF.woff2`
|
||||
- **Monospace / Data**: Geist Mono for timestamps, session info, GPhC number, dates, coded entries. Creates "technical texture."
|
||||
- **Terminal phase**: Fira Code — locked, do not change.
|
||||
- **Type scale**: Tight. Headings 15-18px, body 12.5-14px, labels 10-12px. Precision over drama.
|
||||
- **Weight hierarchy**: Use weight (400/500/600/700) rather than size to establish hierarchy.
|
||||
|
||||
### Color Palette
|
||||
|
||||
The palette anchors on teal as the primary accent, with a light sidebar + warm content background.
|
||||
|
||||
- **Teal `#0D6E6E`** — Primary accent. Active states, links, avatar gradient, interactive elements. Hover: `#0A8080`. Light: `rgba(10,128,128,0.08)`.
|
||||
- **Background `#F0F5F4`** — Warm sage. The content area feels organic, not flat gray.
|
||||
- **Sidebar `#F7FAFA`** — Very light. Right border `#D4E0DE` separates from content.
|
||||
- **TopBar `#FFFFFF`** — White surface. Bottom border `#D4E0DE`.
|
||||
- **Cards `#FFFFFF`** — White with shadow-sm and border-light. Hover deepens to shadow-md.
|
||||
- **Status colors**: Success `#059669`, Amber `#D97706`, Alert `#DC2626`, Purple `#7C3AED` — each with light bg and border variants. Always paired with text labels.
|
||||
- **Text**: Primary `#1A2B2A`, Secondary `#5B7A78`, Tertiary `#8DA8A5`. Use full range for hierarchy.
|
||||
- **Borders**: Structural `#D4E0DE`, Cards/inner `#E4EDEB`.
|
||||
|
||||
### Shadows & Depth
|
||||
|
||||
Three-tier shadow system for layered depth:
|
||||
|
||||
- **Cards (resting)**: `0 1px 2px rgba(26,43,42,0.05)` — gentle, always present.
|
||||
- **Cards (hover/interactive)**: `0 2px 8px rgba(26,43,42,0.08)` — slightly lifted.
|
||||
- **Overlays (command palette, modals)**: `0 8px 32px rgba(26,43,42,0.12)` — clearly elevated.
|
||||
- **Hover states**: Shadow deepens + border color strengthens. Subtle, not dramatic.
|
||||
|
||||
### Motion
|
||||
|
||||
Motion should feel considered and premium, never flashy:
|
||||
|
||||
- **Entrance animations**: Dashboard materializes in sequence — TopBar slides down → Sidebar slides from left → Content fades in. Quick (200-300ms) with easing.
|
||||
- **Login typing**: 80ms/char for username, 60ms/dot for password. Natural, readable pace. After typing completes, "Log In" button becomes interactive — user clicks to proceed.
|
||||
- **Login transition**: On button click, card scales slightly and fades. Transition to dashboard layout.
|
||||
- **Tile expansion**: Height-only animation, 200ms ease-out. Content grows/shrinks — no opacity fade.
|
||||
- **KPI flip**: CSS perspective rotateY, 400ms ease-in-out. Click to flip, click to flip back.
|
||||
- **Command palette**: Scale 0.97→1.0 + translateY entrance, 200ms. Backdrop fade.
|
||||
- **Hover states**: Subtle, immediate. Border color shifts, shadow deepens. Think: OS-level responsiveness.
|
||||
- **`prefers-reduced-motion`**: All animations skip to final state. No exceptions.
|
||||
|
||||
### Spatial Composition
|
||||
|
||||
- **Generous but structured.** Cards have 20px padding. Tile grid has 16px gap. Sections breathe.
|
||||
- **Clear visual hierarchy.** Card headers: uppercase, small (12px), tracked-out, secondary color with colored dot indicator.
|
||||
- **Two-column grid** on desktop, single column on mobile. Full-width tiles span both columns.
|
||||
- **Sidebar sections** separated by thin divider titles (10px, uppercase, tertiary, with line extending right).
|
||||
|
||||
### What Makes It Memorable
|
||||
|
||||
The distinctiveness comes from the *clinical metaphor applied to a modern interface*:
|
||||
- A light, professional sidebar with clinical-style person header and alert flags
|
||||
- Skills presented as "Repeat Medications" with frequency dosing (twice daily, when required)
|
||||
- KPI metrics that flip to reveal explanations, like interactive test results
|
||||
- Career history as a clinical timeline with color-coded entry types
|
||||
- The boot sequence → ECG → login flow is theatrical in a way that real clinical software never is
|
||||
- Command palette (Ctrl+K) for searching records, like a clinical search tool
|
||||
|
||||
## Styling
|
||||
|
||||
Tailwind CSS with custom design tokens in `tailwind.config.js`:
|
||||
- **Color tokens**: PMR-prefixed tokens (`pmr-accent`, `pmr-bg`, `pmr-surface`, `pmr-sidebar`, `pmr-text-primary`, etc.)
|
||||
- **Fonts**: `font-ui` (Elvaro Grotesque), `font-ui-alt` (Blumir), `font-geist` (Geist Mono), `font-mono` (Fira Code for terminal)
|
||||
- **Breakpoints**: xs 480px, sm 640px, md 768px, lg 1024px, xl 1280px
|
||||
- **Border radius**: 8px default for cards/tiles (`var(--radius)`). 6px for inner elements (`var(--radius-sm)`). 12px exception for login card and command palette.
|
||||
- **Shadows**: `shadow-sm`, `shadow-md`, `shadow-lg` tokens matching three-tier system.
|
||||
- CSS custom properties in `index.css` for both boot/ECG phase tokens and dashboard phase tokens.
|
||||
- Inline styles only for dynamic values that Tailwind can't express.
|
||||
|
||||
## Guardrails
|
||||
|
||||
- **Boot sequence**: Text, colors, and timing must match `References/concept.html` exactly. **Do not modify.**
|
||||
- **ECG animation**: Timing, amplitudes, color transitions, and mask-based text reveal must match the concept reference. **Do not modify.**
|
||||
- **Reference design**: `References/GPSystemconcept.html` is the visual and structural target for the dashboard.
|
||||
- **CV content**: Sourced from `References/CV_v4.md` — roles, dates, and achievement numbers must be accurate.
|
||||
- **Icons**: Via `lucide-react`, not unicode symbols.
|
||||
- **Accessibility**: WCAG 2.1 AA compliance. Semantic HTML, ARIA attributes, keyboard navigation, `prefers-reduced-motion` support throughout. Status indicators always paired with text labels.
|
||||
- **No generic aesthetics**: Every design decision should feel intentional. If a component could appear in any random SaaS template, it needs more character.
|
||||
- **Fonts**: Elvaro Grotesque (primary) or Blumir (alt). Never Inter, Roboto, DM Sans, or system defaults. DM Sans appears in the concept HTML as a placeholder only.
|
||||
|
||||
## Project Structure
|
||||
|
||||
```
|
||||
src/
|
||||
├── components/ # One component per file (PascalCase)
|
||||
│ ├── tiles/ # Dashboard tile components (PatientSummaryTile, LatestResultsTile, etc.)
|
||||
│ ├── views/ # Legacy PMR views (being replaced by tiles — may be referenced during transition)
|
||||
│ ├── TopBar.tsx # Fixed top bar (brand, search trigger, session)
|
||||
│ ├── Sidebar.tsx # Light sidebar (person header, tags, alerts)
|
||||
│ ├── DashboardLayout.tsx # Main layout (topbar + sidebar + card grid)
|
||||
│ ├── Card.tsx # Reusable card component with header
|
||||
│ ├── CommandPalette.tsx # Ctrl+K search overlay
|
||||
│ └── ... # Boot, ECG, Login (unchanged)
|
||||
├── contexts/ # React contexts (AccessibilityContext)
|
||||
├── data/ # Static data files
|
||||
│ ├── patient.ts # Person details
|
||||
│ ├── consultations.ts # Career roles (used in Last Consultation + Career Activity)
|
||||
│ ├── medications.ts # Legacy skill data
|
||||
│ ├── problems.ts # Achievements
|
||||
│ ├── investigations.ts # Projects
|
||||
│ ├── documents.ts # Education entries
|
||||
│ ├── profile.ts # Personal statement
|
||||
│ ├── tags.ts # Sidebar tags
|
||||
│ ├── alerts.ts # Sidebar alert flags
|
||||
│ ├── kpis.ts # KPI metrics for Latest Results
|
||||
│ └── skills.ts # Skills with frequency/years (medication metaphor)
|
||||
├── hooks/ # Custom hooks (camelCase, use* prefix)
|
||||
├── lib/ # Utility functions (search.ts for fuse.js)
|
||||
├── types/ # TypeScript interfaces (index.ts, pmr.ts)
|
||||
├── App.tsx # Phase manager (root component)
|
||||
└── index.css # Global styles + Tailwind directives
|
||||
Ralph/ # Implementation plan, guardrails, progress tracking
|
||||
References/ # Source content (concept.html, GPSystemconcept.html, CV_v4.md)
|
||||
```
|
||||
- **Primary:** Teal `#00897B` / **Accent:** Coral `#FF6B6B`
|
||||
- **PMR palette:** GP system-inspired greens, teals, greys (defined in `tailwind.config.js`)
|
||||
- **Font tokens (CSS custom properties):**
|
||||
- `--font-ui`: Elvaro Grotesque (dashboard UI)
|
||||
- `--font-geist-mono`: Geist Mono / Fira Code fallback (canonical mono token)
|
||||
- `--font-primary` / `--font-secondary`: Plus Jakarta Sans / Inter Tight
|
||||
- **Breakpoints:** xs 480, sm 640, md 768, lg 1024, xl 1280
|
||||
|
||||
-494
@@ -1,494 +0,0 @@
|
||||
import { AbsoluteFill, useCurrentFrame, useVideoConfig } from "remotion";
|
||||
|
||||
// ─── Heartbeat generation ────────────────────────────────────────────────────
|
||||
|
||||
function generateHeartbeatPoints(
|
||||
amplitude: number,
|
||||
): { x: number; y: number }[] {
|
||||
const points: { x: number; y: number }[] = [];
|
||||
const steps = 200;
|
||||
|
||||
for (let i = 0; i <= steps; i++) {
|
||||
const t = i / steps;
|
||||
let y = 0;
|
||||
|
||||
if (t >= 0.05 && t < 0.2) {
|
||||
const pt = (t - 0.05) / 0.15;
|
||||
y = 0.12 * Math.sin(pt * Math.PI);
|
||||
} else if (t >= 0.25 && t < 0.32) {
|
||||
const pt = (t - 0.25) / 0.07;
|
||||
y = -0.1 * Math.sin(pt * Math.PI);
|
||||
} else if (t >= 0.32 && t < 0.42) {
|
||||
const pt = (t - 0.32) / 0.1;
|
||||
y = 1.0 * Math.sin(pt * Math.PI);
|
||||
} else if (t >= 0.42 && t < 0.5) {
|
||||
const pt = (t - 0.42) / 0.08;
|
||||
y = -0.25 * Math.sin(pt * Math.PI);
|
||||
} else if (t >= 0.55 && t < 0.75) {
|
||||
const pt = (t - 0.55) / 0.2;
|
||||
y = 0.2 * Math.sin(pt * Math.PI);
|
||||
}
|
||||
|
||||
points.push({ x: t, y: y * amplitude });
|
||||
}
|
||||
|
||||
return points;
|
||||
}
|
||||
|
||||
type Beat = { startFrame: number; widthPx: number; amplitude: number };
|
||||
|
||||
function buildBeats(fps: number): Beat[] {
|
||||
const beats: Beat[] = [];
|
||||
beats.push({ startFrame: Math.round(0.6 * fps), widthPx: 60, amplitude: 0.25 });
|
||||
beats.push({ startFrame: Math.round(1.4 * fps), widthPx: 80, amplitude: 0.45 });
|
||||
beats.push({ startFrame: Math.round(2.3 * fps), widthPx: 120, amplitude: 0.85 });
|
||||
const normalStart = 3.2;
|
||||
for (let i = 0; i < 1; i++) {
|
||||
beats.push({
|
||||
startFrame: Math.round((normalStart + i) * fps),
|
||||
widthPx: 140,
|
||||
amplitude: 1.0,
|
||||
});
|
||||
}
|
||||
return beats;
|
||||
}
|
||||
|
||||
// ─── Letter definitions ──────────────────────────────────────────────────────
|
||||
|
||||
const LETTERS: Record<string, { x: number; y: number }[]> = {
|
||||
A: [
|
||||
{ x: 0, y: 0 }, { x: 0.48, y: 1 }, { x: 0.53, y: 0.42 },
|
||||
{ x: 0.6, y: 0.42 }, { x: 1, y: 0 },
|
||||
],
|
||||
N: [
|
||||
{ x: 0, y: 0 }, { x: 0.12, y: 1 }, { x: 0.72, y: 0 },
|
||||
{ x: 0.88, y: 1 }, { x: 1, y: 0 },
|
||||
],
|
||||
D: [
|
||||
{ x: 0, y: 0 }, { x: 0.1, y: 1 }, { x: 0.5, y: 1 },
|
||||
{ x: 0.85, y: 0.55 }, { x: 1, y: 0 },
|
||||
],
|
||||
R: [
|
||||
{ x: 0, y: 0 }, { x: 0.1, y: 1 }, { x: 0.35, y: 1 },
|
||||
{ x: 0.5, y: 0.6 }, { x: 0.55, y: 0.45 }, { x: 1, y: 0 },
|
||||
],
|
||||
E: [
|
||||
{ x: 0, y: 0 }, { x: 0.1, y: 1 }, { x: 0.4, y: 1 },
|
||||
{ x: 0.45, y: 0.5 }, { x: 0.65, y: 0.5 }, { x: 0.7, y: 0 },
|
||||
{ x: 1, y: 0 },
|
||||
],
|
||||
W: [
|
||||
{ x: 0, y: 0 }, { x: 0.05, y: 1 }, { x: 0.27, y: 0 },
|
||||
{ x: 0.5, y: 0.65 }, { x: 0.73, y: 0 }, { x: 0.95, y: 1 },
|
||||
{ x: 1, y: 0 },
|
||||
],
|
||||
C: [
|
||||
{ x: 0, y: 0 }, { x: 0.08, y: 0.6 }, { x: 0.18, y: 1 },
|
||||
{ x: 0.6, y: 1 }, { x: 0.8, y: 0.5 }, { x: 0.95, y: 0.1 },
|
||||
{ x: 1, y: 0 },
|
||||
],
|
||||
H: [
|
||||
{ x: 0, y: 0 }, { x: 0.1, y: 1 }, { x: 0.18, y: 0.5 },
|
||||
{ x: 0.82, y: 0.5 }, { x: 0.9, y: 1 }, { x: 1, y: 0 },
|
||||
],
|
||||
L: [
|
||||
{ x: 0, y: 0 }, { x: 0.12, y: 1 }, { x: 0.3, y: 1 },
|
||||
{ x: 0.38, y: 0 }, { x: 1, y: 0 },
|
||||
],
|
||||
O: [
|
||||
{ x: 0, y: 0 }, { x: 0.2, y: 0.85 }, { x: 0.35, y: 1 },
|
||||
{ x: 0.65, y: 1 }, { x: 0.8, y: 0.85 }, { x: 1, y: 0 },
|
||||
],
|
||||
};
|
||||
|
||||
function interpolateLetterY(
|
||||
points: { x: number; y: number }[],
|
||||
t: number,
|
||||
): number {
|
||||
if (t <= points[0].x) return points[0].y;
|
||||
if (t >= points[points.length - 1].x) return points[points.length - 1].y;
|
||||
for (let i = 0; i < points.length - 1; i++) {
|
||||
if (t >= points[i].x && t <= points[i + 1].x) {
|
||||
const segT = (t - points[i].x) / (points[i + 1].x - points[i].x);
|
||||
return points[i].y + (points[i + 1].y - points[i].y) * segT;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ─── Text layout ─────────────────────────────────────────────────────────────
|
||||
|
||||
const TEXT = "ANDREW CHARLWOOD";
|
||||
const LETTER_WIDTH = 72;
|
||||
const LETTER_GAP = 10;
|
||||
const SPACE_WIDTH = 30;
|
||||
const BASE_LEFT_INSET = 9;
|
||||
const BASE_RIGHT_INSET = 0;
|
||||
|
||||
type LetterLayout = {
|
||||
char: string;
|
||||
startX: number;
|
||||
endX: number;
|
||||
startConnector: number;
|
||||
endConnector: number;
|
||||
};
|
||||
|
||||
type ConnectorProfile = { leftInset: number; rightInset: number };
|
||||
|
||||
const CONNECTOR_PROFILES: Record<string, ConnectorProfile> = {
|
||||
C: { leftInset: 20, rightInset: 8 },
|
||||
O: { leftInset: 17, rightInset: 7 },
|
||||
D: { leftInset: 0, rightInset: 13 },
|
||||
L: { leftInset: 5, rightInset: 0 },
|
||||
E: { leftInset: 5, rightInset: 0 },
|
||||
};
|
||||
|
||||
const DEFAULT_PROFILE: ConnectorProfile = { leftInset: 0, rightInset: 0 };
|
||||
|
||||
function layoutText(offsetX: number): LetterLayout[] {
|
||||
const layout: LetterLayout[] = [];
|
||||
let cursor = offsetX;
|
||||
|
||||
for (const char of TEXT) {
|
||||
if (char === " ") {
|
||||
cursor += SPACE_WIDTH;
|
||||
continue;
|
||||
}
|
||||
const profile = CONNECTOR_PROFILES[char] ?? DEFAULT_PROFILE;
|
||||
const startX = cursor;
|
||||
const endX = cursor + LETTER_WIDTH;
|
||||
layout.push({
|
||||
char,
|
||||
startX,
|
||||
endX,
|
||||
startConnector: startX + BASE_LEFT_INSET + profile.leftInset,
|
||||
endConnector: endX - BASE_RIGHT_INSET - profile.rightInset,
|
||||
});
|
||||
cursor += LETTER_WIDTH + LETTER_GAP;
|
||||
}
|
||||
|
||||
return layout;
|
||||
}
|
||||
|
||||
function getTextTotalWidth(): number {
|
||||
return (
|
||||
TEXT.replace(/ /g, "").length * (LETTER_WIDTH + LETTER_GAP) -
|
||||
LETTER_GAP +
|
||||
(TEXT.split(" ").length - 1) * SPACE_WIDTH
|
||||
);
|
||||
}
|
||||
|
||||
// ─── Timing constants ────────────────────────────────────────────────────────
|
||||
|
||||
const TRACE_SPEED = 350;
|
||||
const HEAD_SCREEN_RATIO = 1;
|
||||
const FLAT_GAP_SECONDS = 0.5;
|
||||
const HOLD_SECONDS = 1.25;
|
||||
const COMP_FPS = 60;
|
||||
|
||||
// How long the dot/line takes to exit the right side after text finishes
|
||||
const EXIT_SECONDS = 1.5;
|
||||
|
||||
// Pre-compute duration for export
|
||||
const _beats = buildBeats(COMP_FPS);
|
||||
const _lastBeat = _beats[_beats.length - 1];
|
||||
const _lastBeatEndWX = (_lastBeat.startFrame / COMP_FPS) * TRACE_SPEED + _lastBeat.widthPx;
|
||||
const _textStartWX = _lastBeatEndWX + FLAT_GAP_SECONDS * TRACE_SPEED;
|
||||
const _totalTextW = getTextTotalWidth();
|
||||
const _textEndWX = _textStartWX + _totalTextW;
|
||||
const _textEndFrame = Math.round((_textEndWX / TRACE_SPEED) * COMP_FPS);
|
||||
|
||||
export const ECGCOMBINED_DURATION = _textEndFrame + Math.round(HOLD_SECONDS * COMP_FPS) + Math.round(EXIT_SECONDS * COMP_FPS);
|
||||
|
||||
// ─── Component ───────────────────────────────────────────────────────────────
|
||||
|
||||
export const ECGCombined = () => {
|
||||
const frame = useCurrentFrame();
|
||||
const { fps, width, height } = useVideoConfig();
|
||||
|
||||
const baselineY = height * 0.5;
|
||||
const lineColor = "#00ff41";
|
||||
const ecgMaxDeflection = height * 0.28;
|
||||
const textMaxDeflection = height * 0.09;
|
||||
const beats = buildBeats(fps);
|
||||
|
||||
// ── World-space text position ──
|
||||
const lastBeat = beats[beats.length - 1];
|
||||
const lastBeatEndWorldX = (lastBeat.startFrame / fps) * TRACE_SPEED + lastBeat.widthPx;
|
||||
const textStartWorldX = lastBeatEndWorldX + FLAT_GAP_SECONDS * TRACE_SPEED;
|
||||
const totalTextWidth = getTextTotalWidth();
|
||||
const textEndWorldX = textStartWorldX + totalTextWidth;
|
||||
const textLayout = layoutText(textStartWorldX); // world-space positions
|
||||
|
||||
// ── Final screen position: text centered when done ──
|
||||
const desiredTextStartScreen = (width - totalTextWidth) / 2;
|
||||
const finalHeadScreenX = desiredTextStartScreen + totalTextWidth;
|
||||
const headScreenDuringEcg = HEAD_SCREEN_RATIO * width;
|
||||
|
||||
// ── Head position (world space, keeps moving past text) ──
|
||||
const currentTime = frame / fps;
|
||||
const headX = currentTime * TRACE_SPEED;
|
||||
const textEndFrame = Math.round((textEndWorldX / TRACE_SPEED) * fps);
|
||||
const isTextPhase = headX > textStartWorldX;
|
||||
const isTextDone = frame >= textEndFrame - 3;
|
||||
|
||||
// ── Viewport: keeps scrolling, head drifts from 75% → right edge ──
|
||||
let headScreenX: number;
|
||||
let viewOffset: number;
|
||||
|
||||
if (headX <= textStartWorldX) {
|
||||
viewOffset = Math.max(0, headX - headScreenDuringEcg);
|
||||
headScreenX = headX - viewOffset;
|
||||
} else if (headX >= textEndWorldX) {
|
||||
// Lock viewport so text stays centered; dot keeps moving right
|
||||
viewOffset = textEndWorldX - finalHeadScreenX;
|
||||
headScreenX = headX - viewOffset;
|
||||
} else {
|
||||
const p = (headX - textStartWorldX) / (textEndWorldX - textStartWorldX);
|
||||
headScreenX = headScreenDuringEcg + p * (finalHeadScreenX - headScreenDuringEcg);
|
||||
viewOffset = headX - headScreenX;
|
||||
}
|
||||
|
||||
// ── Y function (world space) ──
|
||||
function getYAtX(worldX: number): number {
|
||||
for (const beat of beats) {
|
||||
const beatStartX = (beat.startFrame / fps) * TRACE_SPEED;
|
||||
const beatEndX = beatStartX + beat.widthPx;
|
||||
if (worldX >= beatStartX && worldX <= beatEndX) {
|
||||
const progress = (worldX - beatStartX) / beat.widthPx;
|
||||
const beatPoints = generateHeartbeatPoints(beat.amplitude);
|
||||
const idx = Math.min(
|
||||
Math.floor(progress * (beatPoints.length - 1)),
|
||||
beatPoints.length - 1,
|
||||
);
|
||||
return baselineY - beatPoints[idx].y * ecgMaxDeflection;
|
||||
}
|
||||
}
|
||||
for (const item of textLayout) {
|
||||
if (worldX >= item.startX && worldX <= item.endX) {
|
||||
const t = (worldX - item.startX) / (item.endX - item.startX);
|
||||
const letterDef = LETTERS[item.char];
|
||||
if (letterDef) {
|
||||
return baselineY - interpolateLetterY(letterDef, t) * textMaxDeflection;
|
||||
}
|
||||
}
|
||||
}
|
||||
return baselineY;
|
||||
}
|
||||
|
||||
// ── ECG trace path (up to text start) ──
|
||||
const firstBeatWorldX = (beats[0].startFrame / fps) * TRACE_SPEED;
|
||||
const traceStartWX = Math.max(Math.floor(firstBeatWorldX), Math.floor(viewOffset));
|
||||
const ecgTraceEndWX = Math.min(
|
||||
Math.ceil(headX),
|
||||
Math.ceil(textStartWorldX),
|
||||
Math.ceil(viewOffset + width),
|
||||
);
|
||||
|
||||
const traceSegments: string[] = [];
|
||||
if (ecgTraceEndWX >= traceStartWX) {
|
||||
for (let wx = traceStartWX; wx <= ecgTraceEndWX; wx++) {
|
||||
const sx = wx - viewOffset;
|
||||
const y = getYAtX(wx);
|
||||
traceSegments.push(wx === traceStartWX ? `M ${sx} ${y}` : `L ${sx} ${y}`);
|
||||
}
|
||||
}
|
||||
const tracePathD = traceSegments.join(" ");
|
||||
|
||||
// ── Flat exit line after text finishes ──
|
||||
let exitPathD = "";
|
||||
if (isTextDone && headX > textEndWorldX) {
|
||||
const exitStartSX = textEndWorldX - viewOffset - 32;
|
||||
const exitEndSX = headX - viewOffset;
|
||||
exitPathD = `M ${exitStartSX} ${baselineY} L ${exitEndSX} ${baselineY}`;
|
||||
}
|
||||
|
||||
// ── Neon fade ──
|
||||
const neonLengthPx = 200;
|
||||
const neonFadeScreenEnd = headScreenX;
|
||||
const neonFadeScreenStart = neonFadeScreenEnd - neonLengthPx;
|
||||
|
||||
// ── Text mask ──
|
||||
const maskBrushSize = 1;
|
||||
const clipLeadPx = 20;
|
||||
const blockUnmaskDelay = 15;
|
||||
const blockFeatherPx = 10;
|
||||
|
||||
const textMaskEndSX = isTextPhase
|
||||
? (isTextDone ? width : Math.max(0, Math.min(Math.ceil(headScreenX), width)))
|
||||
: 0;
|
||||
|
||||
const textMaskSegments: string[] = [];
|
||||
if (isTextPhase && textMaskEndSX > 0 && !isTextDone) {
|
||||
for (let sx = 0; sx <= textMaskEndSX; sx++) {
|
||||
const y = getYAtX(viewOffset + sx);
|
||||
textMaskSegments.push(sx === 0 ? `M ${sx} ${y}` : `L ${sx} ${y}`);
|
||||
}
|
||||
}
|
||||
const textMaskPathD = textMaskSegments.join(" ");
|
||||
const blockUnmaskX = isTextDone ? width : Math.max(0, textMaskEndSX - blockUnmaskDelay);
|
||||
|
||||
// ── Connectors (screen space) ──
|
||||
const connectorSegments: string[] = [];
|
||||
for (let i = 0; i < textLayout.length - 1; i++) {
|
||||
const curr = textLayout[i];
|
||||
const next = textLayout[i + 1];
|
||||
connectorSegments.push(
|
||||
`M ${curr.endConnector - viewOffset - 18} ${baselineY} L ${next.startConnector - viewOffset} ${baselineY}`,
|
||||
);
|
||||
}
|
||||
const connectorPathD = connectorSegments.join(" ");
|
||||
|
||||
return (
|
||||
<AbsoluteFill style={{ backgroundColor: "#000000", overflow: "hidden" }}>
|
||||
<svg width={width} height={height} style={{ position: "absolute", top: 0, left: 0 }}>
|
||||
<defs>
|
||||
<filter id="neon" x="-50%" y="-50%" width="200%" height="200%">
|
||||
<feGaussianBlur in="SourceGraphic" stdDeviation="2" result="blur1" />
|
||||
<feGaussianBlur in="SourceGraphic" stdDeviation="6" result="blur2" />
|
||||
<feGaussianBlur in="SourceGraphic" stdDeviation="14" result="blur3" />
|
||||
<feMerge>
|
||||
<feMergeNode in="blur3" />
|
||||
<feMergeNode in="blur2" />
|
||||
<feMergeNode in="blur1" />
|
||||
<feMergeNode in="SourceGraphic" />
|
||||
</feMerge>
|
||||
</filter>
|
||||
<filter id="neonText" x="-30%" y="-30%" width="160%" height="160%">
|
||||
<feGaussianBlur in="SourceGraphic" stdDeviation="3" result="tblur1" />
|
||||
<feGaussianBlur in="SourceGraphic" stdDeviation="8" result="tblur2" />
|
||||
<feMerge>
|
||||
<feMergeNode in="tblur2" />
|
||||
<feMergeNode in="tblur1" />
|
||||
<feMergeNode in="SourceGraphic" />
|
||||
</feMerge>
|
||||
</filter>
|
||||
<linearGradient
|
||||
id="neonMaskGrad"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
x1={neonFadeScreenStart} y1={0}
|
||||
x2={neonFadeScreenEnd} y2={0}
|
||||
>
|
||||
<stop offset="0%" stopColor="black" />
|
||||
<stop offset="100%" stopColor="white" />
|
||||
</linearGradient>
|
||||
<mask id="neonMask">
|
||||
<rect x={0} y={0} width={width} height={height} fill="url(#neonMaskGrad)" />
|
||||
</mask>
|
||||
<clipPath id="textReveal">
|
||||
<rect
|
||||
x={0} y={0}
|
||||
width={isTextDone ? width : Math.max(0, headScreenX + clipLeadPx)}
|
||||
height={height}
|
||||
/>
|
||||
</clipPath>
|
||||
<linearGradient
|
||||
id="blockUnmaskGrad"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
x1={blockUnmaskX - blockFeatherPx} y1={0}
|
||||
x2={blockUnmaskX} y2={0}
|
||||
>
|
||||
<stop offset="0%" stopColor="white" />
|
||||
<stop offset="100%" stopColor="black" />
|
||||
</linearGradient>
|
||||
<mask id="textWipeMask">
|
||||
<rect x={0} y={0} width={width} height={height} fill={isTextDone ? "white" : "black"} />
|
||||
{!isTextDone && blockUnmaskX > 0 && (
|
||||
<rect x={0} y={0} width={blockUnmaskX} height={height} fill="url(#blockUnmaskGrad)" />
|
||||
)}
|
||||
{!isTextDone && textMaskPathD && (
|
||||
<path
|
||||
d={textMaskPathD}
|
||||
fill="none"
|
||||
stroke="white"
|
||||
strokeWidth={15 * maskBrushSize}
|
||||
strokeLinejoin="round"
|
||||
strokeLinecap="round"
|
||||
filter="url(#neonText)"
|
||||
/>
|
||||
)}
|
||||
</mask>
|
||||
<radialGradient id="headGlow" cx="50%" cy="50%" r="50%">
|
||||
<stop offset="0%" stopColor="#ffffff" stopOpacity={0.8} />
|
||||
<stop offset="30%" stopColor={lineColor} stopOpacity={0.6} />
|
||||
<stop offset="100%" stopColor={lineColor} stopOpacity={0} />
|
||||
</radialGradient>
|
||||
</defs>
|
||||
|
||||
{/* ECG trace */}
|
||||
{tracePathD && (
|
||||
<g>
|
||||
<path d={tracePathD} fill="none" stroke={lineColor} strokeWidth={2}
|
||||
strokeLinejoin="round" strokeLinecap="round" />
|
||||
<path d={tracePathD} fill="none" stroke={lineColor} strokeWidth={2.5}
|
||||
strokeLinejoin="round" strokeLinecap="round"
|
||||
filter="url(#neon)" mask="url(#neonMask)" />
|
||||
</g>
|
||||
)}
|
||||
|
||||
{/* Text + connectors */}
|
||||
{isTextPhase && (
|
||||
<g clipPath="url(#textReveal)">
|
||||
<g mask="url(#textWipeMask)">
|
||||
{textLayout.map((item, i) => (
|
||||
<text
|
||||
key={i}
|
||||
x={(item.startX + item.endX) / 2 - viewOffset}
|
||||
y={baselineY}
|
||||
textAnchor="middle"
|
||||
dominantBaseline="alphabetic"
|
||||
fontSize={Math.round(textMaxDeflection / 0.715)}
|
||||
fontFamily="Arial, Helvetica, sans-serif"
|
||||
fontWeight="bold"
|
||||
fill="none"
|
||||
stroke={lineColor}
|
||||
strokeWidth={1.5}
|
||||
filter="url(#neonText)"
|
||||
>
|
||||
{item.char}
|
||||
</text>
|
||||
))}
|
||||
{connectorPathD && (
|
||||
<path d={connectorPathD} fill="none" stroke={lineColor}
|
||||
strokeWidth={1.5} strokeLinecap="round" />
|
||||
)}
|
||||
</g>
|
||||
</g>
|
||||
)}
|
||||
|
||||
{/* Flat exit line after text */}
|
||||
{exitPathD && (
|
||||
<g>
|
||||
<path d={exitPathD} fill="none" stroke={lineColor} strokeWidth={2}
|
||||
strokeLinejoin="round" strokeLinecap="round" />
|
||||
<path d={exitPathD} fill="none" stroke={lineColor} strokeWidth={2.5}
|
||||
strokeLinejoin="round" strokeLinecap="round"
|
||||
filter="url(#neon)" />
|
||||
</g>
|
||||
)}
|
||||
|
||||
{/* Head dot */}
|
||||
{headScreenX >= 0 && headScreenX <= width && (
|
||||
<>
|
||||
<circle cx={headScreenX} cy={getYAtX(headX)} r={20} fill="url(#headGlow)" />
|
||||
<circle cx={headScreenX} cy={getYAtX(headX)} r={3} fill={lineColor} />
|
||||
</>
|
||||
)}
|
||||
</svg>
|
||||
|
||||
{/* Scanlines */}
|
||||
<div style={{
|
||||
position: "absolute", top: 0, left: 0, width: "100%", height: "100%",
|
||||
background: "repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,0.08) 2px, rgba(0,0,0,0.08) 4px)",
|
||||
pointerEvents: "none",
|
||||
}} />
|
||||
|
||||
{/* Vignette */}
|
||||
<div style={{
|
||||
position: "absolute", top: 0, left: 0, width: "100%", height: "100%",
|
||||
background: "radial-gradient(ellipse at center, transparent 60%, rgba(0,0,0,0.5) 100%)",
|
||||
pointerEvents: "none",
|
||||
}} />
|
||||
</AbsoluteFill>
|
||||
);
|
||||
};
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user