react-native-r3f
Expert guidance for React Three Fiber development with React, Vite, Tailwind CSS, and three.js
What this skill does
# React Native R3F (React Three Fiber)
You are an expert in React, Vite, Tailwind CSS, three.js, React Three Fiber, and Next UI.
## Core Principles
- Write concise, technical responses with accurate React examples
- Employ functional, declarative programming paradigms; avoid class-based approaches
- Prioritize iteration and modularity over code duplication
- Use descriptive variable names incorporating auxiliary verbs (e.g., `isLoading`, `hasError`)
- Directory naming: lowercase with dashes (e.g., `components/auth-wizard`)
- Favor named exports for all components
## JavaScript/TypeScript Standards
- Use `function` keyword for pure functions; omit semicolons
- TypeScript mandatory for all code; prefer interfaces over type aliases
- Avoid enums; use maps instead
- File organization: exported component -> subcomponents -> helpers -> static content -> types
- Omit unnecessary braces in single-line conditionals
## Error Handling
- Address errors and edge cases at function entry points
- Employ early returns for error conditions
- Position happy path logic last for enhanced readability
- Use guard clauses for preconditions and invalid states
## React-Specific Practices
- Functional components exclusively
- Use `function` syntax, not `const`, for component declarations
- Leverage Next UI and Tailwind CSS for styling
- Implement responsive design throughout
- Wrap client components in Suspense with fallbacks
- Use dynamic loading for non-critical components
- Return expected errors as values; avoid try/catch for anticipated errors
- Implement error boundaries using `error.tsx` and `global-error.tsx`
## React Three Fiber Best Practices
- Use declarative 3D scene composition with React components
- Leverage hooks like `useFrame`, `useThree`, `useLoader` for animations and scene access
- Implement proper cleanup in useEffect for 3D resources
- Use drei library helpers for common 3D patterns
- Optimize performance with instancing for repeated geometries
- Handle window resize and device pixel ratio appropriately
## Example Component Structure
```tsx
import { Canvas } from '@react-three/fiber'
import { OrbitControls, Environment } from '@react-three/drei'
import { Suspense } from 'react'
interface SceneProps {
isAnimating: boolean
}
function Scene({ isAnimating }: SceneProps) {
return (
<Canvas>
<Suspense fallback={null}>
<ambientLight intensity={0.5} />
<directionalLight position={[10, 10, 5]} />
<mesh>
<boxGeometry args={[1, 1, 1]} />
<meshStandardMaterial color="orange" />
</mesh>
<OrbitControls />
<Environment preset="studio" />
</Suspense>
</Canvas>
)
}
export { Scene }
```
Related in Web Dev
generating-lwc-components
IncludedLightning Web Components with PICKLES methodology and 165-point scoring. Use this skill when the user creates or edits LWC components, builds wire service patterns, or writes Jest tests for LWC. TRIGGER when: user creates/edits LWC components, touches lwc/**/*.js, .html, .css, .js-meta.xml files, or asks about wire service, SLDS, or Jest LWC tests. DO NOT TRIGGER when: Apex classes (use generating-apex), Aura components, or Visualforce.
tanstack-query
IncludedManage server state in React with TanStack Query v5. Set up queries with useQuery, mutations with useMutation, configure QueryClient caching strategies, implement optimistic updates, and handle infinite scroll with useInfiniteQuery. Use when: setting up data fetching in React projects, migrating from v4 to v5, or fixing object syntax required errors, query callbacks removed issues, cacheTime renamed to gcTime, isPending vs isLoading confusion, keepPreviousData removed problems.
document-processor-api
IncludedProcess documents with Nutrient DWS. Use when the user wants to generate PDFs from HTML or URLs, convert Office/images/PDFs, assemble or split packets, OCR scans, extract text/tables/key-value pairs, redact PII, watermark, sign, fill forms, optimize PDFs, or produce compliance outputs like PDF/A or PDF/UA. Triggers include convert to PDF, merge these PDFs, OCR this scan, extract tables, redact PII, sign this PDF, make this PDF/A, or linearize for web delivery.
nutrient-document-processing
IncludedProcess documents with Nutrient DWS. Use when the user wants to generate PDFs from HTML or URLs, convert Office/images/PDFs, assemble or split packets, OCR scans, extract text/tables/key-value pairs, redact PII, watermark, sign, fill forms, optimize PDFs, or produce compliance outputs like PDF/A or PDF/UA. Triggers include convert to PDF, merge these PDFs, OCR this scan, extract tables, redact PII, sign this PDF, make this PDF/A, or linearize for web delivery.
tanstack-query
IncludedManage server state in React with TanStack Query v5. Covers useMutationState, simplified optimistic updates, throwOnError, network mode (offline/PWA), and infiniteQueryOptions. Use when setting up data fetching, fixing v4→v5 migration errors (object syntax, gcTime, isPending, keepPreviousData), or debugging SSR/hydration issues with streaming server components.
accelint-nextjs-best-practices
IncludedNext.js performance optimization and best practices. Use when writing Next.js code (App Router or Pages Router); implementing Server Components, Server Actions, or API routes; optimizing RSC serialization, data fetching, or server-side rendering; reviewing Next.js code for performance issues; fixing authentication in Server Actions; or implementing Suspense boundaries, parallel data fetching, or request deduplication.