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]
Results for “clean code”
7 prompts
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.
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…
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…
Coding challenge explained step by step
Understand algorithm problems: intuition, brute force, optimal approach, complexity and clean code.
Add documentation to the code below. Language: [language] Docstring style: [Google / NumPy / JSDoc / PHPDoc] Rules: - Add a docstring to every public function/class: purpose, parameters, return value, exceptions, example - Add inline comments only where logic isn't obvious, explaining WHY - Don't change any behaviour…
Add clear comments and docstrings
Document existing code with helpful docstrings and comments that explain the why, not just the what.
Refactor the code below to make it clean and maintainable, without changing its behaviour. Language: [language] Style guide or conventions: [e.g. PEP 8, Airbnb] Goals: - Clear, descriptive names - Small functions with a single responsibility - Remove duplication and dead code - Simplify nested conditions (early return…
Refactor messy code for readability
Clean up hard-to-read code with better names, smaller functions and less duplication, without changing what it does.
You are a senior software engineer doing a careful code review. Language/framework: [e.g. TypeScript/React, Python/Django] What this code does: [short description] Context: [production app, prototype, library] Review the code and report findings grouped by severity: Critical (bugs, security), Major (performance, desig…
Code review like a senior engineer
Get a thorough review covering bugs, security, performance, readability and tests, with severity levels and suggested fixes.