Design-First Development Standards Guide
Status: Complete
Category: Critical Development Standards
Version: 1.0
Based On: Lessons Learned from V2, V3, V4 MVP Builds
CRITICAL: This Guide is MANDATORY
Backend functionality without frontend design creates UNUSABLE products. This guide establishes non-negotiable design standards that MUST be implemented before any feature can be considered complete.
Table of Contents
- Core Principles
- Mandatory Design Phases
- Visual Validation Requirements
- Accessibility Standards
- CSS Architecture Standards
- Component Scope Validation
- Design Quality Gates
- Common Failures and Solutions
- Implementation Checklist
Core Principles
The Most Important Lesson
Phase 10 (UI/UX Wireframes) and Phase 13 (UX/UI Design) are not "optional styling" - they contain the ACTUAL user experience specifications that determine product success or failure.
Design-First Means:
- Design System Before Features: Implement complete design system (colors, typography, spacing) in Phase 0.1
- Wireframe Compliance is Blocking: No feature proceeds without matching wireframes
- Visual Quality from Day 1: Professional appearance is not added later
- User Verification Over Developer Confidence: Users must SEE improvements
Mandatory Design Phases
Phase 0.1: Design System Foundation (BEFORE ANY CODING)
// MANDATORY: Design tokens must be defined first
export const designSystem = {
colors: {
primary: '#22C55E', // Brand green (WCAG AA compliant)
text: {
primary: '#1a1a1a', // Contrast ratio: 12.63:1 β
secondary: '#6b7280', // Contrast ratio: 4.97:1 β
inverse: '#ffffff'
},
background: {
main: '#ffffff',
secondary: '#f8f9fa',
accent: '#f3f4f6'
}
},
typography: {
scale: {
xs: '0.75rem',
sm: '0.875rem',
base: '1rem',
lg: '1.125rem',
xl: '1.25rem',
'2xl': '1.5rem',
'3xl': '1.875rem'
},
weights: {
normal: 400,
medium: 500,
semibold: 600,
bold: 700
}
},
spacing: {
unit: 4, // Base unit in pixels
scale: [0, 4, 8, 12, 16, 20, 24, 32, 40, 48, 56, 64]
},
shadows: {
sm: '0 1px 2px rgba(0,0,0,0.05)',
base: '0 1px 3px rgba(0,0,0,0.1)',
md: '0 4px 6px rgba(0,0,0,0.1)',
lg: '0 10px 15px rgba(0,0,0,0.1)'
}
};
Phase 10 Compliance: Wireframe Validation
BLOCKING REQUIREMENT: Every screen must pass wireframe compliance before proceeding.
// Wireframe Compliance Validator
interface WireframeCompliance {
layout: {
headerPresent: boolean;
navigationVisible: boolean;
contentStructureMatches: boolean;
responsiveBreakpoints: boolean;
};
components: {
allRequiredPresent: boolean;
interactiveStatesImplemented: boolean;
dataFlowCorrect: boolean;
};
userFlow: {
navigationPathsClear: boolean;
actionsAccessible: boolean;
feedbackMechanismsPresent: boolean;
};
}
// MUST return all true before feature is complete
function validateWireframeCompliance(screen: any): boolean {
// Implementation validates against Phase 10 specs
return Object.values(compliance).every(category =>
Object.values(category).every(check => check === true)
);
}
Phase 13 Polish: Professional Visual Design
MANDATORY ELEMENTS:
- Gradients and visual depth
- Micro-animations and transitions
- Professional shadows and borders
- Hover/focus/active states
- Loading and error states
- Empty states design
Visual Validation Requirements
Browser-Based Verification Protocol
CRITICAL: Code deployment β Visual improvement
# Visual Validation Steps (MANDATORY)
1. Deploy changes
2. Clear browser cache (Cmd+Shift+R / Ctrl+Shift+R)
3. Take screenshot of current state
4. Compare with wireframe specification
5. Get user confirmation: "Can you see the improvement?"
6. Document visual changes with before/after screenshots
Screenshot Documentation Requirements
## Visual Validation Report
- **Feature**: [Feature Name]
- **Date**: [YYYY-MM-DD]
- **Before**: [screenshot-before.png]
- **After**: [screenshot-after.png]
- **Wireframe Reference**: [wireframe-spec.png]
- **User Confirmed**: β
Yes / β No
- **Notes**: [User feedback]
Accessibility Standards
WCAG AA Compliance (MANDATORY)
// Contrast Validation Requirements
const contrastRequirements = {
normalText: 4.5, // Minimum for normal text
largeText: 3.0, // Minimum for large text (18pt+)
uiComponents: 3.0, // Minimum for UI components
validate(foreground: string, background: string): boolean {
const ratio = calculateContrastRatio(foreground, background);
return ratio >= this.normalText;
}
};
// MUST validate all text elements
function validateAccessibility(): ValidationResult {
const failures = [];
document.querySelectorAll('*').forEach(element => {
const styles = getComputedStyle(element);
const ratio = getContrastRatio(styles.color, styles.backgroundColor);
if (ratio < 4.5) {
failures.push({
element: element.tagName,
actual: ratio,
required: 4.5,
severity: 'CRITICAL'
});
}
});
return failures.length === 0 ? 'PASS' : 'FAIL';
}
Required Accessibility Features
- Keyboard navigation for all interactive elements
- Focus indicators visible and clear
- Screen reader compatibility
- Alt text for all images
- ARIA labels where needed
- Semantic HTML structure
CSS Architecture Standards
Critical Layout Fallback Strategy
LESSON FROM V2: CSS frameworks can fail. Always have fallbacks.
// MANDATORY: Inline styles for critical layout elements
const criticalLayoutStyles = {
// Framework-independent layout guarantees
header: {
display: 'flex',
justifyContent: 'space-between',
alignItems: 'center',
padding: '16px 24px',
backgroundColor: '#ffffff',
borderBottom: '1px solid #e5e7eb',
// These WILL render regardless of Tailwind/CSS framework issues
} as React.CSSProperties,
mainContainer: {
display: 'flex',
flexDirection: 'row',
minHeight: '100vh',
backgroundColor: '#f8f9fa'
} as React.CSSProperties,
// Use for all critical layout components
sidebar: {
width: '280px',
backgroundColor: '#ffffff',
borderRight: '1px solid #e5e7eb',
display: 'flex',
flexDirection: 'column'
} as React.CSSProperties
};
// Apply both inline and classes
<header style={criticalLayoutStyles.header} className="header">
{/* Content guaranteed to layout correctly */}
</header>
CSS Conflict Resolution
# When CSS frameworks conflict:
1. Clear build cache: rm -rf .next/
2. Rebuild CSS: npm run build
3. Use inline styles for critical elements
4. Verify in browser with cache cleared
5. Document the solution for future reference
Component Scope Validation
Preventing Runtime Crashes
CRITICAL LESSON FROM V2: Undefined variables in component scope cause complete UI failure.
// β WRONG: Accessing undefined variables
function ChatInterface() {
return (
<div>
{user.metadata.name} {/* CRASH if user undefined */}
</div>
);
}
// β
CORRECT: Defensive programming with fallbacks
function ChatInterface({ user }: { user?: User }) {
return (
<div>
{user?.metadata?.name || 'Guest User'}
</div>
);
}
// MANDATORY: Component dependency validation
interface ComponentProps {
required: string;
optional?: string;
}
function validateComponentProps<T>(props: T, requirements: string[]): void {
requirements.forEach(req => {
if (!props[req]) {
throw new Error(`Missing required prop: ${req}`);
}
});
}
Prop Drilling Verification
// Track data flow through component tree
const DataFlowValidator = {
track(componentName: string, props: any) {
console.log(`[${componentName}] Props:`, Object.keys(props));
},
validate(component: React.Component) {
// Ensure all referenced variables exist in scope
const usedVariables = extractUsedVariables(component);
const availableProps = Object.keys(component.props);
const missing = usedVariables.filter(v => !availableProps.includes(v));
if (missing.length > 0) {
throw new Error(`Missing props: ${missing.join(', ')}`);
}
}
};
π¦ Design Quality Gates
Mandatory Checkpoints
Each feature must pass ALL gates before proceeding:
Gate 1: Design System Implementation
- Colors defined and WCAG compliant
- Typography scale implemented
- Spacing system consistent
- Component library initialized
Gate 2: Wireframe Compliance
- Layout matches Phase 10 specifications
- All components from wireframe present
- Navigation paths implemented
- Responsive breakpoints working
Gate 3: Visual Polish
- Professional shadows and depth
- Smooth transitions (0.2s default)
- Hover/focus states for all interactive elements
- Loading states implemented
- Error states designed
Gate 4: Accessibility Validation
- Contrast ratios pass WCAG AA
- Keyboard navigation complete
- Screen reader tested
- Focus indicators visible
Gate 5: User Verification
- Screenshot comparison documented
- User confirms visual improvements
- Browser cache cleared and retested
- Mobile responsiveness verified
Common Failures and Solutions
Failure 1: "It works but looks terrible"
Cause: Building functionality without design system
Solution: Implement Phase 0.1 design system FIRST
Prevention: Block feature development until design system exists
Failure 2: "CSS not applying"
Cause: Framework conflicts, build cache, specificity issues
Solution: Use inline styles for critical layout
Prevention: Always have CSS fallback strategy
Failure 3: "User can't find features"
Cause: Poor navigation, hidden UI elements
Solution: Make all features visibly accessible
Prevention: Test with real users, not developers
Failure 4: "Text is unreadable"
Cause: Poor contrast ratios
Solution: Validate all text against WCAG AA
Prevention: Use contrast checker during design
Failure 5: "Component crashes on undefined"
Cause: Missing prop validation, no fallbacks
Solution: Defensive programming with optional chaining
Prevention: TypeScript strict mode, prop validation
Implementation Checklist
Pre-Development (Phase 0.1)
- Design system tokens defined
- Color palette WCAG validated
- Typography scale implemented
- Component library setup (shadcn/ui or similar)
- Wireframes reviewed and approved
During Development
- Every screen validated against wireframes
- Accessibility checked for each component
- CSS fallbacks implemented for critical layout
- Component props validated and typed
- Loading/error/empty states designed
Pre-Deployment
- Visual regression testing performed
- Browser testing (Chrome, Firefox, Safari, Edge)
- Mobile responsiveness verified
- Accessibility audit passed
- Performance metrics acceptable
Post-Deployment
- Browser cache cleared for testing
- Screenshots taken and compared
- User verification obtained
- Visual changes documented
- Lessons learned captured
Success Metrics
Quantitative Metrics
- WCAG Compliance: 100% AA standard
- Wireframe Match: β₯95% accuracy
- Component Crashes: 0 runtime errors
- CSS Failures: 0 layout breakdowns
- Load Time: <2 seconds initial load
Qualitative Metrics
- User Reaction: "Looks professional"
- Navigation: "I found it immediately"
- Trust: "I would pay for this"
- Comparison: "Better than competitors"
Enforcement
This guide is MANDATORY for all development.
Features missing these standards will be:
- Blocked from merge
- Returned for rework
- Not considered complete
- Not eligible for deployment
Remember: Users judge quality in milliseconds based on visual design. Make it count.
Based on critical lessons from NudgeCampaign V2, V3, and V4 builds where design-first approach transformed unusable MVPs into professional products.