0% found this document useful (0 votes)
178 views

ChatGPT Cheat Sheet Devs v2 2

The document provides templates for using ChatGPT to get help with various coding tasks like writing code, understanding code, refactoring code, debugging and testing, code reviewing, documenting code, and general tips. It includes prompts for tasks like writing functions, classes, tests, documentation, and diagrams for code examples.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
178 views

ChatGPT Cheat Sheet Devs v2 2

The document provides templates for using ChatGPT to get help with various coding tasks like writing code, understanding code, refactoring code, debugging and testing, code reviewing, documenting code, and general tips. It includes prompts for tasks like writing functions, classes, tests, documentation, and diagrams for code examples.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

CHATGPT CHEAT SHEET (DEV EDITION) THE BEST PROMPT TEMPLATES

Writing Code Understanding Code Refactoring Code

1. Write a C# function to do {{ TASK }} 1. What does this code do? {{ CODE }} 1. Refactor this code into multiple methods {{ CODE }}
2. Write a React component to do {{ TASK }} 2. Explain the purpose of this {{ LANGUAGE }} function 2. How can I refactor this code for better performance?
{{ FUNCTION }} {{ CODE }}
3. Write a Dockerfile for {{ FRAMEWORK }}
3. What is the differences between {{ CONCEPT }} and 3. How can I refactor this code for better readability?
4. Write a RegEx pattern for {{ REQUEST }}
{{ CODE }}
{{ CONCEPT }} in {{ LANGUAGE }}
5. Create a C# class from this JSON object {{ JSON }}
4. Add a parameter to this function to do
4. What does {{ KEYWORD, OPERATOR, ETC }} do in
{{ FUNCTIONALITY }} {{ CODE }}
Examples {{LANGUAGE}}?
5. Convert this callback-based function to use
5. What libraries can do {{ REQUIREMENTS }} for Promises {{ CODE }}
1. Write a C# method to get items from a DB and print them.
{{ LANGUAGE }}
Leave TODO comments where you are unsure E.g. 6. Rewrite this JS code in C# {{ JS CODE }}
Data connections 6. What language/framework is best for this idea?
7. Add a parameter to this function to do {{ CODE }}
2. For my .NET project, write a GitHub Action to check PRs. {{ IDEA }}
8. Make this code use .NET 8 features {{ CODE }}
It should run the tests and lint the code
Examples

1. Can a Dictionary become out of order in C#? Code Review


Debugging / Testing
2. What does “static” do in C#?
3. Explain the lifecycle events of Blazor components. 1. How can I improve the error handling in my
1. I wrote this code {{ CODE }} I got this error {{ ERROR }} {{ LANGUAGE }} code? {{ CODE }}
How can I fix it? or What does this error mean? 4. What is the difference between Lists and Arrays
in C#? 2. Are there any opportunities for code reuse or
2. Write a test that ensures {{ FUNCTIONALITY }} modularization in my {{ LANGUAGE }} project?
works for this component {{ CODE }} 5. What is a library that can render Markdown for {{ CODE }}
a Blazor project?
3. Write a test for this method {{ CODE }} 3. Can you review this code and suggest
improvements? {{ CODE }}
4. I am doing exploratory testing, tell me how to
break this code {{ CODE }} Documenting Code

Examples 1. Write a readme file for this project Tips


{{ DESCRIBE PROJECT }}
1. How can I set up unit tests for a Blazor project? I want to 1. If you are generating lots of code and it doesn’t finish,
use bUnit. 2. Write the Mermaid code for an entity relationship type “continue”
diagram for these classes {{ INSERT CLASSES }}
2. What does this error mean? 2. Give more context, get better results
System.ArgumentOutOfRangeException: 3. Write the Mermaid code for an architecture
3. When asking for explanations, add “keep it short and
Index was out of range. diagram for this solution {{ DESCRIBE SOLUTION }} concise”
4. Add some comments in this code {{ CODE }} 4. When refactoring code, ask it to omit unchanged code
5. For this {{ CODE }}, add comment for each step, to make responses easier to read
explaining its purpose

Examples
1. Write instructions for running a .NET project to
ssw.com.au/rules/chatgpt-cheat-sheet add to the README
version 2.2

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy