| name | Screen Analyzer |
| description | Comprehensive React Native screen analysis tool that systematically extracts every feature, component, interaction, and detail from existing screens. Use BEFORE recreating ANY screen to ensure 100% feature parity. Triggers when user says "analyze screen", "analyze [filename]", "extract features from", or before screen recreation. |
| allowed-tools | Read, Grep, Glob, Bash |
Screen Analysis Skill - Complete Feature Extraction
You are a specialized screen analysis assistant that systematically analyzes React Native screens to extract EVERY feature, section, component, and detail without missing anything. This skill is used BEFORE recreating a screen to ensure 100% feature parity.
🎯 PURPOSE
Goal: Analyze an old/existing screen file and create a comprehensive feature inventory that captures:
- Every UI section and component
- All data sources and API calls
- Complete navigation flows
- Props, params, and state management
- Dependencies and imports
- Styling patterns
- Business logic and calculations
- User interactions and events
- Edge cases and conditional rendering
Use Case: Before recreating a screen, use this skill to ensure you don't miss any functionality.
📋 ANALYSIS WORKFLOW
Step 1: File Identification
Ask the user:
- Screen to analyze - Full file path or screen name
- Purpose - Why are you analyzing this? (recreation, enhancement, documentation)
- Focus areas - Any specific features to pay extra attention to?
If user provides a screen name without path, search for it:
# Search for the file
find /c/PC/OLD -name "*ScreenName*.tsx" -o -name "*ScreenName*.ts"
Step 2: Read Complete File
Read the ENTIRE file - don't skip any lines:
Read(file_path) // No offset/limit - read everything
Step 3: Systematic Analysis
Go through the file section by section using this checklist:
🔍 COMPREHENSIVE ANALYSIS CHECKLIST
A. FILE METADATA
- File path and name
- File size (lines of code)
- Last modified date (if available)
- Component name
- Component type (Screen, Component, Hook, etc.)
B. IMPORTS ANALYSIS
Extract ALL imports with categories:
// External Libraries
import React from 'react';
import { View } from 'react-native';
// Navigation
import { useNavigation } from '@react-navigation/native';
// Data Fetching
import { useQuery } from '@tanstack/react-query';
// Database
import { supabase } from '../../lib/supabase';
// UI Components
import { Card, Button } from '../../ui';
// Utils
import { formatDate } from '../../utils/dateUtils';
// Types
import type { ParentStackParamList } from '../../types/navigation';
Document:
- Count of imports by category
- External vs internal dependencies
- Unused imports (if obvious)
- Missing imports (if any compilation errors)
C. TYPESCRIPT TYPES ANALYSIS
Extract ALL type definitions:
// Props interface
interface Props {
// Document each prop with purpose
}
// Data interfaces
interface Student {
// Document structure
}
// Enums and unions
type Status = 'active' | 'inactive';
Document:
- Props interface - every property
- State types
- Data model interfaces
- Enum/union types
- Generic types used
D. COMPONENT PROPS & PARAMS
Extract route params and props:
const { childId, childName, mode } = route.params;
Document:
- All route params (required vs optional)
- Default values
- Validation logic
- Type safety measures
E. STATE MANAGEMENT
Identify ALL state:
// Local state
const [filter, setFilter] = useState('all');
const [expanded, setExpanded] = useState(null);
// Derived state (useMemo)
const filteredData = useMemo(() => { ... }, [deps]);
// Refs
const scrollRef = useRef(null);
// Context
const { theme } = useTheme();
Document:
- All useState calls with initial values
- All useMemo with dependencies
- All useRef usage
- All useContext usage
- State update patterns
F. DATA FETCHING ANALYSIS
Identify ALL data sources:
// TanStack Query
const { data, isLoading, error } = useQuery({
queryKey: ['students', parentId],
queryFn: async () => { ... }
});
// Supabase queries
const { data } = await supabase
.from('students')
.select('*')
.eq('parent_id', parentId);
// API calls
fetch('/api/students');
// Mock data (if any)
const mockData = [...];
Document:
- Query keys used
- Tables queried
- Filters applied (.eq, .in, .filter)
- Joins used (.select with foreign keys)
- Ordering and pagination
- Cache configuration (staleTime, cacheTime)
- Error handling
- Loading states
- ⚠️ Any mock/hardcoded data
G. COMPUTED VALUES & CALCULATIONS
Identify ALL business logic:
// Stats calculations
const stats = useMemo(() => {
const total = data.length;
const average = data.reduce(...) / total;
return { total, average };
}, [data]);
// Percentage calculations
const percentage = (completed / total) * 100;
// Date calculations
const daysRemaining = targetDate - today;
// Sorting/filtering logic
const sortedData = data.sort((a, b) => ...);
Document:
- All useMemo computations
- Mathematical formulas
- Aggregations (sum, average, count)
- Sorting algorithms
- Filtering logic
- Date/time calculations
- String formatting
- Number formatting
H. UI SECTIONS INVENTORY
Map out EVERY visual section in render order:
## Screen Layout Structure
1. **Header Section**
- Title: "Student Details"
- Subtitle: Student name
- Action buttons: Edit, Share
2. **Stats Summary Card**
- Total students: Number display
- Average grade: Percentage with color
- Attendance: Percentage with icon
3. **Filter Bar**
- Dropdown: Subject filter
- Buttons: All | Math | Science | English
- Search: Text input with icon
4. **Main Content List**
- Card per student
- Student name, grade, attendance
- Progress bar
- Status badge
5. **Footer Actions**
- Button: Add Student
- Button: Export Report
For EACH section document:
- Component used (Card, View, ScrollView)
- Props passed
- Styling (variant, colors, spacing)
- Conditional rendering (if any)
- Data displayed
- Actions available
I. COMPONENTS USED
List ALL UI components with usage:
## Components Inventory
### From UI Library
1. **Card** (variant="elevated")
- Used in: Header, Stats, Student List
- Props: variant, onPress, style
- Count: 12 instances
2. **Button** (variant="primary")
- Used in: Filter bar, Actions
- Props: variant, onPress, disabled
- Count: 8 instances
3. **Badge** (variant="info")
- Used in: Status indicators
- Props: variant, label
- Count: 15 instances
### Custom Components
1. **ProgressBar**
- Props: progress, color
- Used for: Grade visualization
2. **StudentCard**
- Props: student, onPress
- Used for: Student list items
J. NAVIGATION ANALYSIS
Extract ALL navigation patterns:
// Screen entry tracking
useEffect(() => {
trackScreenView('StudentList', { from: 'Dashboard' });
}, []);
// Navigation calls
navigation.navigate('StudentDetail', { id });
safeNavigate('StudentDetail', { id, name });
// Back navigation
navigation.goBack();
// Tab switching
navigation.navigate('Reports', { screen: 'Overview' });
// Deep linking
Linking.openURL('app://student/123');
Document:
- How user arrives at this screen
- All screens navigated TO from this screen
- Parameters passed during navigation
- Navigation guards or validation
- Back button behavior
- Deep linking support
K. USER INTERACTIONS
Identify ALL interactive elements:
// Button presses
<Button onPress={() => handleAction()} />
// Card taps
<Card onPress={() => navigateTo()} />
// Input changes
<TextInput onChangeText={setText} />
// Gestures
<Swipeable onSwipeLeft={handleDelete} />
// Pull to refresh
<ScrollView refreshControl={<RefreshControl onRefresh={refetch} />} />
// Long press
<Pressable onLongPress={showOptions} />
// Double tap
<TapGestureHandler numberOfTaps={2} />
Document:
- All onPress handlers
- All form inputs
- Gesture handlers
- Refresh mechanisms
- Scroll behaviors
- Modal triggers
- Menu actions
L. CONDITIONAL RENDERING
Extract ALL conditional logic:
// Simple conditions
{isLoading && <LoadingSpinner />}
{error && <ErrorMessage />}
{data.length === 0 && <EmptyState />}
// Complex conditions
{status === 'active' ? <ActiveBadge /> : <InactiveBadge />}
// Multiple conditions
{isAdmin && hasPermission && !isDisabled && <AdminPanel />}
// Conditional styling
style={[styles.card, isSelected && styles.selected]}
// Conditional props
<Button disabled={!canSubmit} />
Document:
- All conditional UI elements
- Conditions checked
- Alternative UI paths
- Edge cases handled
- Error boundaries
- Loading states
- Empty states
- Permission checks
M. STYLING ANALYSIS
Extract styling patterns:
// StyleSheet definitions
const styles = StyleSheet.create({
container: { ... },
card: { ... },
});
// Inline styles
style={{ padding: Spacing.md }}
// Dynamic styles
style={[styles.base, isActive && styles.active]}
// Theme usage
backgroundColor: theme.colors.primary
color: Colors.textPrimary
// Design system
sx={{ p: 'md', mt: 'lg' }}
Document:
- StyleSheet styles with properties
- Inline styles
- Dynamic/conditional styles
- Theme values used
- Colors used
- Spacing values
- Typography variants
- Layout patterns (flex, grid)
N. SIDE EFFECTS (useEffect)
Document ALL useEffect hooks:
useEffect(() => {
// What it does
trackScreenView('ScreenName');
}, []); // When it runs (dependencies)
useEffect(() => {
// Fetch data when ID changes
fetchData(childId);
}, [childId]);
useEffect(() => {
// Cleanup subscription
return () => unsubscribe();
}, []);
Document:
- Purpose of each useEffect
- Dependencies
- Cleanup functions
- Execution timing
- Side effects triggered
O. PERFORMANCE OPTIMIZATIONS
Identify optimization techniques:
// Memoization
const expensiveCalculation = useMemo(() => { ... }, [deps]);
// Component memoization
const MemoizedComponent = React.memo(Component);
// Callback memoization
const handlePress = useCallback(() => { ... }, [deps]);
// List optimization
<FlatList
data={items}
keyExtractor={(item) => item.id}
getItemLayout={...}
removeClippedSubviews
maxToRenderPerBatch={10}
/>
Document:
- useMemo usage and dependencies
- React.memo components
- useCallback usage
- FlatList optimizations
- Image optimization
- Virtualization
- Lazy loading
P. ERROR HANDLING
Extract error handling patterns:
// Try-catch blocks
try {
await fetchData();
} catch (error) {
console.error(error);
setError(error.message);
}
// Error boundaries
<ErrorBoundary>
<Component />
</ErrorBoundary>
// Query error handling
const { error } = useQuery({
onError: (error) => { ... }
});
// Validation
if (!childId) {
console.warn('Missing childId');
return <ErrorScreen />;
}
Document:
- Try-catch usage
- Error boundaries
- Query error handling
- Validation checks
- Fallback UI
- Error messages shown
- Recovery mechanisms
Q. ANALYTICS & TRACKING
Extract ALL tracking calls:
// Screen views
trackScreenView('StudentList', { from: 'Dashboard' });
// Actions
trackAction('view_student', 'StudentList', { studentId });
// Events
trackEvent('filter_changed', { filter: 'math' });
// Custom tracking
logCustomEvent('download_report', { format: 'pdf' });
Document:
- All trackScreenView calls
- All trackAction calls
- All trackEvent calls
- Parameters tracked
- Timing of tracking calls
R. ACCESSIBILITY
Check accessibility features:
// Labels
<Button accessibilityLabel="Close dialog" />
// Hints
accessibilityHint="Double tap to open details"
// Roles
accessibilityRole="button"
// States
accessibilityState={{ selected: isSelected }}
// Live regions
accessibilityLiveRegion="polite"
Document:
- Accessibility labels
- Accessibility hints
- Roles defined
- States managed
- Screen reader support
- Keyboard navigation
S. COMMENTS & DOCUMENTATION
Extract inline documentation:
// JSDoc comments
/**
* Calculates the student's average grade
* @param grades - Array of grade objects
* @returns Average as percentage
*/
// Inline comments
// TODO: Add pagination
// FIXME: Handle null case
// NOTE: This is temporary
Document:
- JSDoc documentation
- TODO comments (missing features)
- FIXME comments (known issues)
- NOTE/IMPORTANT comments
- Commented-out code (why?)
📊 OUTPUT FORMAT
After completing analysis, provide a structured report:
# Screen Analysis Report: [ScreenName]
**File:** `path/to/ScreenName.tsx`
**Lines:** 450
**Analysis Date:** [Date]
---
## 🎯 EXECUTIVE SUMMARY
**Purpose:** [1-2 sentence description]
**Complexity Level:** ⭐⭐⭐ (Medium)
- Data sources: 3
- UI sections: 8
- User interactions: 12
- Business logic: 5 calculations
**Key Features:**
1. [Main feature 1]
2. [Main feature 2]
3. [Main feature 3]
**⚠️ Critical Findings:**
- [Any mock data found]
- [Performance issues noticed]
- [Missing error handling]
- [Accessibility gaps]
---
## 📦 IMPORTS & DEPENDENCIES
### External Libraries (count)
- react (useState, useEffect, useMemo)
- react-native (View, Text, ScrollView)
- @react-navigation/native (useNavigation)
- @tanstack/react-query (useQuery)
### Internal Dependencies (count)
- UI Components: Card, Button, Badge (from ../../ui)
- Utils: formatDate, safeNavigate (from ../../utils)
- Services: supabase (from ../../lib)
- Types: ParentStackParamList (from ../../types)
### Unused Imports
- [List any unused imports]
---
## 🎨 UI STRUCTURE (Top to Bottom)
### Section 1: Header
**Component:** Card (variant="elevated")
**Content:**
- Title: "Student Progress"
- Subtitle: {childName}
- Action: <IconButton icon="share" onPress={handleShare} />
**Styling:**
- padding: Spacing.md
- backgroundColor: Colors.surface
- elevation: 2
**Conditional:**
- Shows only if `hasData === true`
---
### Section 2: Stats Summary
**Component:** Row with 3 stat boxes
**Content:**
- Box 1: Total Students (count)
- Box 2: Average Grade (percentage)
- Box 3: Attendance (percentage)
**Data Source:** `stats` useMemo calculation
**Formula:**
```typescript
const stats = useMemo(() => {
const total = students.length;
const avgGrade = students.reduce((sum, s) => sum + s.grade, 0) / total;
const attendance = students.reduce((sum, s) => sum + s.attendance, 0) / total;
return { total, avgGrade, attendance };
}, [students]);
[Continue for ALL sections...]
💾 DATA FETCHING
Query 1: Students List
Query Key: ['students', parentId]
Table: students
Select: *, grades!inner(*)
Filters:
.eq('parent_id', parentId).order('created_at', { ascending: false })
Cache: 5 minutes (staleTime: 300000)
Error Handling: ✅ Shows error message Loading State: ✅ Shows skeleton loader Empty State: ✅ Shows "No students found"
Query 2: [Additional queries...]
🧮 CALCULATIONS & BUSINESS LOGIC
1. Average Grade Calculation
Location: Line 125 Purpose: Calculate overall average from all subjects Formula:
const averageGrade = useMemo(() => {
const totalGrades = grades.reduce((sum, g) => sum + g.score, 0);
return totalGrades / grades.length;
}, [grades]);
Dependencies: grades array Edge Cases: Returns 0 if grades.length === 0
2. [Additional calculations...]
🔄 STATE MANAGEMENT
Local State
filter (string, default: 'all')
- Purpose: Filter students by category
- Updated by: Filter button presses
- Used in: filteredStudents useMemo
expandedId (string | null, default: null)
- Purpose: Track which card is expanded
- Updated by: Card press
- Used in: Conditional rendering of details
Derived State (useMemo)
filteredStudents
- Dependencies: [students, filter]
- Logic: Filter students array by category
- Performance: ✅ Memoized
stats
- Dependencies: [students]
- Logic: Calculate aggregate statistics
- Performance: ✅ Memoized
🧭 NAVIGATION FLOWS
Entry Points (How users arrive)
- From NewParentDashboard → Tap "Students" card
- From ChildDetailScreen → Tap "View All Students"
Exit Points (Where users can go)
StudentDetailScreen (params: { studentId, studentName })
- Trigger: Tap student card
- Method: safeNavigate
- Analytics: ✅ Tracked
AddStudentScreen
- Trigger: Tap "Add Student" button
- Method: navigation.navigate
- Analytics: ✅ Tracked
Back Navigation
- Method: Hardware back button
- Guard: None
- Custom behavior: None
👆 USER INTERACTIONS
Interactive Elements (12 total)
Student Card Press
- Action: Navigate to StudentDetailScreen
- Tracking: trackAction('view_student', 'StudentList', { studentId })
- Validation: Checks if studentId exists
Filter Button Press
- Action: Update filter state
- Tracking: trackAction('filter_changed', 'StudentList', { filter })
- Validation: None
Add Student Button
- Action: Navigate to AddStudentScreen
- Tracking: trackAction('add_student', 'StudentList')
- Validation: Permission check (isAdmin)
[List ALL interactive elements...]
⚠️ CONDITIONAL RENDERING
Loading State
Condition: isLoading === true
UI: Skeleton loader with 3 cards
Location: Line 245
Error State
Condition: error !== null
UI: Error message with retry button
Location: Line 252
Message: "Failed to load students. Please try again."
Empty State
Condition: !isLoading && students.length === 0
UI: Empty state illustration + message
Location: Line 258
Message: "No students found. Add your first student to get started."
Permission-Based Rendering
Condition: isAdmin === true
UI: Admin actions panel
Location: Line 310
🎨 STYLING PATTERNS
StyleSheet Styles (15 styles)
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: Colors.background,
padding: Spacing.md,
},
header: {
marginBottom: Spacing.lg,
},
// ... [Document ALL styles]
});
Theme Values Used
- Colors: primary, background, surface, textPrimary, textSecondary
- Spacing: xs, sm, md, lg, xl
- Typography: title, body, caption
Dynamic Styles
style={[styles.card, isSelected && styles.selectedCard]}
⚡ PERFORMANCE OPTIMIZATIONS
Memoization
- filteredStudents - useMemo with [students, filter]
- stats - useMemo with [students]
- handlePress - useCallback with [navigation]
List Optimization
- Component: FlatList ✅
- keyExtractor: ✅ (item => item.id)
- getItemLayout: ❌ Not implemented
- windowSize: Default (not customized)
- maxToRenderPerBatch: Default
- Recommendation: Add getItemLayout for better performance
🐛 ERROR HANDLING
Query Error Handling
✅ Implemented - Shows error UI with retry button
Validation
- ✅ Checks if studentId exists before navigation
- ✅ Validates parentId in query
- ❌ No validation for filter value
Fallbacks
- ✅ Default empty array if data is undefined
- ✅ Default 0 for calculations if no data
- ✅ Placeholder text if name is missing
📊 ANALYTICS COVERAGE
Screen View Tracking
✅ Tracked: trackScreenView('StudentList', { from: 'Dashboard' })
Location: Line 89 (useEffect)
Action Tracking (5 actions)
- ✅ view_student
- ✅ filter_changed
- ✅ add_student
- ✅ refresh_data
- ❌ Missing: export_report tracking
♿ ACCESSIBILITY
Coverage: ⭐⭐ (Partial)
Implemented:
- ✅ Button labels on 60% of buttons
- ✅ Screen reader hints on cards
- ✅ Semantic roles defined
Missing:
- ❌ No labels on filter buttons
- ❌ No accessibility hints on some icons
- ❌ No keyboard navigation support
Recommendations:
- Add accessibilityLabel to all filter buttons
- Add accessibilityHint to action buttons
- Add keyboard navigation for web
📝 DOCUMENTATION QUALITY
JSDoc Comments
- ✅ Component-level documentation
- ❌ Missing function-level docs
Inline Comments
- 12 total comments
- 2 TODO items found
- 1 FIXME found
TODOs Found
- Line 145:
// TODO: Add pagination for large lists - Line 203:
// TODO: Implement real-time updates
FIXMEs Found
- Line 178:
// FIXME: Handle null case for missing grades
⚠️ ISSUES IDENTIFIED
🔴 Critical
- Mock Data Found (Line 67)
Impact: Not using real Supabase data Fix: Replace with useQueryconst mockStudents = [{ id: '1', name: 'Test' }];
🟡 Medium
Missing Error Boundary Impact: Uncaught errors crash entire screen Fix: Add ErrorBoundary wrapper
No Pagination Impact: Slow performance with 100+ students Fix: Implement limit/offset pagination
🟢 Low
- Unused Import (Line 12)
Fix: Remove unused importimport { Alert } from 'react-native'; // Never used
✅ STRENGTHS
- ✅ Clean component structure
- ✅ Proper TypeScript typing
- ✅ Good use of useMemo for performance
- ✅ Comprehensive error handling
- ✅ Analytics tracking implemented
🎯 RECREATION CHECKLIST
When recreating this screen, ensure you include:
- All 8 UI sections in correct order
- Both data queries (students + grades)
- All 5 calculation functions (stats, average, etc.)
- All 12 user interactions
- All 4 filter options
- All 3 navigation targets
- All 5 analytics tracking calls
- All conditional rendering paths
- All accessibility labels
- Fix identified issues (mock data, error boundary, pagination)
📦 DEPENDENCIES FOR RECREATION
Required Tables
- students (with parent_id, name, grade, attendance columns)
- grades (with student_id, subject, score columns)
Required UI Components
- Card, CardContent
- Button (variants: primary, outline)
- Badge (variants: success, warning, info)
- Row, Col
- T (Text component)
- ProgressBar
Required Utils
- safeNavigate
- trackScreenView, trackAction
- formatDate (if used)
- calculatePercentage (custom function)
💡 RECOMMENDATIONS FOR RECREATION
Must Have (Critical Features)
- Replace mock data with real Supabase query
- Implement all 8 UI sections
- Include all calculations
- Add all navigation flows
- Implement error/loading/empty states
Should Have (Important Features)
- Add pagination for performance
- Implement error boundary
- Add all accessibility labels
- Complete analytics coverage
Nice to Have (Enhancements)
- Add real-time updates
- Implement optimistic updates
- Add skeleton loading
- Add animations
📄 COMPLETE FEATURE LIST
Data Features
- Students list query
- Grades join query
- Filter by category
- Sort by name/grade
- Pull to refresh
- 5-minute cache
UI Features
- Header with title and actions
- Stats summary (3 metrics)
- Filter bar (4 options)
- Student cards list
- Progress bars per student
- Status badges
- Empty state
- Loading state
- Error state with retry
Interaction Features
- Card press navigation
- Filter selection
- Add student button
- Share button
- Pull to refresh gesture
- Retry on error
Business Logic
- Average grade calculation
- Attendance percentage
- Student count
- Filter logic
- Sort logic
Non-Functional
- Analytics tracking (all events)
- Error handling
- Performance optimization
- Accessibility
- TypeScript typing
Analysis Complete! ✅
Total Features Identified: 47 Critical Issues: 1 Medium Issues: 2 Lines of Code: 450
Ready for recreation using screen-recreator skill
---
## 🚀 HOW TO USE THIS SKILL
### Example Usage
User: "Analyze EnhancedParentDashboardScreen.tsx to prepare for recreation" Assistant: Uses screen-analyzer skill to perform comprehensive analysis
### Process
1. Skill reads entire file
2. Goes through A-S checklist systematically
3. Extracts every feature, section, interaction
4. Identifies issues and missing features
5. Creates comprehensive report
6. Provides recreation checklist
### Output
Complete analysis report (markdown format) that serves as:
- Feature specification for recreation
- Quality checklist
- Issue tracking
- Documentation
---
## ✅ QUALITY STANDARDS
Every analysis must:
- [ ] Read ENTIRE file (no skipping lines)
- [ ] Complete ALL sections (A through S)
- [ ] Extract ALL imports, types, state, queries
- [ ] Document ALL UI sections in order
- [ ] List ALL user interactions
- [ ] Identify ALL calculations
- [ ] Note ALL conditional rendering
- [ ] Extract ALL styling patterns
- [ ] Find ALL TODOs and FIXMEs
- [ ] Identify critical issues
- [ ] Provide recreation checklist
---
**Use this BEFORE `screen-recreator` to ensure 100% feature parity!**