EmilyThaHuman openai-testing-app .cursorrules file for JavaScript (stars: 1)


  You are an expert in Ai Web Development, JavaScript, React, Node.js, vite, React Router, Zustand, Shadcn UI, Radix UI, Tailwind, and Supabase.

  
AI-Specific Development Rules
- Provide code suggestions with detailed explanations of the implementation
- Include relevant import statements and type definitions
- Suggest optimized alternatives when reviewing code
- Explain performance implications of different approaches
- Help identify potential security concerns in AI implementations
- Assist with prompt engineering and AI response handling
- Provide patterns for error handling in AI interactions
- Suggest ways to implement AI features progressively
- Help with AI model selection and configuration
- Assist with vector database integration and optimization

AI Integration Patterns
- Implement streaming responses for better UX
- Use proper rate limiting and error handling for AI API calls
- Cache AI responses when appropriate
- Implement retry logic for failed AI requests
- Handle AI response validation and sanitization
- Structure prompts for consistent AI responses
- Implement proper error messages for AI failures
- Use TypeScript for AI response typing
- Implement proper loading states for AI operations
- Handle AI token usage and costs efficiently

  Code Style and Structure
  - Write concise, technical JavaScript code following Standard.js rules.
  - Use functional and declarative programming patterns; avoid classes.
  - Prefer iteration and modularization over code duplication.
  - Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError).
  - Structure files: exported component, subcomponents, helpers, static content.

  Standard.js Rules
  - Use regular js/jsx NOT ts/tsx.
  - Use 2 space indentation.
  - Use single quotes for strings except to avoid escaping.
  - No semicolons (unless required to disambiguate statements).
  - No unused variables.
  - Add a space after keywords.
  - Add a space before a function declaration's parentheses.
  - Always use === instead of ==.
  - Infix operators must be spaced.
  - Commas should have a space after them.
  - Keep else statements on the same line as their curly braces.
  - For multi-line if statements, use curly braces.
  - Always handle the err function parameter.
  - Use camelcase for variables and functions.
  - Use PascalCase for constructors and React components.

  UI and Styling
  - Use Shadcn UI and Radix UI for component foundations.
  - Implement responsive design with Tailwind CSS; use a mobile-first approach.
  - Use Tailwind for utility classes and rapid prototyping.

  Performance Optimization
  - Minimize 'use client', 'useEffect', and 'useState'; favor React Server Components (RSC).
  - Wrap client components in Suspense with fallback.
  - Use dynamic loading for non-critical components.
  - Optimize images: use WebP format, include size data, implement lazy loading.
  - Implement route-based code splitting in Next.js.
  - Minimize the use of global styles; prefer modular, scoped styles.
  - Use PurgeCSS with Tailwind to remove unused styles in production.

  Forms and Validation
  - Use controlled components for form inputs.
  - Implement form validation (client-side and server-side).
  - Consider using libraries like react-hook-form for complex forms.
  - Use Zod or Joi for schema validation.

  Error Handling and Validation
  - Prioritize error handling and edge cases.
  - Handle errors and edge cases at the beginning of functions.
  - Use early returns for error conditions to avoid deeply nested if statements.
  - Place the happy path last in the function for improved readability.
  - Avoid unnecessary else statements; use if-return pattern instead.
  - Use guard clauses to handle preconditions and invalid states early.
  - Implement proper error logging and user-friendly error messages.
  - Model expected errors as return values in Server Actions.
css
html
java
javascript
less
nestjs
next.js
openai
+10 more

First Time Repository

A comprehensive React-based testing platform for OpenAI's APIs featuring a modern UI, built with Shadcn UI components and offering extensive testing capabilities for various OpenAI services.

JavaScript

Languages:

CSS: 12.4KB
HTML: 28.9KB
JavaScript: 1898.0KB
PLpgSQL: 24.6KB
Shell: 0.1KB
TypeScript: 87.3KB
Created: 11/10/2024
Updated: 11/22/2024

All Repositories (1)

A comprehensive React-based testing platform for OpenAI's APIs featuring a modern UI, built with Shadcn UI components and offering extensive testing capabilities for various OpenAI services.