ChatGPT Prompts for Writing Code
This blog looks at ChatGPT prompts, which can help coders save hours of their time daily. It explores how ChatGPT can generate algorithms' code, help understand complex topics, and find bugs in code.
Pratham
DevRel @HyperspaceAI • Prev @Rapid_API • Partners @iteration_x @10Web_io @StockImgAI @JamDotDev @CohesiveAI @refine_dev @chatlingai @Inboxproio @Docus_ai
-
Extremely useful ChatGPT prompts for those who write code.
— Pratham (@Prathkum) April 13, 2023
If you want to save your hours daily, open this: -
1. Generate algorithms' code
— Pratham (@Prathkum) April 13, 2023
Data structures and algorithms are tricky. You can generate code in different languages with explanations.
Prompt:
Write JavaScript code for the Quicksort algorithm. pic.twitter.com/erZmc5dE4n -
2. Understand complex topics
— Pratham (@Prathkum) April 13, 2023
Prompt:
How would you explain state bloat in blockchain to a 5-year-old? pic.twitter.com/EsfBnAyFrI -
3. Find bugs
— Pratham (@Prathkum) April 13, 2023
Prompt:
Find the bug in the following code {code}
You can add the details of your code if this simple prompt doesn't work. pic.twitter.com/MRiQwQjS9G -
4. Content calendar
— Pratham (@Prathkum) April 13, 2023
Prompt: Prepare a Twitter content calendar for April. I generally post about web development, developer resource listicles, tips and tricks, and AI. pic.twitter.com/owo28wYbuD -
5. Generate Readme Files
— Pratham (@Prathkum) April 13, 2023
Prompt:
Generate documentation for the code below. You should include detailed instructions to allow a developer to run it on a local machine, explain what the code does, and list vulnerabilities that exist in this code. {enter code} pic.twitter.com/YumRpDbId6 -
6. Code translator
— Pratham (@Prathkum) April 13, 2023
Prompt:
"Translate this code from JavaScript to Python {Enter code}" pic.twitter.com/InwwoM4rgz -
7. Write detailed blogs
— Pratham (@Prathkum) April 13, 2023
Prompt:
Write a detailed blog on How to build a {COVID tracker} using React with proper structuring of code. pic.twitter.com/FI1dAGqIwK -
8. Follow coding style guidelines
— Pratham (@Prathkum) April 13, 2023
Let ChatGPT rewrite the code for you according to style guidelines.
Prompt:
Rewrite the code below following the Google style guidelines for javascript. {enter code} pic.twitter.com/qrveEf3HE9