Latest
Electron Desktop Applications
Electron Desktop This document provides comprehensive guidelines for electron desktop development and best practices. Process Communication IPC IPC between main and renderer Implement proper ipc between main and renderer Follow best practices for optimal results Context Context isolation and security Implement proper context isolation and security Follow best practices for optimal results Preload Preload scripts for safe APIs Implement proper preload scripts for safe apis Follow best practices for optimal results Remote Remote module alternatives Implement proper remote module alternatives Follow best practices for optimal results Message Message passing patterns Implement proper message passing patterns Follow best practices for optimal results Security Best Practices Context Context isolation implementation Implement proper context isolation implementation Follow best practices for optimal results Node.js Node.js integration guidelines Implement proper node.js integration guidelines Follow best practices for optimal results Content Content Security Policy (CSP) Implement proper content security policy (csp) Follow best practices for optimal results Secure Secure preload script development Implement proper secure preload script development Follow best practices for optimal results External External content handling Implement proper external content handling Follow best practices for optimal results Window Management Multi-window Multi-window applications Implement proper multi-window applications Follow best practices for optimal results Window Window state persistence Implement proper window state persistence Follow best practices for optimal results Modal Modal and frameless windows Implement proper modal and frameless windows Follow best practices for optimal results Window Window customization Implement proper window customization Follow best practices for optimal results Screen Screen and display management Implement proper screen and display management Follow best practices for optimal results Performance Optimization Memory Memory usage optimization Implement proper memory usage optimization Follow best practices for optimal results CPU CPU performance tuning Implement proper cpu performance tuning Follow best practices for optimal results Startup Startup time improvement Implement proper startup time improvement Follow best practices for optimal results Bundle Bundle size reduction Implement proper bundle size reduction Follow best practices for optimal results Resource Resource loading optimization Implement proper resource loading optimization Follow best practices for optimal results UI Framework Integration React React with Electron Implement proper react with electron Follow best practices for optimal results Vue.js Vue.js desktop applications Implement proper vue.js desktop applications Follow best practices for optimal results Angular Angular Electron apps Implement proper angular electron apps Follow best practices for optimal results Vanilla Vanilla JavaScript development Implement proper vanilla javascript development Follow best practices for optimal results CSS CSS framework integration Implement proper css framework integration Follow best practices for optimal results Storage & Data Local Local database integration Implement proper local database integration Follow best practices for optimal results File-based File-based storage Implement proper file-based storage Follow best practices for optimal results Encrypted Encrypted data storage Implement proper encrypted data storage Follow best practices for optimal results Configuration Configuration management Implement proper configuration management Follow best practices for optimal results User User data handling Implement proper user data handling Follow best practices for optimal results Cross-Platform Considerations Platform-specific Platform-specific code Implement proper platform-specific code Follow best practices for optimal results UI/UX UI/UX differences Implement proper ui/ux differences Follow best practices for optimal results File File path handling Implement proper file path handling Follow best practices for optimal results System System integration variations Implement proper system integration variations Follow best practices for optimal results Testing Testing across platforms Implement proper testing across platforms Follow best practices for optimal results Production Readiness Error Error handling and recovery Implement proper error handling and recovery Follow best practices for optimal results Crash Crash reporting integration Implement proper crash reporting integration Follow best practices for optimal results Performance Performance monitoring Implement proper performance monitoring Follow best practices for optimal results User User analytics Implement proper user analytics Follow best practices for optimal results Support Support and maintenance Implement proper support and maintenance Follow best practices for optimal results Follow these comprehensive guidelines for successful electron desktop implementation.
React Native with Expo
React Native Expo This document provides comprehensive guidelines for react native expo development and best practices. Component Development Use Use functional components with hooks Implement proper use functional components with hooks Follow best practices for optimal results Implement Implement responsive design with Dimensions API Implement proper implement responsive design with dimensions api Follow best practices for optimal results Handle Handle keyboard avoiding views properly Implement proper handle keyboard avoiding views properly Follow best practices for optimal results Use Use FlatList for performance with large lists Implement proper use flatlist for performance with large lists Follow best practices for optimal results Implement Implement proper image handling with expo-image Implement proper implement proper image handling with expo-image Follow best practices for optimal results Performance Optimization Optimize Optimize images and assets Implement proper optimize images and assets Follow best practices for optimal results Use Use lazy loading for screens Implement proper use lazy loading for screens Follow best practices for optimal results Implement Implement proper memory management Implement proper implement proper memory management Follow best practices for optimal results Bundle Bundle splitting with code splitting Implement proper bundle splitting with code splitting Follow best practices for optimal results Performance Performance monitoring with Flipper Implement proper performance monitoring with flipper Follow best practices for optimal results State Management Context Context API for simple state Implement proper context api for simple state Follow best practices for optimal results Redux Redux Toolkit for complex state Implement proper redux toolkit for complex state Follow best practices for optimal results Async Async storage for persistence Implement proper async storage for persistence Follow best practices for optimal results Secure Secure storage for sensitive data Implement proper secure storage for sensitive data Follow best practices for optimal results Cache Cache management strategies Implement proper cache management strategies Follow best practices for optimal results Summary Checklist [ ] Core principles implemented [ ] Best practices followed [ ] Performance optimized [ ] Security measures in place [ ] Testing strategy implemented [ ] Documentation completed [ ] Monitoring configured [ ] Production deployment ready Follow these comprehensive guidelines for successful react native expo implementation.
Jest Testing Framework
Testing Jest This document provides comprehensive guidelines for testing jest development and best practices. Assertion & Matchers Basic Basic matchers (toBe, toEqual, toBeNull) Implement proper basic matchers (tobe, toequal, tobenull) Follow best practices for optimal results Truthiness Truthiness matchers (toBeTruthy, toBeFalsy) Implement proper truthiness matchers (tobetruthy, tobefalsy) Follow best practices for optimal results Number Number matchers (toBeGreaterThan, toBeCloseTo) Implement proper number matchers (tobegreaterthan, tobecloseto) Follow best practices for optimal results String String matchers (toMatch, toContain) Implement proper string matchers (tomatch, tocontain) Follow best practices for optimal results Array Array and object matchers (toContain, toHaveProperty) Implement proper array and object matchers (tocontain, tohaveproperty) Follow best practices for optimal results Mocking & Spies Function Function mocking with jest.fn() Implement proper function mocking with jest.fn() Follow best practices for optimal results Module Module mocking with jest.mock() Implement proper module mocking with jest.mock() Follow best practices for optimal results Partial Partial mocking with jest.requireActual() Implement proper partial mocking with jest.requireactual() Follow best practices for optimal results Mock Mock implementations and return values Implement proper mock implementations and return values Follow best practices for optimal results Spy Spy functions for behavior verification Implement proper spy functions for behavior verification Follow best practices for optimal results Mock Data & Fixtures Creating Creating test data factories Implement proper creating test data factories Follow best practices for optimal results Using Using fixtures for consistent test data Implement proper using fixtures for consistent test data Follow best practices for optimal results Database Database seeding for integration tests Implement proper database seeding for integration tests Follow best practices for optimal results API API response mocking Implement proper api response mocking Follow best practices for optimal results File File system mocking Implement proper file system mocking Follow best practices for optimal results Advanced Testing Patterns Parameterized Parameterized tests with test.each() Implement proper parameterized tests with test.each() Follow best practices for optimal results Testing Testing error boundaries and error cases Implement proper testing error boundaries and error cases Follow best practices for optimal results Testing Testing with different environments Implement proper testing with different environments Follow best practices for optimal results Custom Custom matchers creation Implement proper custom matchers creation Follow best practices for optimal results Testing Testing utilities and helpers Implement proper testing utilities and helpers Follow best practices for optimal results Configuration Jest Jest configuration in package.json Implement proper jest configuration in package.json Follow best practices for optimal results Custom Custom test environments Implement proper custom test environments Follow best practices for optimal results Module Module path mapping Implement proper module path mapping Follow best practices for optimal results Transform Transform configurations Implement proper transform configurations Follow best practices for optimal results Test Test file patterns and ignore patterns Implement proper test file patterns and ignore patterns Follow best practices for optimal results Best Practices Test Test isolation and independence Implement proper test isolation and independence Follow best practices for optimal results Descriptive Descriptive test names and structure Implement proper descriptive test names and structure Follow best practices for optimal results Testing Testing behavior over implementation Implement proper testing behavior over implementation Follow best practices for optimal results Avoiding Avoiding test interdependencies Implement proper avoiding test interdependencies Follow best practices for optimal results Maintaining Maintaining test performance Implement proper maintaining test performance Follow best practices for optimal results Follow these comprehensive guidelines for successful testing jest implementation.
Vue 3 Composition API
Vue 3 Composition API Best Practices Comprehensive guide for mastering Vue 3's Composition API, reactivity system, and building scalable Vue applications. Advanced Reactivity Patterns Computed Properties and Watchers Use computed for derived state that depends on reactive data Implement watchers for side effects and complex reactions Understand when to use watch vs watchEffect Example advanced reactivity: Custom Composables Design Create reusable logic with custom composables Follow naming conventions (use prefix) Implement proper cleanup and lifecycle management Example composable patterns: Performance Optimization Techniques Use shallow reactive when deep reactivity isn't needed Implement proper component lazy loading Optimize large list rendering with virtual scrolling Example performance patterns: State Management and Routing Pinia State Management Use Pinia for global state management Implement proper store composition patterns Handle async operations in stores Example Pinia store: Vue Router 4 Integration Use the composition API with Vue Router Implement proper route guards and navigation Handle route parameters and query strings Example router integration: Summary Checklist [ ] Use script setup syntax for cleaner component code [ ] Implement proper reactivity with ref() and reactive() [ ] Create reusable logic with custom composables [ ] Use TypeScript for type safety throughout [ ] Implement proper computed and watcher patterns [ ] Design clear prop and emit interfaces [ ] Use provide/inject for dependency injection [ ] Integrate Pinia for global state management [ ] Handle routing with Vue Router 4 composition API [ ] Optimize performance with shallow reactivity when appropriate [ ] Write comprehensive tests for composables and components [ ] Follow Vue 3 best practices and conventions Follow these patterns to build scalable, maintainable, and performant Vue 3 applications using the Composition API effectively.
Node.js Express API Expert
Node.js Express API Development Best Practices Comprehensive guide for building robust, scalable, and secure RESTful APIs with Node.js and Express.js. RESTful API Design Resource-Based URL Structure Use nouns for resources, not verbs Implement consistent naming conventions Follow REST principles for HTTP methods Example API structure: HTTP Status Code Standards Use appropriate status codes for different scenarios Implement consistent response formats Handle edge cases with proper status codes Example status code usage: Request Validation and Sanitization Validate all incoming data using schemas Sanitize inputs to prevent injection attacks Provide clear validation error messages Example with Joi validation: Error Handling and Logging Centralized Error Handling Create custom error classes for different error types Implement global error handling middleware Log errors appropriately for debugging Example error handling system: Structured Logging Use proper logging libraries (Winston, Pino) Implement different log levels Structure logs for easy parsing and monitoring Example logging setup: Testing and Quality Assurance API Testing Strategy Write unit tests for business logic Implement integration tests for endpoints Use proper test databases for isolation Example testing setup: Summary Checklist [ ] Implement modular route organization with Express Router [ ] Use proper middleware chain ordering [ ] Handle async operations with proper error catching [ ] Validate and sanitize all inputs [ ] Implement JWT authentication with refresh tokens [ ] Use bcrypt for password hashing [ ] Configure security headers with helmet [ ] Implement rate limiting and CORS [ ] Create centralized error handling [ ] Use structured logging for monitoring [ ] Implement database connection pooling [ ] Add caching for performance optimization [ ] Write comprehensive tests for all endpoints [ ] Configure proper environment variables [ ] Use PM2 for production process management Follow these practices to build secure, scalable, and maintainable Express.js APIs that perform well in production environments.
TypeScript Expert
TypeScript Expert Best Practices Comprehensive guide for mastering TypeScript's advanced type system, generics, and building type-safe applications at scale. Advanced Type Patterns Generic Types with Constraints Use generic constraints to limit type parameters Implement proper bounds checking for type safety Create reusable generic utilities Example generic patterns: Conditional Types and Mapped Types Use conditional types for type-level logic Create mapped types for transforming existing types Implement advanced type utilities Example conditional types: Template Literal Types Create dynamic string types with template literals Build type-safe APIs with string manipulation Generate types from string patterns Example template literal types: Type Guards and Validation Type Guards and Predicates Implement type guards for runtime type checking Use assertion functions for validation Create branded types for type safety Example type guard patterns: Discriminated Unions Use discriminated unions for type-safe state management Implement exhaustiveness checking with never type Create type-safe reducers and state machines Example discriminated union patterns: Error Handling and Validation Type-Safe Error Handling Use Result types instead of throwing exceptions Implement proper error type hierarchies Create composable error handling patterns Example error handling: Runtime Validation with Types Integrate runtime validation with TypeScript types Use libraries like Zod or io-ts for schema validation Ensure type safety at runtime boundaries Example validation patterns: Testing and Type Safety Type Testing Write tests for your types using type-level assertions Use tools like or for type testing Implement type-safe test helpers Example type testing: Mocking with Type Safety Create type-safe mocks for testing Use branded types for test data Implement proper mock type checking Example type-safe mocking: Follow these advanced TypeScript patterns to build robust, type-safe applications that scale effectively.
React Hooks Expert
React Hooks Expert Master React Hooks patterns, custom hooks, and state management with these comprehensive guidelines. Essential Hook Patterns State Management useState for Local Component State useReducer for Complex State Logic Side Effects useEffect with Proper Cleanup useContext for Consuming Context Values Custom Hooks Create Reusable Logic Extract complex logic into custom hooks Prefix custom hooks with 'use' Return consistent data structures Handle Loading, Error, and Data States Best Practices Checklist [ ] Hooks called at top level only [ ] Proper dependency arrays in useEffect/useMemo/useCallback [ ] Custom hooks for reusable logic [ ] Cleanup effects to prevent memory leaks [ ] Memoization for performance optimization [ ] Consistent return patterns from custom hooks
React Testing Library Best Practices
React Testing Library Best Practices Comprehensive guide for testing React applications with React Testing Library, focusing on user-centric testing patterns and best practices. Component Testing Patterns Form Testing Test form validation, submission, and error handling Use userEvent for realistic user interactions Test accessibility of form elements Example form testing: Testing Custom Hooks Use renderHook for testing custom hooks in isolation Test hook state changes and side effects Mock dependencies and external APIs Example hook testing: Advanced Testing Patterns Testing Error Boundaries Test error boundary behavior Verify error reporting and fallback UI Test error recovery mechanisms Example error boundary testing: Performance Testing Test component rendering performance Verify memoization and optimization Test for unnecessary re-renders Example performance testing: Summary Checklist [ ] Test user behavior, not implementation details [ ] Use semantic queries that mirror user interactions [ ] Write tests that promote accessible markup [ ] Handle async operations with waitFor and findBy queries [ ] Test form validation, submission, and error handling [ ] Use MSW for realistic API mocking [ ] Test custom hooks in isolation with renderHook [ ] Write integration tests for user workflows [ ] Test error boundaries and error recovery [ ] Verify performance optimizations work correctly [ ] Set up proper test environment and utilities [ ] Organize tests logically with clear descriptions [ ] Keep tests focused, independent, and maintainable [ ] Mock external dependencies appropriately [ ] Test loading states, error states, and edge cases Follow these practices to write comprehensive, maintainable tests that give confidence in your React applications and promote better accessibility and user experience.
SolidJS Reactive Framework
SolidJS Best Practices Comprehensive guide for building high-performance web applications with SolidJS, featuring fine-grained reactivity, signals, and optimized rendering. State Management with Stores Creating and Using Stores Implement global state with stores Use context for dependency injection Create reactive store patterns Example store implementation: Resource Pattern for Data Fetching Use createResource for async data fetching Implement proper loading and error states Handle data refetching and caching Example resource patterns: Performance Optimization Compilation and Bundle Optimization Leverage SolidJS's compile-time optimizations Use lazy loading for code splitting Implement proper bundling strategies Example optimization techniques: Memory Management and Cleanup Properly clean up effects and subscriptions Use onCleanup for resource disposal Handle component unmounting gracefully Example cleanup patterns: Summary Checklist [ ] Use signals for reactive state management [ ] Leverage createMemo for derived computations [ ] Implement proper component composition with splitProps [ ] Use SolidJS control flow components (Show, For, Switch) [ ] Create stores for global state management [ ] Use createResource for async data fetching [ ] Implement client-side routing with Solid Router [ ] Use lazy loading for code splitting and performance [ ] Properly clean up effects and subscriptions [ ] Write comprehensive tests for components and stores [ ] Optimize bundle size with tree shaking [ ] Handle error boundaries and loading states [ ] Use TypeScript for better development experience [ ] Implement proper accessibility patterns Follow these practices to build high-performance, reactive web applications with SolidJS's fine-grained reactivity system.
SvelteKit Full-Stack Framework
SvelteKit Best Practices Comprehensive guide for building full-stack web applications with SvelteKit, including routing, stores, SSR, and modern development patterns. State Management with Stores Svelte Stores for Global State Use writable stores for mutable state Implement derived stores for computed values Create custom stores for complex logic Example store implementations: Custom Stores for Complex State Create domain-specific stores Implement store composition patterns Handle async operations in stores Example custom store: Store Persistence and Synchronization Persist store state across sessions Sync stores with server state Handle offline scenarios Example persistence patterns: API Routes and Server-Side Logic API Route Implementation Create RESTful API endpoints Handle different HTTP methods Implement proper error handling and validation Example API routes: Authentication and Authorization Hooks Implement server-side authentication Create authorization middleware Handle session management Example authentication setup: Summary Checklist [ ] Use file-based routing for automatic route generation [ ] Implement load functions for server-side data fetching [ ] Create reactive stores for global state management [ ] Use derived stores for computed values [ ] Build reusable components with proper event handling [ ] Implement form validation with reactive statements [ ] Create RESTful API routes with proper error handling [ ] Set up authentication and authorization hooks [ ] Use proper TypeScript types throughout the application [ ] Implement lazy loading and code splitting [ ] Write comprehensive tests for components and stores [ ] Handle loading states and errors gracefully [ ] Use SSR and prerendering for performance [ ] Implement proper SEO and meta tag management Follow these practices to build fast, scalable, and maintainable full-stack web applications with SvelteKit.
Vue 3 Composition API Best Practices
Vue 3 Composition API Best Practices Setup Function and Script Setup Basic Composition API Setup Script Setup Syntax (Recommended) Reactive State Management Ref vs Reactive Reactive Arrays and Objects Composables for Logic Reuse Creating Custom Composables Fetch Data Composable Local Storage Composable Using Composables in Components Advanced Reactive Patterns Watch and WatchEffect Provide/Inject for State Management TypeScript Integration Typed Composables Typed Component Props Performance Optimization Reactive Performance Tips Optimized List Rendering Testing Composition API Unit Testing Composables Testing Components with Composition API Checklist for Vue 3 Composition API [ ] Use script setup syntax for cleaner code [ ] Choose ref vs reactive appropriately [ ] Create reusable composables for common logic [ ] Implement proper TypeScript types [ ] Use provide/inject for cross-component state [ ] Optimize performance with shallow reactivity when needed [ ] Write comprehensive tests for composables [ ] Follow naming conventions (use* prefix for composables) [ ] Handle cleanup in composables (onUnmounted) [ ] Document complex composables with JSDoc [ ] Use computed properties for derived state [ ] Implement proper error handling in async composables
Browse Cursor Rules - Cursor IDE Community Prompts & Configurations