dev-chatgpt-prompts

dev-chatgpt-prompts

开发者专用ChatGPT提示集合

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

ChatGPT提示词代码生成重构开发者Github开源项目

🤖 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.

<sup>⬆️ Back to table of contents</sup>

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.

<sup>⬆️ Back to table of contents</sup>

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]

<sup>⬆️ Back to table of contents</sup>


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]

<sup>⬆️ Back to table of contents</sup>

📣 Write your terms and conditions

Prompt:

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

<sup>⬆️ Back to table of contents</sup>

📣 Produce cheat sheets

Prompt:

Write a cheat sheet for [markdown formatting].

<sup>⬆️ Back to table of contents</sup>

📣 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]

<sup>⬆️ Back to table of contents</sup>

📣 Write detailed blogs

Prompt:

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

<sup>⬆️ Back to table of contents</sup>

📣 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]

<sup>⬆️ Back to table of contents</sup>

📣 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;

<sup>⬆️ Back to table of contents</sup>

📣 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]

<sup>⬆️ Back to table of contents</sup>

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.

<sup>⬆️ Back to table of contents</sup>

📣 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]

<sup>⬆️ Back to table of contents</sup>

📣 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]

<sup>⬆️ Back to table of contents</sup>

📣 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]

<sup>⬆️ Back to table of contents</sup>

📣 Adding a Parameter to a Function

Prompt:

Add a parameter to this function to do [FUNCTIONALITY]

[INSERT YOUR CODE HERE]

<sup>⬆️ Back to table of contents</sup>

📣 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]

<sup>⬆️ Back to table of contents</sup>

📣 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]

<sup>⬆️ Back to table of contents</sup>

📣 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?

<sup>⬆️ Back to table of contents</sup>

📣 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]

<sup>⬆️ Back to table of contents</sup>

📣 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.

<sup>⬆️ Back to table of contents</sup>

📣 Transpiling Code

编辑推荐精选

讯飞智文

讯飞智文

一键生成PPT和Word,让学习生活更轻松

讯飞智文是一个利用 AI 技术的项目,能够帮助用户生成 PPT 以及各类文档。无论是商业领域的市场分析报告、年度目标制定,还是学生群体的职业生涯规划、实习避坑指南,亦或是活动策划、旅游攻略等内容,它都能提供支持,帮助用户精准表达,轻松呈现各种信息。

AI办公办公工具AI工具讯飞智文AI在线生成PPTAI撰写助手多语种文档生成AI自动配图热门
讯飞星火

讯飞星火

深度推理能力全新升级,全面对标OpenAI o1

科大讯飞的星火大模型,支持语言理解、知识问答和文本创作等多功能,适用于多种文件和业务场景,提升办公和日常生活的效率。讯飞星火是一个提供丰富智能服务的平台,涵盖科技资讯、图像创作、写作辅助、编程解答、科研文献解读等功能,能为不同需求的用户提供便捷高效的帮助,助力用户轻松获取信息、解决问题,满足多样化使用场景。

热门AI开发模型训练AI工具讯飞星火大模型智能问答内容创作多语种支持智慧生活
Spark-TTS

Spark-TTS

一种基于大语言模型的高效单流解耦语音令牌文本到语音合成模型

Spark-TTS 是一个基于 PyTorch 的开源文本到语音合成项目,由多个知名机构联合参与。该项目提供了高效的 LLM(大语言模型)驱动的语音合成方案,支持语音克隆和语音创建功能,可通过命令行界面(CLI)和 Web UI 两种方式使用。用户可以根据需求调整语音的性别、音高、速度等参数,生成高质量的语音。该项目适用于多种场景,如有声读物制作、智能语音助手开发等。

Trae

Trae

字节跳动发布的AI编程神器IDE

Trae是一种自适应的集成开发环境(IDE),通过自动化和多元协作改变开发流程。利用Trae,团队能够更快速、精确地编写和部署代码,从而提高编程效率和项目交付速度。Trae具备上下文感知和代码自动完成功能,是提升开发效率的理想工具。

AI工具TraeAI IDE协作生产力转型热门
咔片PPT

咔片PPT

AI助力,做PPT更简单!

咔片是一款轻量化在线演示设计工具,借助 AI 技术,实现从内容生成到智能设计的一站式 PPT 制作服务。支持多种文档格式导入生成 PPT,提供海量模板、智能美化、素材替换等功能,适用于销售、教师、学生等各类人群,能高效制作出高品质 PPT,满足不同场景演示需求。

讯飞绘文

讯飞绘文

选题、配图、成文,一站式创作,让内容运营更高效

讯飞绘文,一个AI集成平台,支持写作、选题、配图、排版和发布。高效生成适用于各类媒体的定制内容,加速品牌传播,提升内容营销效果。

热门AI辅助写作AI工具讯飞绘文内容运营AI创作个性化文章多平台分发AI助手
材料星

材料星

专业的AI公文写作平台,公文写作神器

AI 材料星,专业的 AI 公文写作辅助平台,为体制内工作人员提供高效的公文写作解决方案。拥有海量公文文库、9 大核心 AI 功能,支持 30 + 文稿类型生成,助力快速完成领导讲话、工作总结、述职报告等材料,提升办公效率,是体制打工人的得力写作神器。

openai-agents-python

openai-agents-python

OpenAI Agents SDK,助力开发者便捷使用 OpenAI 相关功能。

openai-agents-python 是 OpenAI 推出的一款强大 Python SDK,它为开发者提供了与 OpenAI 模型交互的高效工具,支持工具调用、结果处理、追踪等功能,涵盖多种应用场景,如研究助手、财务研究等,能显著提升开发效率,让开发者更轻松地利用 OpenAI 的技术优势。

Hunyuan3D-2

Hunyuan3D-2

高分辨率纹理 3D 资产生成

Hunyuan3D-2 是腾讯开发的用于 3D 资产生成的强大工具,支持从文本描述、单张图片或多视角图片生成 3D 模型,具备快速形状生成能力,可生成带纹理的高质量 3D 模型,适用于多个领域,为 3D 创作提供了高效解决方案。

3FS

3FS

一个具备存储、管理和客户端操作等多种功能的分布式文件系统相关项目。

3FS 是一个功能强大的分布式文件系统项目,涵盖了存储引擎、元数据管理、客户端工具等多个模块。它支持多种文件操作,如创建文件和目录、设置布局等,同时具备高效的事件循环、节点选择和协程池管理等特性。适用于需要大规模数据存储和管理的场景,能够提高系统的性能和可靠性,是分布式存储领域的优质解决方案。

下拉加载更多