Project Icon

dev-chatgpt-prompts

开发者专用ChatGPT提示集合

项目收录了多种开发者专用的ChatGPT提示,涉及代码重构、文档编写和bug修复等方面。这些提示不仅适用于程序员,也能帮助学生、营销人员和内容创作者提高工作效率。通过使用这些提示,可以更好地利用ChatGPT解决各类编程问题,激发创新思维。

🤖 DEV ChatGPT Prompts

Welcome to my personal collection of ChatGPT prompts for developers! 🙌

This repository contains a list of powerful ChatGPT prompts that can help you get the creative juices flowing. 💡 Whether you are a beginner or an experienced pro, these prompts can help you think outside the box and find new solutions to problems. 🚀

The list is divided into categories: [ prompts for coders, students, marketers, and content writers ]. So no matter your profession, there is something here for everyone! 😊 Let’s dive right into these powerful ChatGPT prompts that can help take your creativity to the next level! 🌊

Table of Contents

Prompts for Coders

🚩 Tips

Like many things in life, with GPT-4, you get out what you put in. In this case, providing more context, instructions, and guidance will usually produce better results.

Here are some tips and techniques to improve:

  • Split your prompts: Try breaking your prompts and desired outcome across multiple steps. Keeping prompts to have a single outcome has shown to produce better results than combined prompts. For example, ask for a review, then ask for a refactor based on the review response. This may become less important in time as LLMs increase their token limit.

  • Give Examples: Provide expected inputs, data and outputs to improve accuracy quality. 📝

  • Be Specific: Don’t be afraid to list exactly what you want, what you know, what is needed, and what not to include. 🔎

  • Ask it to Reflect: A technique called reflexion has been shown to increase GPT4’s accuracy. Basically ask it ‘Why were you wrong?’ or get it to reflect and review its own response. 🤔

🔗 A multi-prompt approach (prompt chaining)

can be used to update, refactor, and review a piece of code. A well-designed set of prompts is one where each has separated concerns and singular responsibilities.

1. Modernize and add best practices


by getting GPT-4 to re-write your code into the style you want. This step will generally result in coherent output, in the style you want, but may introduce errors, so we do it first.

Prompt:

Review the following code and re-write it to modern es6 programming standards and formatting:

[insert code here]

2. Review your code for logical errors and security concerns


Get recommendations to improve any logical or security concerns introduced. It’s important that we don’t ask for a refactor, just the reasoning behind wanting the refactor.

Prompt:

Review your provided code 'tempFunction' for any logical or security concerns and provide a list of recommendations.

3. Validate the recommendations (reflexion)


Validate the provided recommendations. Reflexion is a powerful technique to improve the accuracy of the initial recommendations and try to eliminate any hallucinations. This is not always required but it is worth asking if you are unsure about any recommendations.

Prompt:

Review your above recommendations. Tell me why you were wrong and if any recommendations were overlooked or incorrectly added?

4. Write the Code


Combine your reviews, recommendations and feedback to get GPT-4 to write your new function.

Prompt:

Re-write the 'tempFunction' function based off your review and recommendations.

5. Create Tests


Create some simple tests that we can run locally and validate the results

Prompt:

Create two [ define technology ] tests for the above 'tempFunction' function. One that is expected to pass and one that is expected to fail.

Re-write Prompt

Let's see if we can get GPT4 to make or average prompts and turn them into "voyage inspirant" type mastery prompts.

Prompt:

[your prompt]

Re-write the above text to be more verbose and include a lot of superfluous description about each thing, use very painting language.

⬆️ Back to table of contents

ChatGPT prompt optimizer

Prompt:

I'll provide a chatGPT prompt. You'll ask questions to understand the audience and goals, then optimize the prompt for effectiveness and relevance using the principle of specificity.

⬆️ Back to table of contents

Ask for alternatives

If you're not satisfied with your solution you can ask to ChatGPT to give you alternatives

Prompt:

I'll provide you with a piece of code that I made and 
I need you give me alternatives to do the same in other way:

[INSERT YOUR CODE HERE]

⬆️ Back to table of contents


Documentation / Explaination

📣 Adding Documentation

[!NOTE] Adding documentation requires creating clear and comprehensive explanations of a module’s purpose, design, and implementation.

Prompt 1#:

I don't know how to code, but I want to understand how this works. Explain the following code to me in a way that a non-technical person can understand. Always use Markdown with nice formatting to make it easier to follow. Organize it by sections with headers. Include references to the code as markdown code blocks in each section. The code:

[insert code here]

Prompt 2#:

Please add comprehensive documentation for [file or module name], including clear and concise explanations of its purpose, design, and implementation. Consider including examples of how to use the module, as well as any relevant diagrams or flow charts to help illustrate its workings. Ensure that the documentation is easily accessible to other developers and is updated as the module evolves. Consider using documentation tools such as inline comments, markdown files, or a documentation generator to simplify the process.

[insert code here]

⬆️ Back to table of contents

📣 Write your terms and conditions

Prompt:

Create terms and services for my website about an [AI tool] called [name].

⬆️ Back to table of contents

📣 Produce cheat sheets

Prompt:

Write a cheat sheet for [markdown formatting].

⬆️ Back to table of contents

📣 Generate Readme Files

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]

⬆️ Back to table of contents

📣 Write detailed blogs

Prompt:

Write a detailed blog on How to build a [COVID tracker] using React with proper structuring of code.

⬆️ Back to table of contents

📣 Explain Code

[!NOTE] Don't spend time trying to figure out how code works, just ask ChatGPT to explain it to you

Prompt:

Context: I'm starting a new position as backend developer and I have to start to understand how some functions are working
Technologies: [INSERT YOUR TECHNOLOGIES HERE]
You have to: explain me the code line by line

[INSERT YOUR CODE HERE]

⬆️ Back to table of contents

📣 Architecture Diagram (Mermaid)

[!NOTE] Create a diagram of your architecture using Mermaid

Prompt:

Write the Mermaid code for an architecture diagram for this solution [DESCRIBE SOLUTION]

Example:

  graph TD;
  A[Client] -->|HTTP Request| B(API Gateway);
  B -->|HTTP Request| C[Service 1];
  B -->|HTTP Request| D[Service 2];
  C -->|Database Query| E[Database];
  D -->|Database Query| E;

⬆️ Back to table of contents

📣 Entity Relationship Diagram (Mermaid)

[!NOTE] Create an entity relationship diagram using Mermaid

Prompt:

Write the Mermaid code for an entity relationship diagram for these classes [INSERT CLASSES]

⬆️ Back to table of contents

Code Refactoring

📣 Refactor Code

[!NOTE] Ask to ChatGPT to refactor your code

Prompt:

I have a piece of code and I need you do a refactor of it:

[INSERT YOUR CODE HERE]

Refactoring code is an essential process in software development that aims to improve the quality, readability, and maintainability of existing code without altering its functionality. Refactoring can enhance code efficiency, reduce errors, and make it easier to modify or extend in the future. With ChatGPT’s help, you can effectively refactor your code and achieve a better code structure.

⬆️ Back to table of contents

📣 Modernizing Old Code

[!NOTE] By providing your old function to GPT-4 and asking it to refactor it to modern coding practices, you can quickly modernize your code.

Prompt:

Refactor the following code to modern es6 programming standards:

[INSERT YOUR CODE HERE]

⬆️ Back to table of contents

📣 Code in to Multiple Methods

[!NOTE] If you have a long function that is doing too much, you can ask GPT-4 to refactor it into multiple methods.

Prompt:

Refactor the following code into multiple methods to improve readability and maintainability:

[INSERT YOUR CODE HERE]

⬆️ Back to table of contents

📣 Better Performance

[!NOTE] If you have a function that is taking too long to run, you can ask GPT-4 to refactor it to improve performance.

Prompt:

Refactor the following code to improve performance:

[INSERT YOUR CODE HERE]

⬆️ Back to table of contents

📣 Adding a Parameter to a Function

Prompt:

Add a parameter to this function to do [FUNCTIONALITY]

[INSERT YOUR CODE HERE]

⬆️ Back to table of contents

📣 Adding Coding Best Practices or Principles

[!NOTE] Let ChatGPT rewrite the code for you according to style guidelines.

Prompt:

Rewrite the code below following the Google style guidelines for javascript.

[INSERT YOUR CODE HERE]

⬆️ Back to table of contents

📣 Follow coding style guidelines

[!NOTE] If your organization or code base uses specific coding practices and styles that you want to maintain, you can provide instructions to GPT-4 on which particular coding practice or style you’d like it to focus on.

Prompt:

Review the following code and refactor it to make it more DRY and adopt the SOLID programming principles.

[INSERT YOUR CODE HERE]

⬆️ Back to table of contents

📣 Detecting and Fixing Errors

[!NOTE] Sometimes we are unaware of the vulnerabilities or potential issues our code can create. Having GPT-4 review and address code issues can save you more than just time.

Prompt 1#:

Review this code for errors and refactor to fix any issues:

[INSERT YOUR CODE HERE]

Prompt 2#:

I'm developing software in [INSERT YOUR TECHNOLOGIES HERE] and I need you help me to find and
fix all the errors in my code, following the best practices. I'll provide you my code
and you'll give me the code with all the corrections explained line by line

Prompt 3#:

I wrote this code [CODE] I got this error [ERROR] How can I fix it? or What does this error mean?

⬆️ Back to table of contents

📣 Debug a React component

[!NOTE] This process typically involves identifying the source of the error, understanding the issue, and implementing a solution to resolve the issue

Prompt:

Please find and fix the bug in the [component name] component that is causing [describe the issue].

[INSERT YOUR CODE HERE]

⬆️ Back to table of contents

📣 Create Unit Tests

[!NOTE] Unit tests are automated tests that check the behavior of individual units of code in isolation. They help catch bugs early and make it easier to maintain the code.

Prompt 1#:

Please write unit tests for [file or module name] to ensure its proper functioning

[insert code here]

Prompt 2#:

Create 2 unit tests for the provided code. One for a successful condition and one for failure.

⬆️ Back to table of contents

📣 Transpiling Code

项目侧边栏1项目侧边栏2
推荐项目
Project Cover

豆包MarsCode

豆包 MarsCode 是一款革命性的编程助手,通过AI技术提供代码补全、单测生成、代码解释和智能问答等功能,支持100+编程语言,与主流编辑器无缝集成,显著提升开发效率和代码质量。

Project Cover

AI写歌

Suno AI是一个革命性的AI音乐创作平台,能在短短30秒内帮助用户创作出一首完整的歌曲。无论是寻找创作灵感还是需要快速制作音乐,Suno AI都是音乐爱好者和专业人士的理想选择。

Project Cover

有言AI

有言平台提供一站式AIGC视频创作解决方案,通过智能技术简化视频制作流程。无论是企业宣传还是个人分享,有言都能帮助用户快速、轻松地制作出专业级别的视频内容。

Project Cover

Kimi

Kimi AI助手提供多语言对话支持,能够阅读和理解用户上传的文件内容,解析网页信息,并结合搜索结果为用户提供详尽的答案。无论是日常咨询还是专业问题,Kimi都能以友好、专业的方式提供帮助。

Project Cover

阿里绘蛙

绘蛙是阿里巴巴集团推出的革命性AI电商营销平台。利用尖端人工智能技术,为商家提供一键生成商品图和营销文案的服务,显著提升内容创作效率和营销效果。适用于淘宝、天猫等电商平台,让商品第一时间被种草。

Project Cover

吐司

探索Tensor.Art平台的独特AI模型,免费访问各种图像生成与AI训练工具,从Stable Diffusion等基础模型开始,轻松实现创新图像生成。体验前沿的AI技术,推动个人和企业的创新发展。

Project Cover

SubCat字幕猫

SubCat字幕猫APP是一款创新的视频播放器,它将改变您观看视频的方式!SubCat结合了先进的人工智能技术,为您提供即时视频字幕翻译,无论是本地视频还是网络流媒体,让您轻松享受各种语言的内容。

Project Cover

美间AI

美间AI创意设计平台,利用前沿AI技术,为设计师和营销人员提供一站式设计解决方案。从智能海报到3D效果图,再到文案生成,美间让创意设计更简单、更高效。

Project Cover

AIWritePaper论文写作

AIWritePaper论文写作是一站式AI论文写作辅助工具,简化了选题、文献检索至论文撰写的整个过程。通过简单设定,平台可快速生成高质量论文大纲和全文,配合图表、参考文献等一应俱全,同时提供开题报告和答辩PPT等增值服务,保障数据安全,有效提升写作效率和论文质量。

投诉举报邮箱: service@vectorlightyear.com
@2024 懂AI·鲁ICP备2024100362号-6·鲁公网安备37021002001498号