Last month we saw some of the most useful “prompts” or phrases for ChatGPT in general. Later we have been delving into more specialized topics, collecting some of the best prompts for students , and even prompts for writers and content creators .
Today we are going to do the same by reviewing some of the most interesting prompts for web developers and programmers in general. The fact that ChatGPT can program code using simple textual indications makes its potential enormous, both for creating small programs from scratch, and for correcting bugs and code errors.
The best ChatGPT prompts for programmers and web developers
Although ChatGPT may seem very good to us writing code from the outset, we must remember that OpenAI’s Artificial Intelligence still suffers from “hallucinations”, and therefore, can make mistakes. Don’t forget to review any piece of code it gives you to make sure it works correctly.
Code writing and new features
One of the most useful prompts allows us to ask the AI to act as an expert developer in a certain technology:
- Acts as a developer of (technology name). Write a code/program to perform X task.
For example, we can ask you to be a Python expert and write a piece of code that will detect duplicate records in a CSV file.
We can also be more specific and write a slightly more detailed prompt like the following:
- Acts as: (developer profile)
Technology stack : (introduce stack)
Functionality : (indicates the functionality of the program)
Required fields : (indicates the required fields of the program)
Optional fields : (indicates the optional fields of the program)
Task : (clearly indicate what you want the program to do)
Using this prompt we can ask ChatGPT to act as a PHP scheduler and write a WordPress plugin that measures the CPU consumption of the server every hour.
In addition to these two powerful prompts, we can use many other commands with ChatGPT. Here are a few ideas:
- Give me a guide on how to create an application that (function).
- Write the code for a Chrome extension that (function).
- Write a JavaScript code for (target).
- Create a (language) script to parse a (file format) and extract (information) with the following requirements: (list of requirements).
- Develop a microservice of (language) for (domain) that includes endpointsfor (list of operations) and adheres to (design pattern).
- Write a function in (language) to filter (data structure) based on (condition) with the following inputs: (input variables) and expected output: (output description).
- Design an algorithm of (language) to solve (problem) using (strategy or technique).
- Implement a function in (language) that handles (task) asynchronously with the following inputs: (input variables) and expected output: (output description).
If a program is crashing and you can’t finish it, you can also ask ChatGPT to help you complete it :
- Complete this code for (language) to parse (file format) and extract (information): (code snippet).
- Finish the implementation in (language) of (design pattern) for (use case): (code snippet).
- Fill in the missing (language) code to implement (task) for the following function: (code snippet).
- Complete this (language) code to convert (data structure) to (output format): (code snippet).
- Finish the implementation in (language) of a multi-threaded solution for (problem): (code snippet).
Here are a few other quite interesting prompts related to code generation and web development from a didactic and educational point of view .
- What are some tips to make a website look good on any device?
- Can you tell me about Progressive Web Apps and why they are becoming so popular?
- Can you explain the difference between HTML, XHTML and HTML5?
- What are the security risks that developers need to consider when building a web application?
- What is the appeal of using a CSS framework like Bootstrap?
- Can you give an overview of the difference between front-end and back-end web development?
- What role does REST play in web development and what is it for?
- Can you describe the process of optimizing a website for search engines?
- Why is accessibility important in web design and how can it be achieved?
- Can you summarize the benefits and drawbacks of using JavaScript frameworks like Angular or React?
- What impact does making sure a website work on different browsers have on web development and what can be done to make that happen?
- Can you compare and contrast the pros and cons of using a web host versus hosting a website yourself?
- Can you explain the concept of modular design in web development and why it is so important?
- How does using version control, such as Git, affect the development process?
- What is the role of WebAssembly in web development and what are its benefits?
- What tools are typically used for debugging and testing web applications?
Detection and correction of errors
Finally, remember that ChatGPT also works as an excellent helper when reviewing, detecting, and correcting errors in your code.
- Please tell me how I can debug my code to fix the following bug.
Project : (project description)
Technology stack : (introduce stack)
Error : Explain the error or enter the error code received when compiling or executing the program
- Locate any logical errors in the following (language) code snippet: (code snippet).
- Identify potential performance issues in this (language) code snippet: (code snippet).
- Find any resource leaks in the following (language) code and suggest possible solutions: (code snippet).
- Review possible deadlock issues in the following (language) code: (code snippet).
- Review the following code (language) for potential SQL injection vulnerabilities: (code snippet).
- Analyze the following (language) code for poorly implemented code and suggest improvements: (code snippet).
- Evaluate the compatibility of this (language) code with the (platform or technology): (code snippet).
- Review this (language) code for potential scalability issues: (code snippet).
If you know of other interesting prompts for ChatGPT related to programming and web development, feel free to leave your recommendation in the comments area.