Implement [infinite scroll / cursor pagination] for a list of [items] in [framework] calling [API]. Handle loading and error states, avoid duplicate requests, preserve scroll position, and include the backend query for cursor pagination.
Free ChatGPT prompts
931 prompts
Build validation for a [form type] form in [framework or vanilla JS]. Validate [fields] on blur and submit, show inline accessible error messages, disable submit while sending, and handle server-side errors gracefully.
Form validation on the frontend
Accessible form validation with helpful error messages.
Implement user authentication in [framework]: sign-up, login, logout, password reset by email, and session or token handling. Hash passwords properly, rate-limit login attempts, protect against CSRF, and explain each security choice.
Show how to add Stripe Checkout to a [framework] app for [product type: one-time / subscription]. Include server code to create a session, redirect handling, a webhook endpoint that verifies signatures and fulfils orders, and test-mode steps. Use environment variables for keys.
Write Jest unit tests for this function/module. Cover normal cases, edge cases, error handling, and mock [dependencies]. Use descriptive test names and arrange-act-assert structure. Code: [paste code]
My web page has these performance metrics and details: [Lighthouse results / stack / page description]. Identify the biggest causes of slow loading and poor Core Web Vitals, and give prioritised fixes with code examples (images, fonts, JS bundles, caching, rendering).
Web app performance audit
Finds and fixes slow page loads and poor Core Web Vitals.
Write a Python class for [purpose, e.g. a shopping cart]. Include type hints, docstrings, validation, a clean public API, and pytest unit tests covering normal use and edge cases.
Write a Python class with tests
A well-designed Python class with type hints and unit tests.
Refactor this callback-based code to use async/await. Keep the behaviour identical, add proper try/catch error handling, and explain any changes in execution order. Code: [paste code]
Convert callbacks to async/await
Modernises callback-based code to promises and async/await.
Design a GraphQL schema for [domain, e.g. a blog with posts, authors and comments]. Include types, queries with pagination, mutations, input types, and example resolvers in [language/framework]. Note how to avoid N+1 queries.
Write a GraphQL schema and resolvers
A GraphQL schema with queries, mutations and resolvers.
Build a [component, e.g. pricing table / navbar / testimonial slider] with Tailwind CSS. Make it responsive, accessible (keyboard and screen reader friendly), support dark mode, and use a [color] accent. Return the HTML and explain the key classes.
Tailwind CSS component
A polished, responsive UI component built with Tailwind classes.
Write a Node.js script that [task, e.g. reads a CSV and calls an API for each row]. Use async/await, limit concurrency to [n], retry failed requests with backoff, log progress, and handle errors without crashing. Include package.json dependencies.
Node.js script with async/await
A clean Node.js script with proper async error handling.
Write a FastAPI endpoint for [operation, e.g. creating an order]. Use Pydantic models for request and response, validate [fields], return proper status codes, handle errors, and include an example request with curl and a pytest test.
Python FastAPI endpoint
A typed FastAPI endpoint with validation and error handling.