Skip to content

Results for “javascript”

9 prompts

Set up a monorepo for [apps and packages, e.g. web app, API and shared UI library] using [tool, e.g. pnpm workspaces / Turborepo / Nx]. Show the folder structure, config files, shared TypeScript config, build and test scripts, and CI caching.

ChatGPT
Coding & Development

Monorepo setup

Organises multiple apps and packages in one repository.

0

Write a React custom hook called [useSomething] that [purpose, e.g. fetches data with caching / debounces input / tracks window size]. Use TypeScript, handle cleanup and errors, and include usage examples and tests.

ChatGPT
Coding & Development

React custom hook

A reusable custom hook with clean state management.

0

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.

ChatGPT
Coding & Development

Form validation on the frontend

Accessible form validation with helpful error messages.

0

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.

ChatGPT
Coding & Development

Node.js script with async/await

A clean Node.js script with proper async error handling.

0

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]

ChatGPT
Coding & Development

Convert callbacks to async/await

Modernises callback-based code to promises and async/await.

0

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]

ChatGPT
Coding & Development

Unit tests in Jest

Thorough Jest tests with mocks and edge cases.

0

Act as a JavaScript expert. What should happen: [expected behaviour] What actually happens: [bug] Code: ```js [paste] ``` Explain the async flow step by step, identify the bug (race condition, missing await, unhandled rejection, etc.), provide fixed code, and suggest patterns to prevent it (Promise.all, AbortControlle…

ChatGPT
Coding & Development

Debug async JavaScript

Fix race conditions, unhandled promises and ordering bugs in async JavaScript.

0

Act as a Python developer. Website: [URL or type of site] Data to extract: [fields] Pages: [single page / pagination / list of URLs] Output: [CSV / JSON] Write a script using requests + BeautifulSoup (or Playwright if the page needs JavaScript) that: - Respects robots.txt and adds a delay between requests - Sets a cle…

ChatGPT
Coding & Development

Python web scraper

Build a polite, robust web scraper that extracts structured data and saves it to CSV or JSON.

0

Act as a regular expression expert. Regex flavour: [JavaScript / Python / PHP (PCRE) / Java / .NET] What I need to match: [describe, e.g. UK postcodes, dates in DD/MM/YYYY, URLs without query strings] Should match: [examples] Should NOT match: [examples] Please give: 1. The regex 2. A token-by-token explanation in pla…

ChatGPT
Coding & Development

Regex generator with plain-English explanation

Describe the pattern you need and get a tested regular expression, a token-by-token explanation, and examples that match and don't.

0