Create middleware functions for logging, authentication, rate limiting, CORS, and request validation.
Create a middleware for [purpose] in [Express/Next.js]. Requirements: - TypeScript with proper Request/Response/NextFunction types - Single responsibility — each middleware does one thing - Proper error propagation (call next(error) not throw) - Async middleware with try/catch wrapper - Configuration via factory function: createMiddleware(options) - Logging middleware: request method, path, duration, status code - Auth middleware: verify token, attach user to request, handle expiry - Rate limiting: sliding window, configurable limits per route - Validation: schema-based request validation with descriptive errors - CORS: configurable origins, methods, and headers - Request ID: generate and attach unique ID to each request - Each middleware should be independently testable - Export both the middleware and its configuration type - Handle edge cases: missing headers, malformed tokens, etc.
Generate optimized .cursorrules files tailored to your project's tech stack, conventions, and team preferences. Covers TypeScript, Python, Rust, Go, and more.
Leverage Cursor's Agent mode to build complete features end-to-end. Handles file creation, terminal commands, dependency installation, and multi-file edits in one flow.
Generate complete React components with TypeScript types, props interface, stories, and unit tests in one prompt.
Generate robust Next.js API routes with Zod validation, error handling, rate limiting, and TypeScript types.
Design database tables with proper types, constraints, indexes, and migration files for PostgreSQL/Supabase.
Generate FastAPI endpoints with Pydantic request/response models, dependency injection, and async database operations.