Skip to content

Results for “clean code”

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.

Implement simple feature flags in [stack] without a paid service. Support on/off, percentage rollout and per-user overrides, store flags in [storage], and show how to use a flag in code and remove it cleanly later.

ChatGPT
Coding & Development

Feature flag implementation

Ships features safely with gradual rollouts.

Explain [data structure, e.g. a hash map / heap / trie] for a [level] developer. Include a text diagram, how operations work with time complexity, a clean implementation in [language], and when to use it in real projects.

ChatGPT
Coding & Development

Data structure explanation with code

Explains a data structure with visuals and an implementation.

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.

Act as a senior software architect. Project type: [web app, API, mobile app, library] Stack: [details] Team size and expected growth: [details] Features: [list] Propose a folder structure (with explanation of each folder), layering (e.g. routes, services, data access), naming conventions, where tests live, configurati…

ChatGPT
Coding & Development

Project folder structure and architecture

Organise a new or growing project with a clean, scalable folder structure and conventions.

Act as an algorithms tutor. Problem: [paste problem statement] Language: [language] Explain: 1. The problem in simple words with a small example 2. A brute-force approach and its complexity 3. The key insight that leads to the optimal approach 4. Step-by-step walkthrough on the example 5. Clean, commented code 6. Time…

ChatGPT
Coding & Development

Coding challenge explained step by step

Understand algorithm problems: intuition, brute force, optimal approach, complexity and clean code.

Act as a data analyst using Python and pandas. Data: [file type and columns with example values] Questions I want answered: [list] Issues I know about: [missing values, inconsistent formats] Write a script or notebook steps to: 1. Load and inspect the data 2. Clean it (types, missing values, duplicates, outliers) 3. A…

ChatGPT
Coding & Development

Data analysis with pandas

Load, clean, analyse and chart your data with pandas, with explanations for each step.

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.