Coding Prompts
- Code Creation
- Code Modification
- System Design and Architecture
- Checking Code
- Testing Code
- Explain Code
These prompts are used in the process of creating, maintaining or otherwise working with software development and/or the systems that the software is run on. I have a primary interest in web development, machine learning and the Linux family of operating systems which is likely to be reflected in these prompts as they are saved in this list to make for a more optimized and seamless workflow using AI.
Code Creation
HTML/CSS Component
Generate a semantic and accessible HTML and (framework) CSS [UI COMPONENT] consisting of [COMPONENT PARTS]. The [COMPONENT PARTS] should be [LAYOUT].
Example
Generate a semantic HTML and Tailwind CSS "Contact Support" form consisting of the user's name, email, issue type, and message. The form elements should be stacked vertically and placed inside a card.
Javascript Function
Write a JavaScript function. It accepts [INPUT] and returns [OUTPUT].
Example
Write a JavaScript function. It accepts a full name as input and returns avatar letters.
Snippet Creation
Can you provide a code snippet in [LANGUAGE] for [FUNCTION]?
Example
Can you provide a code snippet in Python for generating a random number between 1 and 100?
Write API Functionality to Retrieve Data from Database
Write a/ an [FRAMEWORK] API for [FUNCTIONALITY]. It should make use of [DATABASE].
Example
Write an Express.js API to fetch the current user's profile information. It should make use of MongoDB.
Create Database Query
The database has [COMMA-SEPARATED TABLE NAMES]. Write a [database] query to fetch [REQUIREMENT].
Example
The database has students and course tables. Write a PostgreSQL query to fetch a list of students who are enrolled in at least 3 courses.
Optimized HTML Head
Give an example "head" section of the HTML code that is optimized for Search Engine Optimization (SEO) for a [WEBSITE]
Example
Give an example "head" section of the HTML code that is optimized for Search Engine Optimization (SEO) for a social networking site for athletes
Comment Code
Write comments for the code below: [CODE SNIPPET]
JSDoc Comments
Write JSDoc comments for the below JavaScript function: [CODE SNIPPET]
Shell Command Creation
Write a shell command to [REQUIREMENT]
Example
Write a shell command to delete all files with the extension '.log' in the 'logs' folder>
Git Command Creation
Write a git command to [requirement]
Example
Write a git command to undo the previous commit
Code Modification
Code Completion
Complete the code [PROMPT]
Code Conversion
Convert the below code snippet from [LANGUAGE/ FRAMEWORK] to [ANOTHER LANGUAGE/ FRAMEWORk]: [CODE SNIPPET]
Example
Convert the below code snippet from JavaScript to TypeScript [PASTE CODE SNIPPET]
CSS Framework Conversion
Convert the below code using [CSS framework] to use [CSS FRAMEWORK]: [CODE SNIPPET]
Example
Convert the below code using Bootstrap to use Tailwind CSS: [CODE SNIPPET]
Checking Code from Internet
What does this code do: [accepted answer code from stack overflow]
Refactor for Error Handling and Resilience
Refactor the given code to improve its error handling and resilience: [CODE BLOCK]
Refactor for Modularity
Refactor the given code to make it more modular: [CODE BLOCK]
Refactor for Performance
Refactor the given code to improve performance: [CODE BLOCK]
Refactor for Responsiveness
Refactor the below component code to be responsive across mobile, tablet, and desktop screens: [CODE BLOCK]
Refactor Variable Names
Suggest descriptive and meaningful names for variables and functions, making it easier to understand the purpose of each element in your code: [CODE SNIPPET]
Simplify Complex Conditionals
Suggest ways to simplify complex conditionals and make them easier to read and understand: [CODE SNIPPET]
Fix Error in Code
I am getting the error [error] from the following snippet of code: [CODE SNIPPET]. How can I fix it?
Generate RegEx Expression
Your role is to generate regular expressions that match specific patterns in text. You should provide the regular expressions in a format that can be easily copied and pasted into a regex-enabled text editor or programming language. Generate a regular expression that matches [text].
System Design and Architecture
System Design by Stack
You are an expert at system design and architecture. Tell me how to design a [system]. The technology stack is [COMMA-SEPARATED LIST OF TECHNOLOGIES].
Example
You are an expert at system design and architecture. Tell me how to design a hotel reservation system. The technology stack is Next.js and Firebase.
Contrast Design and Architecture
Contrast the design and architecture with [COMMA-SEPARATED LIST OF TECHNOLOGIES] as the technology stack.
Example
Contrast the design and architecture with React and Supabase as the technology stack.
Determining Frameworks and Libraries for Stack
What testing frameworks or libraries should I choose for a [STACK]?
Example
What testing frameworks or libraries should I choose for a React Native app?
Steps to Create Project by Requirements
What are the steps to create a [technology/ framework] blog app with the following requirements? 1. A listing page of all articles 2. A detail page where you can read the article 3. An about me page 4. Links to social media profiles 5. Performant
Code Improvement
What are the different ways to improve the [QUALITY] of a [PROJECT]?
Example
What are the different ways to improve the performance of a website
Checking Code
Code Smell Check
Review the following code for code smells and suggest improvements: [CODE BLOCK]
Check Code for Vulnerabilities
Identify any security vulnerabilities in the following code: [CODE SNIPPET]
Find Bugs in Code
Find any bugs in the following code: [CODE SNIPPET]
Testing Code
Mock Data Generation
Generate a sample [DATA FORMAT] of [NUMBER] [ENTITY] for a [DOMAIN]
Examples
Generate a sample JSON of 5 products for a clothing e-commerce site
Give me a list of [number] fields for [entity] on an e-commerce site
Add an “id” field that will be unique to each [entity]. Replace [existing field] with [new field]
Generate a sample [data format] of [number] such [entity] with realistic value
Tests by Library or Framework
Write unit tests for the following [LIBRARY/ FRAMEWORK] component [COMPONENT CODE] using [TESTING FRAMEWORK/ LIBRARY]
Enumerate Test Cases
Generate a list of test cases to manually test user registration in a [APPLICATION].
Explain Code
Code Explanation
Explain the following snippet of code: [PROMPT]
Command Explanation
Explain the following command [COMMAND]
Example
Explain the following command [git switch -c feat/qwik-loaders]
Explain RegEx
Explain this regular expression: [regex]
Example
Explain this regular expression in JavaScript: const regex = /^[A-Za-z0–9._%+-]+@[A-Za-z0–9.-]+\\.[A-Za-z]{2,}$/;