|  | 
|  | 1 | +# Development Workflow for AI Agents | 
|  | 2 | + | 
|  | 3 | +## Pre-Development Checklist | 
|  | 4 | + | 
|  | 5 | +Before making any code changes: | 
|  | 6 | + | 
|  | 7 | +1. **Environment Setup** | 
|  | 8 | +   ```bash | 
|  | 9 | +   npm ci                    # Install dependencies | 
|  | 10 | +   npm run lint             # Check code quality | 
|  | 11 | +   npm run test             # Run existing tests | 
|  | 12 | +   ``` | 
|  | 13 | + | 
|  | 14 | +2. **Understand the Change** | 
|  | 15 | +   - Read the issue/PR description carefully | 
|  | 16 | +   - Identify which platforms are affected (iOS/Android/both) | 
|  | 17 | +   - Check if the change affects critical user flows | 
|  | 18 | +   - Review related components and dependencies | 
|  | 19 | + | 
|  | 20 | +3. **Analyze Impact** | 
|  | 21 | +   - Check for breaking changes | 
|  | 22 | +   - Identify affected components | 
|  | 23 | +   - Consider performance implications | 
|  | 24 | +   - Plan testing strategy | 
|  | 25 | + | 
|  | 26 | +## Development Process | 
|  | 27 | + | 
|  | 28 | +### Code Changes | 
|  | 29 | +1. **Follow Existing Patterns** | 
|  | 30 | +   - Study similar implementations in the codebase | 
|  | 31 | +   - Use existing utility functions and components | 
|  | 32 | +   - Follow the established file structure | 
|  | 33 | + | 
|  | 34 | +2. **TypeScript Best Practices** | 
|  | 35 | +   - Add proper type definitions | 
|  | 36 | +   - Use existing types when possible | 
|  | 37 | +   - Avoid `any` types | 
|  | 38 | +   - Export types that might be reused | 
|  | 39 | + | 
|  | 40 | +3. **React Native Considerations** | 
|  | 41 | +   - Test on both iOS and Android if applicable | 
|  | 42 | +   - Consider different screen sizes | 
|  | 43 | +   - Handle loading and error states | 
|  | 44 | +   - Implement proper accessibility | 
|  | 45 | + | 
|  | 46 | +### Testing Strategy | 
|  | 47 | +1. **Unit Tests** | 
|  | 48 | +   - Test utility functions | 
|  | 49 | +   - Test component logic | 
|  | 50 | +   - Mock external dependencies | 
|  | 51 | +   - Use existing test patterns | 
|  | 52 | + | 
|  | 53 | +2. **Integration Testing** | 
|  | 54 | +   - Test navigation flows | 
|  | 55 | +   - Test data fetching | 
|  | 56 | +   - Test user interactions | 
|  | 57 | + | 
|  | 58 | +### Code Quality | 
|  | 59 | +1. **Linting and Formatting** | 
|  | 60 | +   ```bash | 
|  | 61 | +   npm run lint             # Check for issues | 
|  | 62 | +   npm run pretty          # Format code | 
|  | 63 | +   ``` | 
|  | 64 | + | 
|  | 65 | +2. **Type Checking** | 
|  | 66 | +   ```bash | 
|  | 67 | +   npx tsc --noEmit        # Type check without compilation | 
|  | 68 | +   ``` | 
|  | 69 | + | 
|  | 70 | +## Common Development Tasks | 
|  | 71 | + | 
|  | 72 | +### Adding a New Screen | 
|  | 73 | +1. Create component in appropriate `views/` subdirectory | 
|  | 74 | +2. Add navigation types to `navigation/types.ts` | 
|  | 75 | +3. Configure navigation in relevant navigator | 
|  | 76 | +4. Add any required permissions or native modules | 
|  | 77 | +5. Test on both platforms | 
|  | 78 | + | 
|  | 79 | +### Adding a New Component | 
|  | 80 | +1. Place in `components/` for shared components | 
|  | 81 | +2. Export from appropriate index file | 
|  | 82 | +3. Add TypeScript props interface | 
|  | 83 | +4. Include proper styling with `StyleSheet.create()` | 
|  | 84 | +5. Add accessibility props | 
|  | 85 | + | 
|  | 86 | +### API Integration | 
|  | 87 | +1. Use React Query for data fetching | 
|  | 88 | +2. Add proper error handling | 
|  | 89 | +3. Implement loading states | 
|  | 90 | +4. Consider offline scenarios | 
|  | 91 | +5. Add TypeScript types for API responses | 
|  | 92 | + | 
|  | 93 | +### State Management | 
|  | 94 | +1. Use local state (useState) for component-specific data | 
|  | 95 | +2. Use React Query for server state | 
|  | 96 | +3. Use Redux for global app state | 
|  | 97 | +4. Consider performance implications | 
|  | 98 | + | 
|  | 99 | +## File Organization | 
|  | 100 | + | 
|  | 101 | +### Directory Structure | 
|  | 102 | +``` | 
|  | 103 | +source/ | 
|  | 104 | +├── components/          # Reusable UI components | 
|  | 105 | +├── views/              # Screen components organized by feature | 
|  | 106 | +│   ├── dining/         # Dining-related screens | 
|  | 107 | +│   ├── directory/      # Directory search screens | 
|  | 108 | +│   ├── calendar/       # Calendar and events | 
|  | 109 | +│   └── ... | 
|  | 110 | +├── lib/               # Utility functions and shared logic | 
|  | 111 | +├── navigation/        # Navigation configuration | 
|  | 112 | +└── redux/            # Global state management | 
|  | 113 | +``` | 
|  | 114 | + | 
|  | 115 | +### Naming Conventions | 
|  | 116 | +- Components: `PascalCase` (e.g., `StudentWorkView`) | 
|  | 117 | +- Files: `kebab-case` (e.g., `student-work-view.tsx`) | 
|  | 118 | +- Directories: `kebab-case` | 
|  | 119 | +- Constants: `UPPER_SNAKE_CASE` | 
|  | 120 | + | 
|  | 121 | +## Platform-Specific Considerations | 
|  | 122 | + | 
|  | 123 | +### iOS Specific | 
|  | 124 | +- Use `.ios.tsx` extension for iOS-only components | 
|  | 125 | +- Consider iOS design patterns (navigation bars, tab bars) | 
|  | 126 | +- Handle safe area insets properly | 
|  | 127 | +- Test on various iPhone screen sizes | 
|  | 128 | + | 
|  | 129 | +### Android Specific | 
|  | 130 | +- Use `.android.tsx` extension for Android-only components | 
|  | 131 | +- Follow Material Design guidelines | 
|  | 132 | +- Handle Android back button | 
|  | 133 | +- Test on various Android screen sizes and versions | 
|  | 134 | + | 
|  | 135 | +### Cross-Platform | 
|  | 136 | +- Use `Platform.select()` for platform-specific styles | 
|  | 137 | +- Test thoroughly on both platforms | 
|  | 138 | +- Consider platform-specific user expectations | 
|  | 139 | + | 
|  | 140 | +## Common Patterns in This Codebase | 
|  | 141 | + | 
|  | 142 | +### Data Fetching | 
|  | 143 | +```typescript | 
|  | 144 | +// Use React Query for API calls | 
|  | 145 | +const {data, isLoading, error} = useQuery({ | 
|  | 146 | +  queryKey: ['key'], | 
|  | 147 | +  queryFn: fetchFunction, | 
|  | 148 | +}); | 
|  | 149 | +``` | 
|  | 150 | + | 
|  | 151 | +### Navigation | 
|  | 152 | +```typescript | 
|  | 153 | +// Typed navigation | 
|  | 154 | +import {useNavigation} from '@react-navigation/native'; | 
|  | 155 | +import type {RootStackParamList} from '../navigation/types'; | 
|  | 156 | + | 
|  | 157 | +const navigation = useNavigation<NavigationProp<RootStackParamList>>(); | 
|  | 158 | +``` | 
|  | 159 | + | 
|  | 160 | +### Error Handling | 
|  | 161 | +```typescript | 
|  | 162 | +// Consistent error boundaries and user-friendly messages | 
|  | 163 | +try { | 
|  | 164 | +  // API call or operation | 
|  | 165 | +} catch (error) { | 
|  | 166 | +  // Log error and show user-friendly message | 
|  | 167 | +} | 
|  | 168 | +``` | 
|  | 169 | + | 
|  | 170 | +## Debugging and Troubleshooting | 
|  | 171 | + | 
|  | 172 | +### Common Issues | 
|  | 173 | +1. **Metro bundler issues** - Clear cache: `npx react-native start --reset-cache` | 
|  | 174 | +2. **iOS build issues** - Clean and rebuild: `cd ios && xcodebuild clean` | 
|  | 175 | +3. **Android build issues** - Clean gradle: `cd android && ./gradlew clean` | 
|  | 176 | +4. **Dependency issues** - Clear node_modules and reinstall | 
|  | 177 | + | 
|  | 178 | +### Debugging Tools | 
|  | 179 | +- React Native Debugger | 
|  | 180 | +- Flipper for network and Redux debugging | 
|  | 181 | +- Console logs (remove before production) | 
|  | 182 | +- React DevTools | 
|  | 183 | + | 
|  | 184 | +## Performance Considerations | 
|  | 185 | + | 
|  | 186 | +### Optimization Strategies | 
|  | 187 | +1. Use `FlatList` for long lists | 
|  | 188 | +2. Implement proper image loading | 
|  | 189 | +3. Avoid unnecessary re-renders | 
|  | 190 | +4. Use `useCallback` and `useMemo` judiciously | 
|  | 191 | +5. Optimize bundle size | 
|  | 192 | + | 
|  | 193 | +### Memory Management | 
|  | 194 | +1. Clean up subscriptions and listeners | 
|  | 195 | +2. Handle component unmounting properly | 
|  | 196 | +3. Avoid memory leaks in async operations | 
|  | 197 | +4. Monitor app performance on older devices | 
|  | 198 | + | 
|  | 199 | +## Security Considerations | 
|  | 200 | + | 
|  | 201 | +### Mobile Security | 
|  | 202 | +- Never commit API keys or secrets | 
|  | 203 | +- Use secure storage for sensitive data | 
|  | 204 | +- Validate all user inputs | 
|  | 205 | +- Handle deep links securely | 
|  | 206 | +- Use HTTPS for all network requests | 
|  | 207 | + | 
|  | 208 | +### Code Security | 
|  | 209 | +- Avoid storing sensitive data in plain text | 
|  | 210 | +- Use proper authentication flows | 
|  | 211 | +- Implement proper session management | 
|  | 212 | +- Consider code obfuscation for sensitive logic | 
|  | 213 | + | 
|  | 214 | +## Deployment Considerations | 
|  | 215 | + | 
|  | 216 | +### Build Process | 
|  | 217 | +- Test builds on both platforms | 
|  | 218 | +- Verify all assets are included | 
|  | 219 | +- Check bundle size and performance | 
|  | 220 | +- Test on physical devices | 
|  | 221 | + | 
|  | 222 | +### Release Process | 
|  | 223 | +- Follow semantic versioning | 
|  | 224 | +- Update changelog | 
|  | 225 | +- Test on multiple devices and OS versions | 
|  | 226 | +- Coordinate with app store review process | 
|  | 227 | + | 
|  | 228 | +## Documentation | 
|  | 229 | + | 
|  | 230 | +### Code Documentation | 
|  | 231 | +- Add JSDoc comments for complex functions | 
|  | 232 | +- Document component props with TypeScript | 
|  | 233 | +- Include usage examples for reusable components | 
|  | 234 | +- Document any unusual patterns or workarounds | 
|  | 235 | + | 
|  | 236 | +### Update Documentation | 
|  | 237 | +- Update README.md if adding new features | 
|  | 238 | +- Update CONTRIBUTING.md if changing development process | 
|  | 239 | +- Document any new dependencies or setup requirements | 
|  | 240 | + | 
|  | 241 | +Remember: Mobile development requires extra attention to performance, user experience, and platform differences. Always test thoroughly on real devices when possible. | 
0 commit comments