Skip to content

Results for “function”

8 prompts

This code is too clever and hard to read. Rewrite it for clarity: descriptive names, small functions, comments only where needed, and the same behaviour. Explain what the original was doing. Code: [paste code]

ChatGPT
Coding & Development

Code golf to clean code

Expands clever, cryptic code into readable code.

0

This function is too slow for large inputs ([input size]). Analyse its time and space complexity, propose a more efficient approach, implement it, and show a quick benchmark plan. Code: [paste code]

ChatGPT
Coding & Development

Algorithm optimisation

Speeds up an algorithm by improving its complexity.

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

Help me revise the [diagram, e.g. human heart]. Describe the diagram in words with numbered parts, then quiz me: give a number and ask me to name the part and its function. Correct me as we go and finish with a summary table of all parts and functions.

ChatGPT
Education & Learning

Biology diagram labeling practice

Quiz yourself on diagrams like the cell, heart or flower.

0

Suggest better names in this code. Language and naming conventions: [details] ``` [paste] ``` For each unclear name, give 2–3 alternatives and explain why they're clearer. Then show the code with the best names applied. Don't change behaviour.

ChatGPT
Coding & Development

Better names for variables and functions

Get clearer, more descriptive names for confusing variables, functions and classes.

0

Turn this code into documentation. Code: ``` [paste] ``` Provide: a plain-English step-by-step description, a Mermaid flowchart (or sequence diagram if it involves multiple services), the inputs and outputs, and any edge cases visible in the logic.

ChatGPT
Coding & Development

Turn code into a flowchart

Visualise how a function or process works with a Mermaid flowchart and plain-English steps.

0

Act as a senior product manager. Feature: [name] Problem and evidence: [details] Target users: [who] Goals: [outcomes] Write a PRD: background, problem statement, goals and non-goals, user stories with acceptance criteria, functional requirements, UX notes, edge cases, analytics/success metrics, launch plan, and open…

ChatGPT
Business & Productivity

Product requirements document (PRD)

Write a clear PRD with problem, goals, user stories, requirements and success metrics.

0

Act as a senior [language] developer. Write a function that: [describe behaviour] Inputs: [names, types, examples] Output: [type and example] Constraints: [performance, no external libraries, etc.] Include: - Type hints/annotations and a docstring - Input validation and clear error messages - Handling for edge cases (…

ChatGPT
Coding & Development

Write a function from a plain-English description

Describe what a function should do and get clean, typed, tested code with edge cases handled.

0