diff --git a/.gitignore b/.gitignore
index 30c3f28..59d8c84 100644
--- a/.gitignore
+++ b/.gitignore
@@ -67,3 +67,6 @@ public/_next-video
# scripts output files
scripts/*-output.json
scripts/*.log
+
+# specs archive (historical files not tracked)
+specs/archive/
diff --git a/.windsurf/rules/project-standards.md b/.windsurf/rules/project-standards.md
index 3befdc3..672d105 100644
--- a/.windsurf/rules/project-standards.md
+++ b/.windsurf/rules/project-standards.md
@@ -4,39 +4,66 @@ trigger: always_on
# 8P3P LMS - Windsurf Project Rules
-> **Consolidated project standards distilled from specifications**
-> **Activation Mode**: Always On
-> **File Limit**: 12000 characters (Windsurf requirement)
-
----
-
-- **Project**: EMDR therapist training LMS (Learning Management System)
+- **Project**: EMDR therapist training LMS
- **Stack**: Next.js 15, React 19, TypeScript 5.9, AWS Amplify Gen2, Tailwind v4, shadcn/ui
- **Development Phase**: MVP feature completion (Phase 1)
- **Testing Strategy**: Manual Q&A testing (no unit tests until post-MVP)
----
+
+
+## Protocol Execution Order (CRITICAL)
+
+**MANDATORY SEQUENCE** - Must be followed in exact order:
+
+### Step 1: Codebase Analysis Protocol (ALWAYS FIRST)
+
+- **Trigger**: ANY request involving files, components, or functionality
+- **Required**: Complete existing implementation check before ANY recommendations
+- **Blocker**: Cannot proceed to other protocols without completing this step
+
+### Step 2: Branch Readiness Protocol
+
+- **Trigger**: Creating new branches or starting development work
+- **Required**: User confirmation before any branch creation
+- **Depends on**: Step 1 completion
+
+### Step 3: Implementation
+
+- **Trigger**: After user approval from Step 2
+- **Required**: Follow all quality gates and standards
+- **Depends on**: Steps 1 & 2 completion
+
+**VIOLATION CONSEQUENCES**:
+
+- Inaccurate recommendations (ignoring existing work)
+- Wasted development time
+- Loss of user trust in AI recommendations
+
## Branch Readiness Protocol (MANDATORY)
+**PREREQUISITE**: Codebase Analysis Protocol MUST be completed first.
+
Before starting ANY new feature:
-1. **Present Branch Readiness Plan**: Show feature spec, branch strategy, stacked PR plan, timeline
-2. **Get User Confirmation**: Ask "Ready to create the branch and start {feature_name} development? 🚀"
-3. **Wait for Approval**: Do NOT create branches without explicit user confirmation
-4. **Document Decision**: Record approval before proceeding
+1. **Complete Codebase Analysis**: Verify existing implementations and acknowledge current state
+2. **Present Branch Readiness Plan**: Show feature spec, branch strategy, stacked PR plan, timeline
+3. **Get User Confirmation**: Ask "Ready to create the branch and start {feature_name} development? 🚀"
+4. **Wait for Approval**: Do NOT create branches without explicit user confirmation
+5. **Document Decision**: Record approval before proceeding
+
+**BLOCKER**: Cannot proceed without completing Step 1 (Codebase Analysis)
## LOC Verification (MANDATORY)
Before every commit:
```bash
-# Verify actual line count
git diff --cached --shortstat
git diff --cached --stat
```
@@ -54,10 +81,7 @@ git diff --cached --stat
- **Stacked PRs**: For complex features, break into dependent PRs
- **Commit Format**: Semantic commits (feat:, fix:, docs:, refactor:, etc.)
- **Branch Strategy**: feature → dev → release/vX.Y.Z → main
-
-
-
----
+
@@ -108,21 +132,12 @@ export default function ClientComponent({
- **Prefer**: Server-side data fetching in Server Components
- **Client-side**: Only when server-side isn't suitable (real-time updates, user interactions)
- **Use**: ISR with `next: { revalidate: 3600 }` for cacheable data
-
-
-
----
+
## Authentication Standards
-### Required Imports
-
-```typescript
-import { defineAuth, secret } from "@aws-amplify/backend";
-```
-
### Core Rules
- **ALWAYS** import `secret` for auth configurations
@@ -147,11 +162,7 @@ import { defineAuth, secret } from "@aws-amplify/backend";
### Enums
- Don't use `.required()` or `.defaultValue()` with enums
-- Enums are type-safe by definition
-
-
-
----
+
@@ -161,62 +172,78 @@ import { defineAuth, secret } from "@aws-amplify/backend";
- **No config file needed**: Tailwind v4 uses CSS-first configuration
- **Single import**: `@import "tailwindcss";` in globals.css
-- **Theme customization**: Use `@theme` directive with CSS variables
### Stylesheet Structure (globals.css)
-**Order matters**:
-
-1. `@import` statements first
-2. `@theme` directive for Tailwind customization
-3. CSS variables in `:root` and `.dark`
-4. `@layer` directives last
+**Order matters**: `@import` → `@theme` → CSS variables → `@layer`
### Base Layer Rules
- **Use CSS variables directly** in `@layer base`
- **Correct**: `background-color: var(--background);`
- **Incorrect**: `@apply bg-background;`
-- **Reason**: Tailwind v4 promotes CSS-first approach
### Component Standards
- **Primary**: shadcn/ui components for all UI elements
- **Custom Components**: Follow shadcn/ui patterns and composition
- **Styling**: Tailwind utility classes only (no CSS Modules except auto-generated libraries)
-- **Theme**: Use CSS variables for dynamic theming
+
-
+
----
+## Codebase Analysis Protocol (MANDATORY - ALWAYS FIRST)
-
+**CRITICAL**: This protocol MUST be executed BEFORE any other protocols or recommendations.
-## Codebase Analysis Protocol (MANDATORY)
+### Trigger Conditions
-Before ANY recommendations about files/components/functionality:
+- User requests feature implementation
+- User asks about existing functionality
+- User mentions creating/modifying files
+- User says "proceed with [feature]"
+- ANY development-related request
-### 1. Existing Implementation Check
+### Required Analysis Steps
+
+**Step 1: Search Existing Implementations**
```bash
-grep_search "functionName|ComponentName" # Check existing implementations
-find_by_name "*feature*|*component*" # Find related files
-grep_search "import.*ComponentName" # Check usage patterns
+grep_search "featureName|ComponentName"
+find_by_name "*feature*|*component*"
+grep_search "import.*ComponentName"
```
-### 2. Duplication Prevention
+**Step 2: Read Complete Context**
+
+- Read ALL related files completely (not partial)
+- Understand existing architecture and patterns
+- Identify what's already implemented vs what's missing
+
+**Step 3: Acknowledge Before Recommending**
+
+- **ALWAYS** acknowledge existing implementations first
+- State completion percentage: "X is 85% complete, missing Y and Z"
+- Build upon existing work rather than recreating
+
+### Enforcement Rules
+
+- **NEVER** present plans without completing analysis first
+- **NEVER** assume files don't exist without searching
+- **NEVER** ignore existing implementations in recommendations
+- **ALWAYS** state "Following Codebase Analysis Protocol" when starting
+- **ALWAYS** acknowledge existing work before suggesting new work
-- **NEVER** suggest creating new files without checking existing implementations
-- **NEVER** assume functionality doesn't exist without comprehensive searching
-- **ALWAYS** build upon existing work rather than recreating it
-- **ALWAYS** acknowledge existing implementations before suggesting changes
+### Violation Prevention
-### 3. Recommendation Protocol
+**Before ANY recommendation, ask yourself**:
-- **READ FIRST, RECOMMEND SECOND**: Scan existing codebase thoroughly
-- **VERIFY ASSUMPTIONS**: Never assume something doesn't exist
-- **ASK CLARIFYING QUESTIONS**: "I see you have X, are you looking to enhance it or replace it?"
-- **ACKNOWLEDGE EXISTING WORK**: Recognize what's already implemented
+1. ✅ Did I search for existing implementations?
+2. ✅ Did I read the complete existing code?
+3. ✅ Did I acknowledge what's already built?
+4. ✅ Am I building upon existing work vs recreating?
+
+**If ANY answer is NO, STOP and complete the analysis first.**
## Quality Gates (Before Feature Completion)
@@ -241,7 +268,6 @@ grep_search "import.*ComponentName" # Check usage patterns
- **Variables/Functions**: camelCase
- **Components/Types**: PascalCase
-- **Unused Variables**: Prefix with `_`
- **Files**: kebab-case for utilities, PascalCase for components
## Comment Standards
@@ -251,14 +277,8 @@ grep_search "import.*ComponentName" # Check usage patterns
```typescript
/**
* Analyzes video content and calculates engagement time
- *
* @param content - Video URL and metadata
- * @param userProfile - User's learning preferences
* @returns Estimated completion time with confidence score
- *
- * @example
- * const estimate = analyzeVideo('/videos/intro.mp4', userProfile);
- * // Returns: { timeMinutes: 15, confidence: 0.85 }
*/
```
@@ -267,19 +287,33 @@ grep_search "import.*ComponentName" # Check usage patterns
- **WHY decisions**: Document reasoning behind non-obvious implementations
- **Edge Cases**: Explain handling of special conditions
- **Error Handling**: Document recovery strategies
-- **Performance**: Note optimization reasons
-### TODO Comments
+## AI Accountability Standards
-```typescript
-// TODO: [#TICKET-123] High priority - Add error retry logic
-// Context: Current implementation fails silently on network errors
-// Timeline: Sprint 3
-```
+### Protocol Compliance Verification
-
+**Before presenting ANY plan or recommendation**:
----
+1. ✅ **State Protocol**: "Following Codebase Analysis Protocol..."
+2. ✅ **Show Evidence**: Present search results and existing implementations found
+3. ✅ **Acknowledge Work**: "I found X is already implemented, Y needs completion"
+4. ✅ **Build Upon**: "Building upon existing work rather than recreating"
+5. ✅ **Accurate Scope**: Present realistic LOC and timeline based on actual state
+
+### Trust Maintenance
+
+**User can rely on AI recommendations when**:
+
+- All protocols followed in correct sequence
+- Existing work acknowledged and respected
+- Plans based on actual codebase state, not assumptions
+
+**User should question AI recommendations when**:
+
+- Protocols skipped or reordered
+- Existing implementations ignored
+- Plans seem to recreate existing functionality
+
@@ -304,16 +338,7 @@ grep_search "ComponentName" src/components/
1. **Reuse existing**: Extend or compose existing components
2. **shadcn/ui base**: Build on shadcn/ui components
3. **Create new**: Only when above options aren't suitable
-
-### 4. Composition Over Creation
-
-- Prefer composing multiple small components
-- Document component composition in JSDoc headers
-- Follow shadcn/ui patterns for consistency
-
-
-
----
+
@@ -329,12 +354,10 @@ grep_search "ComponentName" src/components/
### Confirmation Process
```
-REQUIRED STEPS:
1. Present solution and changes made
2. Ask user to test the fix
3. Request explicit confirmation: "Can you confirm this issue is resolved?"
4. Wait for user verification
-5. If not resolved, investigate further
```
### RCA Documentation
@@ -343,13 +366,8 @@ Create RCA document when:
- Bug required significant investigation (>30 minutes)
- Root cause was non-obvious
-- Issue involves React/Next.js patterns not widely known
- Multiple approaches were evaluated
-- Debugging revealed important architecture insights
-
-
-
----
+
@@ -359,45 +377,19 @@ Create RCA document when:
- **ALWAYS** ask clarifying questions before implementation
- **NEVER** assume requirements without confirmation
-- **DOCUMENT** all assumptions and decisions
-- **VALIDATE** understanding before proceeding
### Question Categories
-**Technical Architecture**:
-
-- Data structure and relationships
-- User interaction flow
-- Performance requirements
-- Integration patterns
-- Scalability considerations
-
-**Feature Specification**:
-
-- Exact functionality
-- Edge case handling
-- Validation rules
-- Error handling approach
-- Accessibility requirements
-
-**Implementation**:
-
-- Technology stack choices
-- Component architecture
-- State management approach
-- Testing strategy
-- Deployment approach
+**Technical Architecture**: Data structure, user flow, performance, integration, scalability
+**Feature Specification**: Functionality, edge cases, validation, error handling, accessibility
+**Implementation**: Technology choices, component architecture, state management, testing, deployment
## MoSCoW Prioritization
- **Must Have**: Critical features for MVP
- **Should Have**: Important but not critical
- **Could Have**: Nice to have features
-- **Won't Have**: Out of scope for current iteration
-
-
-
----
+
@@ -408,14 +400,7 @@ Create RCA document when:
- **No unit tests**: Deferred until post-MVP
- **Focus**: Feature completion over test coverage
- **Quality Gates**: ESLint, TypeScript, build validation only
-
-**Rationale**: Rapid iteration and feature completion for MVP delivery
-
-**Post-MVP**: Comprehensive automated testing suite will be implemented
-
-
-
----
+
@@ -424,12 +409,7 @@ Create RCA document when:
- **Location**: Centralized in `src/lib/mock-data.ts`
- **TypeScript**: Use proper interfaces for typed data
- **Organization**: Group by feature
-- **Structure**: Easy replacement for real APIs
-- **Alternatives**: `src/data/`, `src/mocks/`, or `src/lib/data/` for larger projects
-
-
-
----
+
@@ -438,13 +418,5 @@ Create RCA document when:
### Tavus CVI Components - CSS Modules
**Status**: Deferred to Post-MVP
-
**Issue**: Tavus CVI uses CSS modules; project uses Tailwind v4 + shadcn/ui
-
-**Impact**: Two styling systems in codebase
-
-**Action**: Post-MVP migration to Tailwind patterns
-
-**Priority**: Medium (after feature validation)
-
-
+**Action**: Po
diff --git a/specs/00-specification-framework.md b/specs/00-specification-framework.md
deleted file mode 100644
index 8f20544..0000000
--- a/specs/00-specification-framework.md
+++ /dev/null
@@ -1,394 +0,0 @@
-# Specification Framework & Process
-
-## Overview
-
-This document outlines the systematic approach for gathering requirements, clarifying specifications, and managing iterative development with safe rollback points.
-
-## Core Principles
-
-### 1. Clarifying Questions First
-- **ALWAYS** ask clarifying questions before implementation
-- **NEVER** assume requirements without confirmation
-- **DOCUMENT** all assumptions and decisions
-- **VALIDATE** understanding before proceeding
-
-### 2. MoSCoW Prioritization
-- **Must Have**: Critical features for MVP
-- **Should Have**: Important but not critical
-- **Could Have**: Nice to have features
-- **Won't Have**: Out of scope for current iteration
-
-### 3. Safe Rollback Points
-- **Checkpoint commits** after each major feature
-- **Feature branches** for experimental work
-- **Specification versioning** for requirement changes
-- **Documentation snapshots** for decision history
-
-## Specification Process
-
-### Phase 1: Requirements Gathering
-1. **Initial Requirements**: User provides high-level feature request
-2. **Clarifying Questions**: Developer asks specific technical questions
-3. **Requirement Confirmation**: User confirms understanding
-4. **MoSCoW Classification**: Prioritize requirements
-
-### Phase 2: Specification Creation
-1. **Project Specification**: High-level architecture and milestones
-2. **Feature Specifications**: Detailed feature requirements
-3. **Technical Specifications**: Implementation approach
-4. **Acceptance Criteria**: Definition of done
-
-### Phase 3: Branch Readiness & Development Initiation
-1. **Feature Planning**: Present branch readiness plan following release strategy
-2. **User Confirmation**: Ask "Ready to create the branch and start {feature_name} development? 🚀"
-3. **Branch Creation**: Only after user confirms, create feature branch
-4. **Development Kickoff**: Begin implementation with established patterns
-
-### Phase 4: Iterative Development
-1. **Implementation Planning**: Break down into tasks
-2. **Development Cycles**: Short iterations with checkpoints
-3. **Review & Feedback**: Regular validation with user
-4. **Rollback Safety**: Maintain safe rollback points
-
-## Clarifying Questions Framework
-
-### Technical Architecture Questions
-- **Data Structure**: How should data be organized and related?
-- **User Experience**: What is the expected user interaction flow?
-- **Performance**: What are the performance requirements?
-- **Integration**: How should external services be integrated?
-- **Scalability**: What are the future scaling considerations?
-
-### Feature Specification Questions
-- **Functionality**: What exactly should this feature do?
-- **Edge Cases**: How should edge cases be handled?
-- **Validation**: What validation rules apply?
-- **Error Handling**: How should errors be presented to users?
-- **Accessibility**: What accessibility requirements exist?
-
-### Implementation Questions
-- **Technology Stack**: Which technologies should be used?
-- **Component Architecture**: How should components be structured?
-- **State Management**: How should state be managed?
-- **Testing Strategy**: What testing approach should be used?
-- **Deployment**: How should the feature be deployed?
-
-## Documentation Standards
-
-### Project Specification Document
-- **Executive Summary**: High-level project overview
-- **Requirements**: Functional and non-functional requirements
-- **Architecture**: System architecture and technology stack
-- **Milestones**: Development phases and deliverables
-- **Constraints**: Technical and business constraints
-
-### Feature Specification Documents
-- **Feature Overview**: Purpose and goals
-- **User Stories**: Detailed user interaction scenarios
-- **Technical Requirements**: Implementation specifications
-- **Acceptance Criteria**: Definition of done
-- **Dependencies**: Related features and external dependencies
-
-### Decision Log
-- **Decision**: What was decided
-- **Context**: Why the decision was made
-- **Alternatives**: What other options were considered
-- **Consequences**: Impact of the decision
-- **Date**: When the decision was made
-
-## Rollback Strategy
-
-### Checkpoint Management
-- **Feature Checkpoints**: After each complete feature
-- **Specification Checkpoints**: After requirement changes
-- **Architecture Checkpoints**: After major architectural decisions
-- **Integration Checkpoints**: After external service integrations
-
-### Rollback Triggers
-- **Requirement Changes**: Major scope changes
-- **Technical Issues**: Blocking technical problems
-- **Performance Issues**: Unacceptable performance degradation
-- **User Feedback**: Negative user experience feedback
-
-### Rollback Process
-1. **Identify Issue**: Document the problem clearly
-2. **Assess Impact**: Determine scope of rollback needed
-3. **Execute Rollback**: Return to last safe checkpoint
-4. **Update Specifications**: Revise requirements based on learnings
-5. **Plan Forward**: Create new implementation approach
-
-## Collaboration Guidelines
-
-### Developer Responsibilities
-- Ask clarifying questions proactively
-- Document all assumptions and decisions
-- Provide regular progress updates
-- Maintain clean, rollback-safe code
-
-### User Responsibilities
-- Provide clear, detailed requirements
-- Respond to clarifying questions promptly
-- Review and validate specifications
-- Provide timely feedback on implementations
-
-### Shared Responsibilities
-- Maintain open communication
-- Document decisions and changes
-- Respect rollback points and processes
-- Focus on iterative improvement
-
-## Quality Assurance
-
-### Specification Quality
-- **Completeness**: All requirements covered
-- **Clarity**: Unambiguous specifications
-- **Testability**: Clear acceptance criteria
-- **Maintainability**: Easy to update and modify
-
-### Implementation Quality
-- **Code Standards**: Follow established coding standards
-- **Testing**: Comprehensive test coverage
-- **Documentation**: Clear code and API documentation
-- **Performance**: Meet performance requirements
-
-### Quality Gates (MANDATORY)
-
-#### Pre-Completion Validation
-Before declaring any feature, component, or phase "complete", the following quality gates **MUST** be satisfied:
-
-##### Code Quality Gates
-1. **ESLint Validation**: `npm run lint` must pass with **0 errors**
- - All unused variables prefixed with underscore (`_`)
- - No `any` types without justification
- - All imports properly used
- - Consistent code formatting
-
-2. **TypeScript Validation**: `npm run type-check` must pass for **production code**
- - All production components and utilities must compile without errors
- - Test files may have type issues if they don't block core functionality
- - Strict mode compliance required
-
-3. **Build Verification**: `npm run build` must succeed
- - All components must compile for production
- - No build-breaking errors
- - All imports and dependencies resolved
-
-##### Functional Quality Gates
-4. **Core Functionality**: Primary use cases must work as specified
- - Manual testing of main user flows
- - Component renders without runtime errors
- - All specified props and callbacks function correctly
-
-5. **Accessibility**: Basic accessibility requirements met
- - Proper ARIA labels and roles
- - Keyboard navigation support
- - Screen reader compatibility
-
-##### Documentation Quality Gates
-6. **Code Documentation**: All public APIs documented
- - JSDoc headers for public functions and components
- - Usage examples provided
- - Edge cases and error handling documented
-
-7. **README Updates**: Documentation reflects new functionality
- - New components listed in project structure
- - Usage examples provided
- - Installation/setup instructions updated if needed
-
-#### Definition of "Complete"
-A feature/component/phase is **ONLY** considered complete when:
-- ✅ All quality gates above are satisfied
-- ✅ Acceptance criteria from specifications are met
-- ✅ Code is ready for production deployment
-- ✅ Documentation is updated and accurate
-
-#### Quality Gate Enforcement
-- **Developers**: Must run quality checks before claiming completion
-- **Code Reviews**: Reviewers must verify quality gates are met
-- **CI/CD**: Automated checks prevent deployment of failing code
-- **Rollback**: Features failing quality gates must be rolled back
-
-#### Quality Gate Exceptions
-Exceptions to quality gates require:
-- **Explicit documentation** of the issue and rationale
-- **Approval** from Tech Lead or Lead Developer
-- **Timeline** for resolution of the exception
-- **Risk assessment** of deploying with known issues
-
-### Process Quality
-- **Communication**: Clear, timely communication
-- **Documentation**: Thorough documentation of decisions
-- **Rollback Safety**: Maintain safe rollback points
-- **Continuous Improvement**: Learn from each iteration
-- **Quality First**: Never compromise quality gates for speed
-
-## Role-Based Permissions Framework
-
-### Permission Levels
-
-#### Current Phase (Solo/Small Team)
-- **Lead Developer/Product Owner**: Full permissions (all actions)
-- **CEO/Partner**: Specification review and approval rights
-- **Contributors**: Development and PR creation rights
-
-#### Growth Phase (5-15 developers)
-- **Tech Lead**: Architecture decisions, spec modifications, release management
-- **Senior Developers**: PR approvals, feature spec creation, mentoring
-- **Mid-Level Developers**: Feature development, junior developer PR reviews
-- **Junior Developers**: Feature development under supervision
-- **Product Owner**: Product specification management, feature prioritization
-
-#### Enterprise Phase (15+ developers)
-- **Engineering Manager**: Team management, process oversight
-- **Principal Engineer**: Architecture governance, technical standards
-- **Staff Engineers**: Cross-team coordination, complex feature leadership
-- **Domain Experts**: Specialized area ownership (security, performance, etc.)
-- **QA Engineers**: Testing standards, quality gate management
-
-### Permission Matrix
-
-| Action | Current Lead | Tech Lead | Senior Dev | Mid Dev | Junior Dev | Product Owner |
-|--------|--------------|-----------|------------|---------|------------|---------------|
-| **Code & Development** |
-| Create PRs | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ |
-| Approve PRs | ✅ | ✅ | ✅ | ✅* | ❌ | ❌ |
-| Merge to main | ✅ | ✅ | ✅** | ❌ | ❌ | ❌ |
-| Create releases | ✅ | ✅ | ✅** | ❌ | ❌ | ❌ |
-| Deploy to production | ✅ | ✅ | ✅** | ❌ | ❌ | ❌ |
-| **Specifications** |
-| Modify project specs | ✅ | ✅ | ❌ | ❌ | ❌ | ✅ |
-| Create feature specs | ✅ | ✅ | ✅ | ❌ | ❌ | ✅ |
-| Approve spec changes | ✅ | ✅ | ❌ | ❌ | ❌ | ✅ |
-| **Standards & Process** |
-| Modify dev standards | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ |
-| Update CI/CD | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ |
-| Architecture decisions | ✅ | ✅ | ✅*** | ❌ | ❌ | ❌ |
-
-*Mid-level developers can approve junior developer PRs only
-**Senior developers require tech lead approval for production actions
-***Senior developers can propose architecture changes, not unilaterally decide
-
-### Adaptive Permissions
-
-#### Permission Evolution
-As the team grows, permissions automatically adjust based on:
-- **Experience Level**: Demonstrated competency in codebase
-- **Domain Expertise**: Specialized knowledge areas
-- **Leadership Responsibilities**: Team mentoring and coordination
-- **Business Impact**: Scope of decision-making authority
-
-#### Permission Escalation
-- **Technical Escalation**: Complex decisions → Tech Lead → Principal Engineer
-- **Product Escalation**: Feature conflicts → Product Owner → CEO
-- **Process Escalation**: Team conflicts → Engineering Manager
-- **Emergency Escalation**: Production issues → On-call engineer → Tech Lead
-
-### Specification Change Management
-
-#### Change Categories
-1. **Minor Changes**: Typos, clarifications, formatting
- - **Who**: Any team member
- - **Approval**: None required (direct commit)
- - **Notification**: Git commit message
-
-2. **Feature Changes**: New features, requirement modifications
- - **Who**: Senior+ developers, Product Owner
- - **Approval**: Tech Lead + Product Owner
- - **Notification**: Team announcement, changelog entry
-
-3. **Architecture Changes**: System design, technology stack
- - **Who**: Tech Lead, Principal Engineer
- - **Approval**: Architecture review board
- - **Notification**: All-hands announcement, migration guide
-
-4. **Process Changes**: Development workflow, standards
- - **Who**: Tech Lead, Engineering Manager
- - **Approval**: Team consensus (voting)
- - **Notification**: Process documentation update
-
-#### Change Approval Workflow
-```
-Change Proposal → Impact Assessment → Stakeholder Review → Approval → Implementation → Communication
-```
-
-### Implementation Guidelines
-
-#### Current Implementation (Solo Phase)
-- Document all decisions in specification files
-- Use GitHub issues for change tracking
-- Maintain changelog for major decisions
-- Regular specification reviews (monthly)
-
-#### Growth Phase Implementation
-- Implement GitHub branch protection rules
-- Add required reviewers based on file paths
-- Create specification review templates
-- Establish regular architecture review meetings
-
-#### Enterprise Phase Implementation
-- Formal RFC (Request for Comments) process
-- Architecture Decision Records (ADRs)
-
-## Branch Readiness Protocol
-
-### Pre-Development Checklist
-Before starting any new feature development, the following protocol must be followed:
-
-#### 1. Feature Planning Presentation
-- **Specification Review**: Present completed feature specification
-- **Branch Strategy**: Show branch naming following release strategy conventions
-- **Stacked PR Plan**: Outline planned PR breakdown (200-400 LOC each)
-- **Integration Points**: Identify dependencies on existing systems
-- **Timeline Estimate**: Provide sprint-based development timeline
-
-#### 2. Branch Readiness Plan Template
-```markdown
-## 🌿 **{Feature Name} Branch Readiness Plan**
-
-### **Branch Strategy**
-- **Branch Name**: `feature/{kebab-case-name}`
-- **Base Branch**: `dev`
-- **Expected Stacked PRs**:
- 1. `feature/{name}/core-functionality`
- 2. `feature/{name}/ui-components`
- 3. `feature/{name}/integration-tests`
-
-### **Dependencies**
-- **Internal**: List existing systems to integrate with
-- **External**: Any new dependencies required
-- **Blockers**: Any prerequisite work needed
-
-### **Success Criteria**
-- **Functional**: Key features that must work
-- **Technical**: Quality gates that must pass
-- **Documentation**: Required docs and examples
-
-### **Timeline**
-- **Sprint Length**: {1-4 weeks}
-- **Milestones**: Key checkpoints and deliverables
-- **Review Points**: When to seek user feedback
-```
-
-#### 3. User Confirmation Required
-- **Mandatory Question**: "Ready to create the branch and start {feature_name} development? 🚀"
-- **Wait for Explicit Confirmation**: Do not proceed without user approval
-- **Document Confirmation**: Record user approval in development log
-
-#### 4. Branch Creation & Development Kickoff
-- **Create Feature Branch**: Only after user confirmation
-- **Initialize Directory Structure**: Set up required folders and files
-- **Create Initial Specification Commit**: Commit feature spec as first commit
-- **Begin Implementation**: Start with core functionality first
-
-### Benefits of This Protocol
-- **Project Alignment**: Ensures user and developer are aligned before work begins
-- **Resource Planning**: Clear understanding of scope and timeline
-- **Risk Mitigation**: Identifies potential issues before development starts
-- **Quality Assurance**: Maintains consistent development patterns
-- **Documentation**: Creates clear development history and decision trail
-- Automated permission enforcement
-- Regular permission audits and updates
-
----
-
-**Next Steps**: Use this framework to create Project Specification and Feature Specification documents for the 8P3P LMS system.
diff --git a/specs/01-development-standards.md b/specs/01-development-standards.md
deleted file mode 100644
index 8c0ac0c..0000000
--- a/specs/01-development-standards.md
+++ /dev/null
@@ -1,484 +0,0 @@
-# Development Standards & Best Practices
-
-## Next.js 15+ Compliance (Highest Priority)
-
-### Server Components First Rule
-- **DEFAULT**: Always start with Server Components (no "use client")
-- **ONLY add "use client"** when you need:
- - State management (useState, useReducer)
- - Event handlers (onClick, onChange)
- - Browser APIs (localStorage, window)
- - React hooks that require client-side execution
-
-### Route Parameters Handling
-- **Server Components**: Use `await params` directly
-- **Client Components**: Use `useParams` hook from `@/hooks/use-params`
-- **NEVER**: Use manual Promise unwrapping with `use()` in components
-
-### Code Quality Standards
-- **MUST**: Run `npm run lint` before suggesting code
-- **MUST**: Follow ESLint rules in `eslint.config.mjs`
-- **MUST**: Use TypeScript strict mode
-- **MUST**: Remove unused imports and variables
-- **MUST**: Pass all quality gates before declaring features complete (see `specs/00-specification-framework.md#quality-gates`)
-
-### Codebase Analysis Protocol (MANDATORY)
-Before making ANY recommendations about files, components, or functionality:
-
-#### 1. Existing Implementation Check
-- **MUST**: Search for existing implementations: `grep_search "functionName|ComponentName"`
-- **MUST**: Check component directories: `find_by_name "*component-name*|*feature-name*"`
-- **MUST**: Read related files completely, not just snippets
-- **MUST**: Verify actual usage patterns: `grep_search "import.*from.*filename"`
-
-#### 2. Duplication Prevention
-- **NEVER**: Suggest creating new files without checking for existing implementations
-- **NEVER**: Assume functionality doesn't exist without comprehensive searching
-- **ALWAYS**: Build upon existing work rather than recreating it
-- **ALWAYS**: Acknowledge existing implementations before suggesting changes
-
-#### 3. Recommendation Protocol
-- **READ FIRST, RECOMMEND SECOND**: Always scan existing codebase thoroughly
-- **VERIFY ASSUMPTIONS**: Never assume something doesn't exist without searching
-- **ASK CLARIFYING QUESTIONS**: "I see you have X, are you looking to enhance it or replace it?"
-- **ACKNOWLEDGE EXISTING WORK**: Recognize what's already implemented well
-
-#### 4. Standard Analysis Commands
-```bash
-# Before any file/component recommendations:
-grep_search "ComponentName|functionName" # Check existing implementations
-find_by_name "*feature*|*component*" # Find related files
-grep_search "import.*ComponentName" # Check usage patterns
-Read existing-file.tsx # Read complete implementations
-```
-
-**Violation Consequence**: If this protocol is not followed and results in duplicate work or incorrect assumptions, immediately acknowledge the error, provide corrected analysis, and explain the missed steps.
-
-### Quality Gate Compliance
-Before any feature, component, or phase can be marked as "complete":
-1. **ESLint**: `npm run lint` passes with 0 errors
-2. **TypeScript**: `npm run type-check` passes for production code
-3. **Build**: `npm run build` succeeds without errors
-4. **Functionality**: Core use cases work as specified
-5. **Documentation**: README and code docs updated
-
-**Reference**: See `specs/00-specification-framework.md` for complete quality gate requirements.
-
-### Branch Readiness Protocol (MANDATORY)
-Before starting any new feature development:
-1. **Present Branch Readiness Plan**: Show feature spec, branch strategy, and timeline
-2. **Get User Confirmation**: Ask "Ready to create the branch and start {feature_name} development? 🚀"
-3. **Wait for Approval**: Do NOT create branches or start development without explicit user confirmation
-4. **Document Decision**: Record user approval and proceed with branch creation
-
-**Reference**: See `specs/00-specification-framework.md#branch-readiness-protocol` for complete protocol.
-
-## ESLint & TypeScript Rules
-
-### Core Principles
-1. **Code Consistency**: Maintain consistent coding style across projects
-2. **Type Safety**: Leverage TypeScript's type system for better code quality
-3. **Performance**: Follow best practices for React and Next.js performance
-4. **Maintainability**: Write clean, self-documenting code
-
-### Key ESLint Rules
-- `@next/next/no-async-client-component`: Prevents async Client Components
-- `@typescript-eslint/no-unused-vars`: Prevents unused variables (prefix with `_`)
-- `@typescript-eslint/no-explicit-any`: Warns about `any` type usage
-- `react-hooks/exhaustive-deps`: Warns about missing hook dependencies
-
-### Variable Naming Conventions
-- Use descriptive variable names
-- Prefix unused variables with underscore (`_`)
-- Use camelCase for variables and functions
-- Use PascalCase for components and types
-
-## Clean Code & Developer Experience (DX)
-
-### Comment Standards for Better DX
-- **MUST**: Add comprehensive comments for better developer experience
-- **MUST**: Document complex business logic and "why" decisions
-- **MUST**: Include JSDoc headers for all public functions and components
-- **MUST**: Explain edge cases and error handling approaches
-
-### Function Documentation Pattern
-```typescript
-/**
- * Calculates estimated completion time for learning content
- *
- * Uses industry-standard reading speeds (225 WPM) and actual video duration
- * to provide accurate time estimates for user planning and progress tracking.
- *
- * @param content - Content analysis data (word count, video duration, etc.)
- * @param userProfile - User's historical learning data for personalization
- * @returns Time estimate object with breakdown and confidence level
- *
- * @example
- * const estimate = calculateEstimatedTime(
- * { wordCount: 500, videoDuration: 300, complexity: 'medium' },
- * { readingSpeed: 250, completionRate: 0.85 }
- * );
- * // Returns: { total: 8, reading: 2, video: 5, interaction: 1, confidence: 0.9 }
- */
-export function calculateEstimatedTime(
- content: ContentAnalysis,
- userProfile: UserProfile
-): TimeEstimate {
- // Use personalized reading speed or fall back to industry average
- // Research shows 225 WPM is optimal for technical content comprehension
- const readingSpeed = userProfile.readingSpeed || 225;
-
- // Calculate base reading time in minutes
- const readingTime = content.wordCount / readingSpeed;
-
- // Video time is exact - no estimation needed
- const videoTime = content.videoDuration / 60;
-
- // Add interaction buffer based on content complexity
- // Complex content requires 20-30% additional time for processing
- const complexityMultiplier = {
- low: 1.1, // 10% buffer for simple content
- medium: 1.2, // 20% buffer for moderate complexity
- high: 1.3 // 30% buffer for complex concepts
- };
-
- const interactionTime = (readingTime + videoTime) *
- (complexityMultiplier[content.complexity] - 1);
-
- return {
- reading: Math.round(readingTime),
- video: Math.round(videoTime),
- interaction: Math.round(interactionTime),
- total: Math.round(readingTime + videoTime + interactionTime),
- confidence: calculateConfidence(content, userProfile)
- };
-}
-```
-
-### Component Documentation Pattern
-```typescript
-/**
- * Reusable timer component for tracking user interactions with time limits
- *
- * Supports multiple variants (countdown, stopwatch, progress) and integrates
- * with quiz systems, AI interactions, and content consumption tracking.
- *
- * @param duration - Timer duration in seconds
- * @param onComplete - Callback fired when timer reaches zero or target
- * @param onTick - Optional callback fired every second with remaining time
- * @param variant - Visual and behavioral variant
- * @param autoStart - Whether to start timer immediately on mount
- *
- * @example
- * // Quiz timer with 4-minute limit
- *
- *
- * @example
- * // Content consumption tracking
- *
- */
-export function Timer({
- duration,
- onComplete,
- onTick,
- variant = 'countdown',
- autoStart = false
-}: TimerProps) {
- // Track current time state with 1-second precision
- const [currentTime, setCurrentTime] = useState(
- variant === 'countdown' ? duration : 0
- );
-
- // Handle timer completion for all variants
- useEffect(() => {
- const isComplete = variant === 'countdown'
- ? currentTime <= 0
- : currentTime >= duration;
-
- if (isComplete && onComplete) {
- // Prevent multiple completion calls
- onComplete();
- }
- }, [currentTime, onComplete, variant, duration]);
-
- return (
-
- {/* Accessible time display with proper ARIA labels */}
-
-
- );
-}
-```
-
-### Business Logic Comments
-```typescript
-// BUSINESS RULE: Users must complete video + all sections before quiz unlock
-// This ensures proper learning progression and prevents quiz attempts
-// without consuming the prerequisite content
-const isQuizUnlocked = (chapter: Chapter): boolean => {
- // Video completion is optional for chapters (some are text-only)
- const videoComplete = !chapter.videoUrl || chapter.videoCompleted;
-
- // All sections must be completed (this is mandatory)
- const allSectionsComplete = chapter.sections.every(
- section => section.completed
- );
-
- return videoComplete && allSectionsComplete;
-};
-
-// PERFORMANCE NOTE: This calculation runs on every render
-// Consider memoizing if chapter data is large or changes frequently
-const chapterProgress = useMemo(() => {
- return calculateChapterProgress(chapter);
-}, [chapter.sections, chapter.videoCompleted, chapter.quizPassed]);
-```
-
-### Error Handling Comments
-```typescript
-try {
- const userSession = await fetchAuthSession();
- return userSession.tokens?.accessToken;
-} catch (error) {
- // EDGE CASE: Session might be expired or invalid
- // Don't throw here - let components handle unauthenticated state gracefully
- // This prevents auth errors from breaking the entire app
- console.warn('Auth session fetch failed:', error);
- return null;
-}
-```
-
-### TODO Comments with Context
-```typescript
-// TODO: Implement adaptive time limits based on user performance
-// Ticket: LMS-234 | Priority: Medium | Timeline: Sprint 3
-// Context: Users with higher completion rates could get extended time
-// Research: 15% of users request more time on complex assessments
-const getQuizTimeLimit = (quiz: Quiz, user: User): number => {
- return quiz.defaultTimeLimit; // Currently using static time limits
-};
-```
-
-## Clarifying Questions Protocol
-
-### Requirements Gathering Process
-1. **ALWAYS** ask clarifying questions before implementation
-2. **NEVER** assume requirements without explicit confirmation
-3. **DOCUMENT** all assumptions and decisions in specification files
-4. **VALIDATE** understanding through detailed confirmation
-
-### Question Categories
-- **Technical Architecture**: Data structure, component design, integration approach
-- **User Experience**: Interaction flows, edge cases, error handling
-- **Business Logic**: Rules, validation, constraints, performance requirements
-- **Implementation**: Technology choices, testing strategy, deployment approach
-
-### MoSCoW Prioritization
-- **Must Have**: Critical for MVP functionality
-- **Should Have**: Important but not blocking
-- **Could Have**: Nice-to-have features
-- **Won't Have**: Out of scope for current iteration
-
-### Specification Documentation
-- **Project Specification**: High-level architecture and milestones (see `specs/06-project-specification.md`)
-- **Feature Specifications**: Detailed feature requirements (see `specs/features/`)
-- **Decision Log**: Document all major decisions and rationale
-- **Safe Rollback Points**: Maintain checkpoints for safe rollback
-
-## File Organization & Architecture
-
-### Separation of Concerns (SoC)
-- **Data Layer**: `src/lib/*-data.ts` - Pure data only
-- **Business Logic**: `src/lib/*-utils.ts` - Functions and calculations
-- **Components**: UI logic only
-
-### File Path Requirements
-1. **ALWAYS** mention which file path the user needs to paste code in
-2. **IF** code spans multiple files, divide snippets and mention each file path
-3. **IF** file doesn't exist, provide steps to generate the files
-4. **COMMENT** every piece of code that improves code quality
-
-### Data Organization
-- **Centralized Location**: `src/lib/mock-data.ts` - keeps all mock data in one place
-- **Typed Data**: Export with proper TypeScript interfaces
-- **Organized by Feature**: Group related data together
-- **Easy to Replace**: When ready for real APIs, just change the import
-
-## Component Development
-
-### Component Reusability Protocol (MANDATORY)
-**ALWAYS follow this sequence before creating new components:**
-
-1. **Scan Existing Components**: Search `src/components/` for similar functionality
-2. **Evaluate Reusability**: Can existing components be extended or composed?
-3. **Search shadcn/ui**: Use web search on https://ui.shadcn.com/docs/components for relevant base components
-4. **Choose Approach**:
- - **Reuse**: Extend existing component with additional props
- - **Compose**: Combine multiple existing components
- - **New**: Create new component using shadcn/ui as base
-
-### Component Creation Workflow
-```typescript
-// 1. Import existing components first
-import { ExistingComponent } from "@/components/common/existing";
-import { Button } from "@/components/ui/button"; // shadcn/ui
-
-// 2. Compose or extend rather than recreate
-export function NewComponent({ ...props }: NewComponentProps) {
- return (
-
-
-
- );
-}
-```
-
-### shadcn/ui Integration
-- **Install Components**: `npx shadcn@latest add {component-name}`
-- **Extend, Don't Modify**: Create wrapper components instead of modifying shadcn/ui directly
-- **Consistent Theming**: Use Tailwind CSS v4 theme system for customization
-
-### Component Structure
-- Use Server Components by default
-- Only use Client Components when necessary (interactivity, browser APIs)
-- Keep components focused on single responsibility
-- Extract reusable logic into custom hooks
-- **Document Reusability**: Include JSDoc comments about component composition
-
-### Performance Best Practices
-- Memoize expensive calculations with `useMemo`
-- Memoize callbacks with `useCallback` when passed as props
-- Use proper dependency arrays in hooks
-- Avoid unnecessary re-renders
-
-### Type Safety
-- Avoid using `any` type
-- Define proper interfaces and types
-- Use type narrowing instead of type assertions
-- Leverage TypeScript's utility types
-
-## Testing Standards
-
-### Jest Configuration (Next.js Official)
-
-**Reference**: [Next.js Testing with Jest](https://nextjs.org/docs/app/guides/testing/jest.md)
-
-Our testing setup follows Next.js official recommendations:
-
-#### Required Dependencies
-```bash
-npm install --save-dev jest jest-environment-jsdom @testing-library/react @testing-library/jest-dom
-```
-
-#### Jest Configuration (`jest.config.mjs`)
-```javascript
-import nextJest from 'next/jest.js'
-
-const createJestConfig = nextJest({
- // Provide the path to your Next.js app to load next.config.js and .env files
- dir: './',
-})
-
-// Add any custom config to be passed to Jest
-const config = {
- coverageProvider: 'v8',
- testEnvironment: 'jsdom',
- // Add more setup options before each test is run
- setupFilesAfterEnv: ['/jest.setup.js'],
-}
-
-// createJestConfig is exported this way to ensure that next/jest can load the Next.js config which is async
-export default createJestConfig(config)
-```
-
-#### Jest Setup (`jest.setup.js`)
-```javascript
-import '@testing-library/jest-dom'
-```
-
-### Testing Best Practices
-
-#### Component Testing
-- **MUST**: Use React Testing Library for component tests
-- **MUST**: Test user interactions, not implementation details
-- **MUST**: Include accessibility testing (screen readers, keyboard navigation)
-- **MUST**: Mock external dependencies and API calls
-
-#### Test Structure
-- **MUST**: Follow AAA pattern (Arrange, Act, Assert)
-- **MUST**: Use descriptive test names that explain the expected behavior
-- **MUST**: Group related tests using `describe` blocks
-- **MUST**: Clean up after tests (unmount components, clear mocks)
-
-#### Coverage Requirements
-- **MINIMUM**: 80% coverage for new components and utilities
-- **FOCUS**: Critical business logic and user interactions
-- **EXCLUDE**: Configuration files, mock data, and type definitions
-
-## Development Workflow
-
-### Pre-commit Validation
-```bash
-npm run lint # ESLint checking
-npm run lint:fix # Auto-fix issues
-npm run lint:strict # Fail on warnings
-npm run type-check # TypeScript validation
-npm run test # Run Jest tests
-npm run validate # Lint + type check + tests
-```
-
-### Build Process
-- Lint and type check before building
-- Run tests before committing
-- Use pre-commit hooks for quality assurance
-- Follow consistent Node.js version (20+)
-- Cache dependencies for faster builds
-
-## Bug Resolution Protocol
-
-### Mandatory User Confirmation
-- **REQUIRED**: All bug/issue resolutions must be confirmed by the user
-- **PROCESS**: Present solution → User tests → Explicit confirmation required
-- **NEVER**: Mark issues as resolved without user verification
-- **REFERENCE**: See `specs/05-bug-resolution-workflow.md` for complete process
-
-### Resolution Documentation
-- **MUST**: Create resolution ticket descriptions for all fixes
-- **INCLUDE**: Root cause analysis, technical changes, verification steps
-- **FORMAT**: Follow standard template in bug resolution workflow
-- **PURPOSE**: Knowledge sharing and future reference
-
-## Documentation Maintenance
-
-### README.md Update Requirements
-- **MANDATORY**: Update README.md for any changes that affect:
- - **Workflow changes**: Development process, CI/CD pipeline, build steps
- - **Architecture changes**: New patterns, component structure, data flow
- - **Feature additions**: New functionality, components, or capabilities
- - **Enhancement updates**: Performance improvements, UX changes, optimization
- - **DevOps changes**: Deployment process, environment setup, infrastructure
- - **Dependency changes**: New packages, version upgrades, tool changes
- - **Configuration changes**: Environment variables, build settings, auth setup
-
-### Documentation Standards
-- **IMMEDIATE**: Update README.md in the same PR/commit as the change
-- **COMPREHENSIVE**: Include setup instructions, usage examples, troubleshooting
-- **ACCURATE**: Verify all instructions work in clean environment
-- **CURRENT**: Remove outdated information and broken links
-- **ACCESSIBLE**: Use clear language and step-by-step instructions
\ No newline at end of file
diff --git a/specs/02-aws-amplify-backend.md b/specs/02-aws-amplify-backend.md
deleted file mode 100644
index 6f0fa96..0000000
--- a/specs/02-aws-amplify-backend.md
+++ /dev/null
@@ -1,222 +0,0 @@
-# AWS Amplify Gen2 Backend Standards
-
-## Authentication Configuration
-
-### Core Authentication Rules
-1. **ALWAYS** import `secret` for authentication-based configurations
-2. **External Providers**: Only Google, Apple, Amazon, Facebook are supported
-3. **Callback/Logout URLs**: Must be inside `externalProviders` object
-4. **User Attributes**: Must be outside `loginWith` object
-5. **Login Methods**: Only `email` and `phone` are supported (no `username`)
-
-### Required Imports
-```typescript
-import { defineAuth, secret } from "@aws-amplify/backend";
-```
-
-### Authentication Structure
-```typescript
-export const auth = defineAuth({
- loginWith: {
- email: true,
- phone: true,
- externalProviders: {
- google: {
- clientId: secret("GOOGLE_CLIENT_ID"),
- clientSecret: secret("GOOGLE_CLIENT_SECRET"),
- },
- signInWithApple: {
- clientId: secret("SIWA_CLIENT_ID"),
- keyId: secret("SIWA_KEY_ID"),
- privateKey: secret("SIWA_PRIVATE_KEY"),
- teamId: secret("SIWA_TEAM_ID"),
- },
- callbackUrls: ["http://localhost:3000/profile"],
- logoutUrls: ["http://localhost:3000/"],
- },
- },
- userAttributes: {
- email: { mutable: true, required: true },
- givenName: { mutable: true, required: true },
- "custom:organization": {
- dataType: "String",
- mutable: true,
- minLen: 3,
- maxLen: 100,
- },
- },
- multifactor: {
- mode: "OPTIONAL",
- sms: true,
- totp: false,
- },
- accountRecovery: "EMAIL_AND_PHONE_WITHOUT_MFA",
-});
-```
-
-### Custom Attributes Rules
-- **Standard Attributes**: `familyName`, `givenName`, `email`, `phoneNumber`, etc.
-- **Custom Attributes**: Use `"custom:attributeName"` format
-- **Required Field**: Always add `dataType` for custom attributes
-- **No Required Field**: Custom attributes don't support `required: true`
-
-## Data Schema Design
-
-### Schema Design Rules (Source of Truth)
-1. **Authorization**: Use `.guest()` instead of `.public()` (Gen2 only)
-2. **Relationships**: `.belongsTo()` and `.hasMany()` always require related field ID
-3. **Enums**: Don't use `.required()` or `.defaultValue()` with enums
-4. **Permissions**: Use `.to()` for group permissions: `allow.guest().to(['read', 'write'])`
-
-### Relationship Patterns
-
-#### One-to-Many (hasMany/belongsTo)
-```typescript
-const schema = a.schema({
- Team: a.model({
- name: a.string().required(),
- members: a.hasMany("Member", "teamId"), // Reference field required
- }),
- Member: a.model({
- name: a.string().required(),
- teamId: a.id(), // Reference field
- team: a.belongsTo("Team", "teamId"), // Must match reference field
- }),
-});
-```
-
-#### One-to-One (hasOne/belongsTo)
-```typescript
-const schema = a.schema({
- Customer: a.model({
- name: a.string(),
- activeCart: a.hasOne("Cart", "customerId"),
- }),
- Cart: a.model({
- items: a.string().array(),
- customerId: a.id(),
- customer: a.belongsTo("Customer", "customerId"),
- }),
-});
-```
-
-#### Many-to-Many (Join Table)
-```typescript
-const schema = a.schema({
- PostTag: a.model({
- postId: a.id().required(),
- tagId: a.id().required(),
- post: a.belongsTo("Post", "postId"),
- tag: a.belongsTo("Tag", "tagId"),
- }),
- Post: a.model({
- title: a.string(),
- tags: a.hasMany("PostTag", "postId"),
- }),
- Tag: a.model({
- name: a.string(),
- posts: a.hasMany("PostTag", "tagId"),
- }),
-});
-```
-
-### Authorization Patterns
-```typescript
-// Correct authorization syntax
-.authorization((allow) => [
- allow.owner(),
- allow.guest().to(["read", "write", "delete"])
-])
-
-// INCORRECT - Don't use this format
-.authorization([allow => allow.owner(), allow => allow.guest().to(['read'])])
-```
-
-### Data Operations
-
-#### Creating Relationships
-```typescript
-// One-to-Many
-const { data: team } = await client.models.Team.create({
- name: "Frontend Team",
-});
-const { data: member } = await client.models.Member.create({
- name: "John",
- teamId: team.id,
-});
-```
-
-#### Lazy Loading
-```typescript
-const { data: team } = await client.models.Team.get({ id: "TEAM_ID" });
-const { data: members } = await team.members();
-```
-
-#### Eager Loading
-```typescript
-const { data: teamWithMembers } = await client.models.Team.get(
- { id: "TEAM_ID" },
- { selectionSet: ["id", "members.*"] }
-);
-```
-
-### Schema Export Pattern
-```typescript
-import { type ClientSchema, a, defineData } from "@aws-amplify/backend";
-
-const schema = a.schema({
- // Models here
-}).authorization((allow) => [allow.guest()]);
-
-export type Schema = ClientSchema;
-
-export const data = defineData({
- schema,
- authorizationModes: {
- defaultAuthorizationMode: "apiKey",
- apiKeyAuthorizationMode: {
- expiresInDays: 30,
- },
- },
-});
-```
-
-## Deployment Configuration
-
-### Amplify.yml Structure
-```yaml
-version: 1
-backend:
- phases:
- build:
- commands:
- - nvm install 20
- - nvm use 20
- - npm ci --cache .npm --prefer-offline
- - npx ampx generate outputs --app-id $AWS_APP_ID --branch $AWS_BRANCH --format json
-frontend:
- phases:
- preBuild:
- commands:
- - nvm install 20
- - nvm use 20
- - npm ci --cache .npm --prefer-offline
- build:
- commands:
- - npm run build
- artifacts:
- baseDirectory: .next
- files:
- - "**/*"
- cache:
- paths:
- - .next/cache/**/*
- - .npm/**/*
- - node_modules/**/*
-```
-
-### Key Deployment Rules
-- **Node.js Version**: Explicitly use Node.js 20+ in both backend and frontend
-- **Backend Phase**: Required for Gen2 to generate `amplify_outputs.json`
-- **Caching**: Include npm, Next.js, and node_modules for faster builds
-- **Outputs Generation**: Use `ampx generate outputs` for proper config generation
\ No newline at end of file
diff --git a/specs/03-design-system-standards.md b/specs/03-design-system-standards.md
deleted file mode 100644
index 9337c44..0000000
--- a/specs/03-design-system-standards.md
+++ /dev/null
@@ -1,383 +0,0 @@
-# Design System Standards: shadcn/ui + Tailwind CSS v4
-
-## Architecture Overview
-
-Our design system is built on **shadcn/ui** components with **Tailwind CSS v4** for styling, following official best practices for maximum compatibility and developer experience.
-
-### Core Stack
-
-- **shadcn/ui**: Primary component library
-- **Tailwind CSS v4**: Utility-first CSS framework (CSS-first configuration)
-- **next-themes**: Theme management
-- **CSS Variables**: Dynamic theming system
-
-## Configuration Standards
-
-### CSS-First Configuration (Tailwind v4)
-
-- **No config file needed**: Tailwind v4 uses CSS-first configuration
-- **Single import**: Use `@import "tailwindcss";` in your main CSS file
-- **Theme customization**: Use `@theme` directive with CSS variables
-- **Layer organization**: Use `@layer base`, `@layer components`, `@layer utilities`
-
-### PostCSS Configuration
-
-```javascript
-// postcss.config.mjs
-const config = {
- plugins: ["@tailwindcss/postcss"], // Tailwind v4 plugin
-};
-```
-
-### Stylesheet Structure and Order
-
-**Proper directive order in globals.css:**
-
-1. **@import statements** (must come first)
-
- ```css
- @import url("https://fonts.googleapis.com/css2?family=Montserrat:wght@100;200;300;400;500;600;700;800&display=swap");
- @import "tailwindcss";
- ```
-
-2. **@theme directive** (for Tailwind theme customization)
-
- ```css
- @theme {
- --color-primary: oklch(28.08% 0.051 260.2);
- --color-accent: oklch(76.65% 0.139 91.06);
- --font-display: "Montserrat", sans-serif;
- }
- ```
-
-3. **CSS variables** (in :root and .dark)
-
- ```css
- :root {
- --background: oklch(100% 0 0);
- --foreground: oklch(28.08% 0.051 260.2);
- }
-
- .dark {
- --background: oklch(28.08% 0.051 260.2);
- --foreground: oklch(100% 0 0);
- }
- ```
-
-4. **@layer directives** (in cascade order)
- ```css
- @layer base {
- * {
- border-color: var(--border);
- }
- body {
- background-color: var(--background);
- color: var(--foreground);
- }
- }
- ```
-
-### Base Layer Best Practices
-
-- **Use CSS variables directly** in `@layer base`, NOT `@apply` directives
-- **Correct**: `background-color: var(--background);`
-- **Incorrect**: `@apply bg-background;`
-- **Reason**: Tailwind v4 promotes CSS-first approach with direct variable usage
-
-## Theme System
-
-### CSS Variables Convention
-
-Follow shadcn/ui's background/foreground convention:
-
-```css
-:root {
- --background: oklch(100% 0 0);
- --foreground: oklch(28.08% 0.051 260.2);
- --primary: oklch(28.08% 0.051 260.2);
- --primary-foreground: oklch(100% 0 0);
- --accent: oklch(76.65% 0.139 91.06);
- --accent-foreground: oklch(28.08% 0.051 260.2);
-}
-
-.dark {
- --background: oklch(28.08% 0.051 260.2);
- --foreground: oklch(100% 0 0);
- /* ... other dark variants */
-}
-```
-
-### Theme Provider Setup
-
-```tsx
-// components/theme-provider.tsx
-"use client";
-
-import * as React from "react";
-import { ThemeProvider as NextThemesProvider } from "next-themes";
-
-export function ThemeProvider({
- children,
- ...props
-}: React.ComponentProps) {
- return {children};
-}
-```
-
-```tsx
-// app/layout.tsx
-import { ThemeProvider } from "@/components/theme-provider";
-
-export default function RootLayout({
- children,
-}: {
- children: React.ReactNode;
-}) {
- return (
-
-
-
- {children}
-
-
-
- );
-}
-```
-
-## Component Standards
-
-### shadcn/ui Components First
-
-Always use shadcn/ui components as the foundation:
-
-```bash
-# Add components
-npx shadcn@latest add button
-npx shadcn@latest add card
-npx shadcn@latest add dialog
-```
-
-```tsx
-import { Button } from "@/components/ui/button";
-import { Card, CardContent, CardHeader } from "@/components/ui/card";
-import { Dialog, DialogContent, DialogTrigger } from "@/components/ui/dialog";
-
-// Preferred approach
-
-
- ...
- ...
-
-```
-
-### Color Usage Standards
-
-**Use semantic color tokens**, not direct colors:
-
-```tsx
-// ✅ Correct - semantic tokens
-
-