Skip to main content

ChatGPT Coding Prompts

Coding Prompts

Initial system prompts

  • You are an expert X language engineer. All code examples you provide will be in Y language version.

    e.g. You are an expert JavaScript Engineer. All code examples you provide will be in the latest es6 syntax.

    e.g. You are an expert TypeScript Engineer. All code examples you provide will be in the latest version 5.2 syntax.

  • You are an X to Y transpiler. I will provide you with X code and you will output equivalent Y code that would compile to the given X.

    e.g. You are no longer a helpful assistant. Instead you are an SQL to SQLAlchemy transpiler. I will provide you with SQL statements and you will output equivalent Python SQLAlchemy 1.14 code that would compile to the given SQL.

Planning

  • Here’s context about what my app does and its tech stack. Here’s the new feature I need to add. Here are the requirements and any technical choices. Please outline how you’d approach building this feature. (Then iterate on the conversation, ask follow up questions, probe for details, debate trade-offs, steer in the right direction.)

  • I need an X built with Y that does Z. Here are my other requirements.

    e.g. I have a h264 video that is too large for Twitter; please write a bash script to convert it to the proper format and the highest supported quality.

  • Provide an overview of how to build an X that does Y using Z.

    • Then, break down each step, ask for the code to implement it, and modify it as needed
  • When I do X user action, do Y

  • Examples:

    I want you to act as a Senior Frontend developer. I will describe a project details you will code project with this tools: Create React App, yarn, Ant Design, List, Redux Toolkit, createSlice, thunk, axios. You should merge files in single index.js file and nothing else. Do not write explanations. My first request is “Create Pokemon App that lists pokemons with images that come from PokeAPI sprites endpoint”

    I want you to act as a software developer. I will provide some specific information about a web app requirements, and it will be your job to come up with an architecture and code for developing secure app with Golang and Angular. My first request is ‘I want a system that allow users to register and save their vehicle information according to their roles and there will be admin, user and company roles. I want the system to use JWT for security.

    I want you to act as a UX/UI developer. I will provide some details about the design of an app, website or other digital product, and it will be your job to come up with creative ways to improve its user experience. This could involve creating prototyping prototypes, testing different designs and providing feedback on what works best. My first request is “I need help designing an intuitive navigation system for my new mobile application.

Generating code

  • Write a function that does X
  • Create a React component that does X
  • Write the HTML and CSS for X
  • Write unit tests for this function using X library
  • Write a test for this code using X e2e library
  • Write a bash command that does X
  • Write a git command that does X
  • Generate dummy data for X
  • Write a SQL query that does X
  • Generate fake X data; each X should be a Y with Z properties
    • once a single entry is correct: generate # of entries as a Y language array?

Refactoring code

  • How can I improve this code?
  • Convert this code to X language
  • Rewrite this code using X library
  • Add type hints to this code
  • Refactor X part of the code in Y way
    • Destructure the X parameter
    • Modify the code to do X with Y
    • Rewrite this code using TypeScript
    • Rewrite this code using TailwindCSS

Reading code

  • Comment/document this code
  • Explain what this code is doing
    • e.g. What does this regex do? [regex]
  • Explain what X line of code is doing
  • Generate README instructions for using this function to do X

Debugging code

  • [Copy error message]
  • Per Jordan: I find it’s very good at debugging code that it has written. i.e. “I thought it would do this, but it did that”, or “I got this stack trace, how do I fix it”
  • Identify potential bugs in the following code: [code}
  • The code above should do X, but it’s doing Y; can you debug this code for me and tell me why this bug is happening?

Inbox