My Top 17 ChatGPT Prompts for Coding

I've been using ChatGPT to speed up my development workflow for a year now. Here are my favorite prompts to use to speed things up.

Last UpdatedMarch 29, 2024
Estimated Read Time9 minutes

In just one year, we went from "What's AI?" to companies posting "Prompt Engineer" as a hireable role on their job boards.

To say 2023 wasn't a transformational year in the AI space is an understatement.

While there's a lot of fear-mongering going around these days:

  • "AI will replace programmers"
  • "Web development is dead"

I'm not a prophet. I can't tell you what things will look like in 10 years, but if I had to put money on it, I'd say these claims are wildly overstated.

TestTable
With Values

I don't think web development is going anywhere. I think web development is changing (as it always has).

And with that change, we as programmers need to learn how to use new tools and work on new problems.

The good news?

That's exactly what a software engineer is—someone who is constantly learning and adapting with changes in technology.

So in this post, I want to share 17 Chat GPT prompts that I have been using in my professional life that will help you be a more effective programmer.

ChatGPT Prompts for Learning to Code

Prompt #1: "Explain this code"

Template

Explain the code below:

```
Place code here
```

Example

Potential Follow-ups

Here are a few prompts that you might use as a follow-up to this response:

  • Can you explain useEffect in more detail?
  • What framework uses the "use client" directive?
  • Is useNavbarVisible a standard React hook? Where did it come from?

Prompt #2: "Guide me step-by-step"

Template

Can you guide me step by step to learn [technology]?  Make this interactive and prompt me as we learn.

Example

Potential Follow-ups

At this point, ChatGPT will guide you step by step to learn PHP. You'd likely want to follow up with something like:

  • I don't know anything about PHP
  • I've written basic PHP code before, but don't know much

Prompt #3: "I know XYZ. Help me learn..."

The idea with this prompt is to get a tutorial built specifically for your own skillset. You may be able to find a "Ruby tutorial" online somewhere, but it will be a lot harder to find "Ruby for JavaScript devs" online. That's where ChatGPT comes in handy.

Template

I know [ABC technology].  Can you help me learn [XYZ technology] by incorporating concepts that I already know?

Take me step by step through this and make the learning interactive by prompting me.

Example

Potential Follow Ups

As you can see, ChatGPT's first response gave a code challenge but forget to teach us how to define a Ruby variable or "print" something to the console. In this case, I'd follow up with the prompt:

Prompt #4: "What should I learn next?"

One of the most common questions I get from my viewers on YouTube is, "where do I go now?"

I built this site, Full Stack Foundations to help answer that question, but ChatGPT can also be a helpful assistant here. Take these responses as suggestions that you'll research further. Please do not base your entire learning path off a ChatGPT response!

Template

I just finished learning [XYZ Concept].  What are some possible next learning paths if I want to become [dream job]?

Example

Follow up Prompt

You can browse through the responses and start narrowing things down:

Prompt #5: "Give me a project to build"

Template

I just finished learning [XYZ Concept] and I want to practice my skills.  Can you give me a [skill level (beginner, intermediate, advanced)] level project brief and some hints to get me started?

Example

Potential Follow Ups

  • Can you write out my first 10 tasks for this project?
  • Can you guide me through this step by step?

Prompt #6: "Quiz me on XYZ subject"

Interactive quizzes with ChatGPT are excellent for beginners. Since ChatGPT basically knows everything, it can become super interactive!

Template

I just finished learning [XYZ concept].  Can you build me a comprehensive quiz that tests my knowledge of this and walk me through the quiz step by step?

Example

Prompt #7: "What are some tools I can use to help with..."

While ChatGPT isn't always up-to-date on the latest information, for well-established toolsets, it can be a huge help in finding the right tool for the job.

Template

I'm building [project title].  It will have the following features:

- [Feature 1]
- [Feature 2]
- [Feature 3]

What tools or technologies would be well-suited for this type of project?  I am most comfortable with the [your favorite language] programming language.

Example

The pitfalls of this prompt

Be careful with this one. The recommendations ChatGPT gives will never be perfect for your situation.

Use them as a starting point to discover tools that you may not have known about. Then, go research those tools in depth!

Choosing the correct tools for your project is a super important step and should not be rushed through.

ChatGPT Prompts for Writing Code

Believe it or not, ChatGPT can write some pretty outstanding code if prompted correctly. Here are the prompts I use to get the most out of it.

Prompt #1: "Help me build my data model"

One area that I've found ChatGPT to excel at is data modeling. This is a super important first step to building any project and I use ChatGPT extensively during this process to come up with better data relationships and find things that I might have missed on my own.

All that said, if you don't have foundational knowledge in data modeling, it will be a little bit harder to work with this prompt.

Template

Can you help me build a data model?  Here are the entities that I have so far:

- Entity 1
- Entity 2

I am building an app that [describe what your app will do]

Show me what this data model should look like and how I can improve it.

Example

The pitfalls of this prompt

ChatGPT can't build your entire data model for you. At some point, you'll have to step in and make some decisions.

Use this prompt as a starting point that gives you some ideas on where to take your project.

Prompt #2: "Build me a utility function that does XYZ"

This is one of my favorite prompts. I use this all the time to speed up my development workflow.

Template

Build me a [coding language] utility function that [describe what it does].  It should accept the following parameters as input: [list inputs]

Example

ChatGPT Prompts for Debugging and Code Review

Oftentimes, you'll have to write a bunch of code without the help of ChatGPT due to the complexity. But once you've completed it, ChatGPT can be an excellent "auditor" to show you how to either fix or improve it.

Prompt #1: "Fix my code"

This prompt is especially useful for beginners when you're learning the syntax of a new programming language.

Template

This code does not work.  Can you fix it?

```
Put your code here
```

Example

Prompt #2: "Can you improve my code?"

This prompt works well for beginner code and is hit or miss with more advanced code.

Template

Can you improve my code?

```
Add your code here
```

Example

Prompt #3: "What best practices should I use for XYZ?"

If you think about it, ChatGPT essentially knows all public information on the internet. In many cases, it can be a great "senior developer" to guide you through a coding problem using "best practices" (i.e. industry standard techniques).

It doesn't always get things right though. Use these answers to get you started, but always try to get a second opinion.

Template

I'm building [describe project] with [list technologies].  Can you give me some "best practices" that I should follow?

Example

Prompt #4: "What are the trade-offs?"

I love this prompt. As engineers, we are constantly weighing the pros and cons of a given problem-solving approach. When building things, there is often no "correct" answer—just trade-offs.

ChatGPT is great at listing these out for you so you can make better decisions.

Template

I'm building [XYZ project].  This app will [describe what it does]

I'm currently using the following approach: [describe how you're solving a problem in the app]

What are the tradeoffs to this approach vs. other options like [list alternatives you have considered]

Example

Chat GPT Prompts for Building User Interfaces

When it comes to building user interfaces, there are tons of tools popping up all over the place. ChatGPT is probably not the best tool for the job, but can be super helpful when building basic UI components and interactions.

Prompt #1: "Using X, Y, Z, build me a component"

I generally reserve this prompt for simple components to get me started. After ChatGPT generates the UI component, I'll edit it manually. This saves me a lot of time!

Template

Using [list technologies], build me a [feature you need built]

Example

Prompt #2: "Transform this code into..."

I don't use this too often, but every once in a while, I'll stumble on a code snippet that is close to what I need, but needs to be entirely rewritten in the tech stack I'm using.

Template

Can you transform this [language] code to [language]?

Example

Chat GPT Prompts for Writing Scripts and One-Liners

Last, but certainly not least, let's write some scripts with ChatGPT. This may be one of the biggest time-saving scripts in this entire post. I use these all the time.

Prompt #1: "Write a bash script"

ChatGPT is scary good as writing bash scripts. Once you learn the basics of Bash, it can be an excellent sidekick.

Template

Write me a bash script that [explain what it does]

Example

Prompt #2: "Build me a script in [language] that..."

And finally, a variation of the bash script above.

Template

Write a script in [language] that performs the following steps:

1. Step 1
2. Step 2
3. Step 3

Example

Concluding Thoughts: Too Much Reliance on AI?

My mission here at Full Stack Foundations is to help developers build a rock-solid foundation of knowledge and skills so they can level up in their careers.

As you incorporate AI into your workflows, try and strike a balance between being effective and learning concepts.

When I first learned to code, I deliberately would type out code examples line by line so that I could better understand what the code is doing. In the age of LLMs like ChatGPT, it can be tempting to employ the "copy/paste" strategy and never really sit down to learn what you're doing.

For small projects, this strategy works fine. But when you start working in the field and get thrown into a complex codebase, relying on ChatGPT won't cut it.

So think of ChatGPT as your "coding assistant", not your crutch. ChatGPT is an excellent way to learn, but no substitute for putting in the work and time it takes to become a well-rounded software engineer.