use simple and easy-to-understand language
Before responding to any request, follow these steps:
# Fundamental Principles
- write clean, simple, readable code
- reliability is the top priority - if you can't make it reliable, don't build it
- implement features in the simplest possible way
- kepp files small and focused (<200 lines)
# Error fixing
- consider multiple possibles causes before deciding. Do not jump to conclusions.
- Explain the problem in plain english.
1. Request Analysis
- Determine task type (code creation, debugging, architecture, etc.)
- Identify languages and frameworks involved
- Note explicit and implicit requirements
- Define core problem and desired outcome
- Consider project context and constraints
2. Solution Planning
- Break down the solution into logical steps
- Consider modularity and reusability
- Identify necessary files and dependencies
- Evaluate alternative approaches
- Plan for testing and validation
3. Implementation Strategy
- Choose appropriate design patterns
- Consider performance implications
- Plan for error handling and edge cases
- Ensure accessibility compliance
- Verify best practices alignment
## Code Style and Structure
### General Principles
- Write concise, readable TypeScript code
- Use functional and declarative programming patterns
- Follow DRY (Don't Repeat Yourself) principle
- Implement early returns for better readability
- Structure components logically: exports, subcomponents, helpers, types
### Naming Conventions
- Use descriptive names with auxiliary verbs (isLoading, hasError)
- Prefix event handlers with "handle" (handleClick, handleSubmit)
- Use lowercase with dashes for directories (components/auth-wizard)
- Favor named exports for components
### TypeScript Usage
- Use TypeScript for all code
- Prefer interfaces over types, use types for components
- Avoid enums; use const maps instead
- Implement proper type safety and inference
- Use `satisfies` operator for type validation
- if a type is necessary in multiple files it should go in types folder in a d.ts file
- avoid creating types and interfaces in utils, services, constant files
### Component Architecture
- Favor React Server Components (RSC) where possible
- Minimize 'use client' directives
- Implement proper error boundaries
- Use Suspense for async operations
- Optimize for performance and Web Vitals
### State Management
- Use `useActionState` instead of deprecated `useFormState`
- Leverage enhanced `useFormStatus` with new properties (data, method, action)
- Implement URL state management with 'nuqs'
- Minimize client-side state
### Async Request APIs
```typescript
// Always use async versions of runtime APIs
const cookieStore = await cookies()
const headersList = await headers()
const { isEnabled } = await draftMode()
// Handle async params in layouts/pages
const params = await props.params
const searchParams = await props.searchParams
```
### Data Fetching
- Fetch requests are no longer cached by default
- Use `cache: 'force-cache'` for specific cached requests
- Implement `fetchCache = 'default-cache'` for layout/page-level caching
- Use appropriate fetching methods (Server Components, SWR, React Query)
### Route Handlers
```typescript
// Cached route handler example
export const dynamic = 'force-static'
export async function GET(request: Request) {
const params = await request.params
// Implementation
}
```
## UI Development
### Styling
- Use SASS styles with a mobile-first approach
- Implement Shadcn UI and Radix UI components
- Follow consistent spacing and layout patterns
- Ensure responsive design across breakpoints
- Use CSS variables for theme customiz
### Accessibility
- Implement proper ARIA attributes
- Ensure keyboard navigation
- Provide appropriate alt text
- Follow WCAG 2.1 guidelines
- Test with screen readers
### Performance
- Optimize images (WebP, sizing, lazy loading)
- Implement code splitting
- Use `next/font` for font optimization
- Configure `staleTimes` for client-side router cache
- Monitor Core Web Vitals
## Testing and Validation
### Code Quality
- Implement comprehensive error handling
- Write maintainable, self-documenting code
- Follow security best practices
- Ensure proper type coverage
- Use ESLint and Prettier
### Testing Strategy
- Plan for unit and integration tests
- Implement proper test coverage
- Consider edge cases and error scenarios
- Validate accessibility compliance
- Use React Testing Library
Remember: Prioritize clarity and maintainability while delivering robust, accessible, and performant solutions aligned with the latest React 19, Next.js 15, and Vercel AI SDK features and best practices.
in react all functions should be in arrow functions including the component function,
should have FC declaration and return type ReactElement
dockerfile
eslint
golang
javascript
lua
next.js
prettier
radix-ui
+6 more
First Time Repository
Projects config files
Shell
Languages:
Dockerfile: 0.4KB
JavaScript: 5.8KB
Lua: 1.2KB
Shell: 14.3KB
TypeScript: 0.9KB
Created: 4/29/2021
Updated: 1/8/2025
All Repositories (1)
Projects config files