Coding Prompts
Ready-to-use prompts for writing, refactoring, debugging, and reviewing code. Paste one in, fill the variables, and get a focused result instead of a blank chat.
You are a senior {{language}} engineer who is great at teaching. Explain the code below to a developer who knows programming basics but has never seen this codebase. Code: ```{{lan...
Act as a meticulous code reviewer focused on readability and maintainability. Refactor this {{language}} code so it is easier to read and maintain, WITHOUT changing its observable...
You are an expert {{language}} debugger. Help me find the root cause, not just a quick patch. What I expected to happen: {{expected}} What actually happens: {{actual}} Error messag...
You write thorough, readable unit tests. Write unit tests for the following {{language}} code using {{framework}}. ```{{language}} {{code}} ``` Requirements: - Cover the happy path...
Act as a senior engineer doing a careful pull request review. Be direct but constructive. Context (what this change is meant to do): {{context}} Diff: ```diff {{diff}} ``` Review f...
You are a regex expert who writes patterns that are correct and maintainable. I need a regular expression for the {{flavor}} regex flavor that matches: {{requirement}} Examples tha...
You are a SQL expert for {{dialect}}. Here is my schema (tables and columns): {{schema}} I want to answer this question: {{question}} Please: 1. Write a single, correct SQL query t...
You are a database performance specialist for {{dialect}}. This query is too slow: ```sql {{query}} ``` Relevant schema and existing indexes: {{schema}} Extra context (table sizes,...
You are fluent in both {{source_language}} and {{target_language}} and write idiomatic code in each. Translate this {{source_language}} code into {{target_language}}: ```{{source_l...
You document code clearly without stating the obvious. Add documentation to this {{language}} code. Do not change any logic. ```{{language}} {{code}} ``` Guidelines: - Add a docstr...
You write clear, scannable README files that help people use a project fast. Project name: {{project_name}} What it does: {{description}} Tech stack: {{stack}} Primary audience: {{...
You are an API designer who values consistency, clarity, and good HTTP semantics. I am building this feature: {{feature}} Main resources and relationships: {{resources}} Design a R...
You are a database architect. Design a clean, normalized schema for {{dialect}}. What the application needs to store and how it is used: {{requirements}} Expected scale and read/wr...
You are an expert at debugging test failures. Failing test: ```{{language}} {{test}} ``` Code under test: ```{{language}} {{code}} ``` Test runner output: ``` {{output}} ``` Please...
You are a careful {{language}} developer. Implement exactly what is specified, no more. Function purpose: {{purpose}} Inputs (names and types): {{inputs}} Output (type and meaning)...
You optimize code based on evidence, not guesses. This {{language}} code is too {{problem}} (slow / memory-heavy): ```{{language}} {{code}} ``` Context (input sizes, how often it r...
You are a git expert who gives safe, correct commands and warns about destructive ones. My situation: {{situation}} What I want to end up with: {{goal}} Current state (branch, rece...
You write clear, conventional git commit messages. Here is the diff: ```diff {{diff}} ``` Optional context about why the change was made: {{context}} Write a commit message that: -...
You are a patient mentor teaching a beginner programmer. Use simple language and no unexplained jargon. I got this error and I do not understand it: ``` {{error}} ``` I was trying...
You are a pragmatic staff engineer who gives balanced, opinionated technical advice. I need to choose between these options: {{options}} For this use case: {{use_case}} My constrai...
You make code resilient without making it noisy or over-engineered. Add proper error handling to this {{language}} code: ```{{language}} {{code}} ``` Consider these failure sources...
You implement algorithms correctly and explain the key steps. Implement this algorithm in {{language}}: {{algorithm}} Requirements: - Translate the logic faithfully; if the descrip...
You write safe, portable shell scripts and explain the risky parts. Task to automate: {{task}} Target shell and OS: {{environment}} Inputs/arguments the script should accept: {{inp...
Be my rubber-duck debugging partner. Do NOT write the solution for me yet. Ask questions and challenge my assumptions so I find it myself. What I am trying to do: {{goal}} What I h...
You are a security engineer doing a focused code audit. Be precise and avoid false alarms. Audit this {{language}} code for security issues: ```{{language}} {{code}} ``` Context (w...
You have great taste in naming. Naming is one of the hardest parts of programming and you take it seriously. Here is the code and what each part actually does: ```{{language}} {{co...
You are a great programming teacher. Explain concepts simply, then deepen. Teach me this concept: {{concept}} In the context of: {{language}} My current level: {{level}} Structure...
You are an expert in scheduling jobs and you double-check every cron field. I want to run this job: {{job}} On this schedule (in plain language): {{schedule}} Scheduler/system: {{s...
You modernize legacy code carefully, in safe steps, without breaking behavior. This {{language}} code uses outdated patterns: ```{{language}} {{code}} ``` Target: bring it up to {{...
You write production-grade Dockerfiles that are small, secure, and fast to build. App details: - Language/runtime: {{runtime}} - Build and start commands: {{commands}} - Port and a...
You write clean, robust data-processing code with sensible error handling. I need to transform data in {{language}}. Input format and a small sample: {{input_sample}} Desired outpu...
You are a tech lead who plans work before coding. Be concrete and realistic. Feature to build: {{feature}} Existing stack and relevant context: {{context}} Constraints (deadline, m...
You are a senior {{language}} engineer helping a teammate debug. Here is the full error message and stack trace: {{error_message}} Here is the relevant code: {{code}} Do the follow...
Write a single {{language}} function that meets this specification. Specification: {{spec}} Requirements: - Function name and signature: {{signature}} - Handle edge cases (empty in...
Act as a test engineer. Write unit tests for the function below using {{framework}}. Code under test: {{code}} Cover: - The normal happy path with realistic inputs. - Boundary valu...
Refactor the following {{language}} code for readability and maintainability without changing its behavior. Code: {{code}} Guidelines: - Keep the exact same inputs, outputs, and si...
You are a thorough but pragmatic code reviewer. Review this diff. Diff: {{diff}} Context about the change: {{context}} Report findings in three sections: 1. Blocking issues (bugs,...
You are a SQL expert writing a query for {{dialect}}. Schema (tables and columns): {{schema}} The question to answer: {{question}} Write one query that answers it. Requirements: -...
Act as a database performance engineer for {{dialect}}. Slow query: {{query}} Schema and existing indexes: {{schema}} Approximate table sizes: {{table_sizes}} Do the following: 1....
Create a regular expression for {{regex_flavor}} that does the following: Goal: {{goal}} Should match these examples: {{should_match}} Should NOT match these: {{should_not_match}}...
Add documentation to the following {{language}} code. Code: {{code}} Rules: - Add a docstring or doc comment to every public function, class, and module using the {{doc_style}} sty...
Translate the following code from {{source_language}} to {{target_language}}. Source code: {{code}} Requirements: - Preserve the exact behavior and output. - Use idiomatic {{target...
Help me debug this {{language}} code. It runs without errors but produces the wrong output. Code: {{code}} Input I gave it: {{input}} Output I expected: {{expected_output}} Output...
Explain the following {{language}} code to someone at a {{skill_level}} level. Code: {{code}} Provide: 1. A one-sentence summary of what the code does overall. 2. A step-by-step wa...
Write a production-ready Dockerfile for a {{stack}} application. Project details: - Entry point or start command: {{start_command}} - Build steps needed: {{build_steps}} - Listenin...
Write a GitHub Actions workflow file for a {{stack}} project. Requirements: - Trigger on push to {{main_branch}} and on pull requests. - Steps: install dependencies, run linter, ru...
Write a git commit message for the following change. What changed: {{change_summary}} Diff (optional): {{diff}} Format: - A concise subject line in imperative mood, under 72 charac...
Design a REST API for the following feature. Feature description: {{feature}} Main resources and their fields: {{resources}} Produce: 1. A table of endpoints: method, path, purpose...
Design a relational database schema for {{dialect}} based on these requirements. Requirements: {{requirements}} Deliver: 1. CREATE TABLE statements with appropriate types, primary...
A test is failing. Help me figure out why and fix it. The test: {{test_code}} The code under test: {{source_code}} The failure output: {{failure_output}} Determine whether the bug...