Cheatography
https://cheatography.com
Useful and easy to use generic prompts for programmers
This is a draft cheat sheet. It is a work in progress and is not finished yet.
Basic Prompt structure
Acting as a [ROLE] perform [TASK] in [FORMAT] |
|
Act as [ROLE]
Website Designer |
Therapist |
Prompt Engineer |
Project Manager |
Mindset Coach |
Lawyer |
Journalist |
Inventor |
Ghostwriter |
Chief Financial |
Officer |
Best Selling Author |
Analyst |
Advertiser |
Accountant |
Marketer |
Code Generation
Can you generate code for [add specific programming task or problem] in [specify programming language or framework]? |
[Example]: Can you generate code for a function that takes a list of n integers and returns a new list of only even numbers from the input list? I want you to create this function in the Python language. |
What is the most efficient or elegant way to generate code for [insert specific programming task or solution] in [insert programming language or framework]? |
[Example]: What is the most efficient way to write code in JavaScript to find the sum of the list of integers? |
Is there a library or tool that can assist with generating code for [insert specific programming task or goal] in [insert programming language or framework]? |
[Example]: Is there any library or tool that can help me generate code for working with dates in Java? |
Write a [language] function to filter [data structure] based on [condition] with the following inputs: [input variables] and expected output: [output description]. |
[Example]: Write a Python function to filter a list of integers based on whether they are greater than 5, with the following input variables: Input: list of integers Expected output: a new list containing only the integers greater than 5. |
Design a [language] algorithm to solve [problem] using [strategy or technique]. |
[Example]: Design a C++ algorithm to find the maximum element in an array using the divide and conquer strategy. |
Code Refactoring
Suggest the refactoring improvements for the following [language] code: [code snippet]. |
Optimize the following [language] code for lower memory usage: [code snippet]. |
Refactor the following [language] code to improve its error handling: [code snippet]. |
Natural Language Processing
Perform text classification of the following text: [text sample]. |
Analyze the sentiment of the following product review: [product review]. |
List out the key phrases in the social media posts: [social media post]. |
Personalized Development Learning
What are the available free resources to learn [programming language/technology]? |
What learning path should I follow to become a proficient [IT job role]? |
Suggest coding challenges or competitions improve my [programming language/technology] skills. |
Requirement Analysis
Analyze the following project requirements and suggest the technology stack: [project requirements]. |
Interpret the following project requirements and provide a detailed project plan with milestones and deliverables: [project requirements]. |
Convert the following project requirements into user stories: [project requirements]. |
|
|
Create a [TASK]
Summary |
Social edia Post |
SEO Keywords |
Blog Post |
Email Sequence |
Essay |
Recipe |
Product |
Description |
Cover Letter |
Analysis |
Book Outline |
Sales Copy |
Article |
Video Script |
Headline |
Code Completion
Complete the [language] code that [function]: code snippet |
[Example]: Complete the Python code that takes the list of integers and returns the sum of all elements: def sum_list(nums): |
Complete the [language] code to convert [data structure] into [output format]: [code snippet]. |
[Example]: Complete the Java code to convert an integer into a string: import java.util.*; public class Example{ |
Finish the [language] implementation of a multithreading solution for [problem] |
[Example]: Finish the Java implementation of a multithreading solution for a program that calculates the sum of even and odd numbers in a given range. import java.util.*; public class evenodd { |
Automated Testing
Write a test script for the given [language] code that covers [functional/non-functional] testing. |
Design a performance testing strategy for a [web/mobile] app for [resource usage, latency, and throughput]. |
Create a test suite for a [language] library or framework that validates its functionality and stability. |
Create an end-to-end testing strategy for a [mobile/web] app that covers critical user workflows. |
Code Translation
Translate the following [language] code for calculating the average of user input numbers into [desired language]: [code snippet]. |
Algorithm Development
Write a heuristic algorithm to solve a specific problem: [problem description] |
[Example]: Write a heuristic algorithm to solve a travel salesman problem. |
Analyze the following machine learning algorithm to improve its accuracy: [algorithm/pseudocode]. |
[Example]: Consider that we have a current algorithm that predicts customers’ sentiments. The text prompt would be: Analyze the following machine learning algorithm to improve its accuracy: Compile a database of client reviews together with the associated emotions (good or negative). Clean up the text and transform it to a numerical representation (such as bag-of-words) to prepare the data. Create training and test sets from the dataset. Utilize the training set to train a Naive Bayes classifier. Use measures like accuracy, precision, recall, and F1 score to assess the classifier's performance on the test set. |
Create a streaming algorithm to process data in real-time for [a specific purpose]. |
[Example]: Create a streaming algorithm to process data in real-time for the stock market. |
Assess the trade-offs of the given algorithm in terms of performance and resource usage: [algorithm or pseudocode]. |
[Example]: Asses the trade-offs of the following algorithm in terms of performance and resource usage: |
|
|
Show as [FORMAT]
Spreadhseet |
Code |
Roch TEXT |
Summary |
XML |
Graphs |
CSV file |
Gantt Chart |
JSON |
Plain Text |
File |
HTML |
Markdown |
A List |
PDF |
A Table |
Networking and Security
Create a secure [language] function that performs [specific task] while preventing [security threat or vulnerability]. |
[Example]: Write a secure Python function or module that performs password hashing while preventing SQL injection attacks. |
Design a secure protocol for [specific use case] for my [app/website]. |
[Example]: Design a secure and efficient protocol for secure communication between a client and a server over the Internet. |
Evaluate the security of the given [language] code when interacting with [external service/API]. |
[Example]: Evaluate the security of the given Python code when interacting with a database: |
Networking and Security
Create a secure [language] function that performs [specific task] while preventing [security threat or vulnerability]. |
[Example]: Write a secure Python function or module that performs password hashing while preventing SQL injection attacks. |
Design a secure protocol for [specific use case] for my [app/website]. |
[Example]: Design a secure and efficient protocol for secure communication between a client and a server over the Internet. |
Evaluate the security of the given [language] code when interacting with [external service/API]. |
[Example]: Evaluate the security of the given Python code when interacting with a database: |
Code Review
Review the following [language] code for code smells and suggest improvements: [code snippet]. |
Review the following [language] code for scalability issues: [code snippet]. |
Evaluate the following [language] code for compatibility with [technology]: [code snippet]. |
Evaluate the test coverage of the [language] code: [code snippet]. |
Bug Detection
Locate any logical errors in the following [language] code snippet: [code snippet] |
[Example]: Locate any logical errors in the following JavaScript code: [code snippet] |
Find the performance issues in the [language] code: code snippet. |
[Example]: Find the performance issues in the Python code: [code snippet] |
Check for potential deadlock issues in the [language] code: code snippet. |
Check the potential deadlock issues in Java code: [code snippet] |
Analyze the following [language] code and determine potential SQL injection vulnerabilities: [code snippet] |
[Example]: Analyze the following PHP code and determine potential SQL injection vulnerabilities: [code snippet] |
|