AI Coding Use Case Prompts
GitHub Copilot for Take-Home Interview Challenges
GitHub Copilot can significantly aid in take-home technical interview challenges by providing implementation ideas and actual code snippets. While its use is beneficial, be prepared to explain and defend your solutions during follow-up interviews. Copilot serves as a coding ally, enhancing productivity and offering diverse approaches to problem-solving.
Prompt Examples
Generate code in Python to solve the following challenge: Write a function that takes a list of integers and returns the list sorted in ascending order without using built-in sort functions.
Generate code in JavaScript to solve the following challenge: Implement a function that accepts a string and returns the first non-repeating character in the string.
Generate code in Java to solve the following challenge: Create a program that reads a text file and counts the frequency of each word, then outputs the top ten most frequent words.
Prompt Template
Generate code in [desired language] to solve the following challenge:
[outline of the challenge to be solved]
GitHub Copilot for File Format Conversion
Converting file formats, such as XML to JSON, is a common task in daily workflows involving reference data or payloads from data providers. GitHub Copilot can expedite this process by generating scripts for instant conversion, saving time and effort compared to using online tools or manual scripting.
Prompt Examples
Convert this XML to JSON.
Convert this CSV to JSON.
Convert this YAML to JSON.
Prompt Template
Convert this [current file format] to [new file format].
GitHub Copilot for Generating Test Data
Generating dummy data to test code can be time-consuming, whether done manually or through scripting. GitHub Copilot can streamline this process by quickly generating the necessary data, allowing developers to focus on other tasks.
Prompt Examples
Generate SQL insert statements to populate the following tables with 100 entries of dummy data.
Generate SQL insert statements to populate the users table with 50 entries of dummy data, including name, email, and age fields.
Generate SQL insert statements to populate the orders table with 200 entries of dummy data, ensuring that each entry includes order ID, user ID, product ID, quantity, and order date.
Prompt Template
Generate SQL insert statements to populate the following tables with [number of entries] entries of dummy data [requirements for the data to be generated].
GitHub Copilot for Generating Regexes and Other Hard Syntax
Writing complex syntactical expressions, such as regular expressions or cron expressions, is often a cumbersome task for developers. GitHub Copilot can simplify this process by generating these expressions quickly and accurately, making it more efficient than using traditional online tools.
Prompt Examples
Create variable to store a regex to match an email address format.
Create variable to store a cron expression to schedule a job to run every Monday at 9 AM.
Create variable to store a regex to validate a US phone number format.
Prompt Template
Create variable to store [item with hard syntax you need] to match [what you need it to match described in natural language].
GitHub Copilot for Writing Test Cases
Due to tight deadlines, developers often compromise on test coverage. GitHub Copilot can assist by generating unit test cases for newly written functions, allowing developers to review and make necessary corrections before submitting a pull request. This ensures better test coverage and improved delivery standards.
Prompt Examples
Write unit tests for edge cases and typical usage scenarios on the code selected. You should follow the company's unit testing guidelines. Your tests should be written in Python using the pytest framework.
Write unit tests for error handling and boundary conditions on the code selected. You should follow best practices for unit testing. Your tests should be written in JavaScript using the Jest framework.
Write unit tests for performance and reliability on the code selected. You should follow TDD principles. Your tests should be written in Java using the JUnit framework.
Prompt Template
Write unit tests for [cases to be tested] on the code selected. You should follow [unit testing guidelines to follow]. Your tests should be written in [language and framework to be used].
GitHub Copilot for Code Review
Code review cycles can be lengthy and cause frustrating context switching. Utilizing GitHub Copilot as a preliminary code reviewer before opening a pull request can streamline the process. Copilot can identify areas for improvement and suggest enhanced versions of your code, reducing lead times and improving code quality.
Prompt Examples
I'm opening a Pull Request with the code below. Write a code review for it, focusing on performance optimization.
I'm opening a Pull Request with the code below. Write a code review for it, focusing on code readability and maintainability.
I'm opening a Pull Request with the code below. Write a code review for it, focusing on adherence to coding standards and best practices.
Prompt Template
I'm opening a Pull Request with the code below. Write a code review for it, focusing on [what the code review should focus on].
GitHub Copilot for Refactoring Code
Refactoring code is essential for updating framework versions or translating code into a different language. GitHub Copilot can assist by rewriting code snippets according to specified preferences, making the transition smoother and more efficient.
Prompt Examples
Refactor the code snippet highlighted to Python, using the latest version of the pandas framework.
Refactor the code snippet highlighted to Java, ensuring it adheres to Spring Boot conventions.
Refactor the code snippet highlighted to C#, using .NET 5 framework standards.
Prompt Template
Refactor the code snippet highlighted to [language, framework and any other preferences for the refactored code].
[code you want to be refactored]
GitHub Copilot for Helping with Console Errors
Dealing with console errors can be time-consuming and frustrating, especially when the error messages are not immediately clear. GitHub Copilot can assist by analyzing the stack trace and providing insights and solutions to fix the issues, streamlining the debugging process.
Prompt Examples
The code highlighted is generating the following console error when I run it. What's the error about, and how can I fix it?
Uncaught TypeError: Cannot read property 'foo' of undefined at Object.<anonymous> (script.js:10)The code highlighted is generating the following console error when I run it. What's the error about, and how can I fix it?
AttributeError: 'NoneType' object has no attribute 'bar' at line 20 in main.pyThe code highlighted is generating the following console error when I run it. What's the error about, and how can I fix it?
Exception in thread "main" java.lang.NullPointerException at MyClass.method(MyClass.java:15)
Prompt Template
The code highlighted is generating the following console error when I run it. What's the error about, and how can I fix it?
[paste the console stack trace of the error]
GitHub Copilot for Finding Bugs in Code
Bug tracking and fixing are significant parts of a software developer's job. GitHub Copilot can streamline this process by identifying issues in the code based on the described functionality, thereby reducing the time spent on debugging.
Prompt Examples
Find the bug in the code highlighted. This is what it should be doing: Sorting an array of integers in ascending order.
Find the bug in the code highlighted. This is what it should be doing: Fetching user data from an API and displaying it in a list format.
Find the bug in the code highlighted. This is what it should be doing: Calculating the total price of items in a shopping cart, including applicable discounts and taxes.
Prompt Template
Find the bug in the code highlighted. This is what it should be doing:
[requirements to be fulfilled]
GitHub Copilot for Explaining Code
Understanding undocumented code, especially when the original developer is no longer available, can be challenging. GitHub Copilot can assist by providing clear explanations of code snippets, making it easier to grasp complex or poorly documented codebases.
Prompt Example
Explain the code snippet highlighted.
Prompt Template
Explain the code snippet highlighted.
GitHub Copilot for Generating Boilerplate Code
When starting a new project from scratch, creating the initial scaffolding can be time-consuming. GitHub Copilot can generate boilerplate code for your application, tailored to your specific requirements, technologies, frameworks, and versions, streamlining the setup process.
Prompt Examples
Generate boilerplate code for an app that integrates with Plaid to fetch and display bank account transactions. Please use Node.js and Express framework.
Generate boilerplate code for an app that serves as a blog platform with user authentication and CRUD operations. Please use Python and Django framework.
Generate boilerplate code for an app that provides weather forecasting features based on user location. Please use Java and Spring Boot framework.
Prompt Template
Generate boilerplate code for an app that [explain what you need this app to do]. Please use [explain what languages and frameworks should be used].
GitHub Copilot for Brainstorming Implementation Ideas
Brainstorming implementation ideas and evaluating tradeoffs between different approaches can be complex. GitHub Copilot can assist by providing insights and detailed explanations for various options, helping developers make informed decisions.
Prompt Example
I need to build the backend for an analytics dashboard. It will read data from several partners' API, in JSON format, crunch those into condensed data, and update data on the UI every minute. Should I use a relational or NoSQL database? Explain the tradeoffs.
Prompt Template
I need to build [explain the task’s requirements]. Should I [list the options you are considering]? Explain the tradeoffs.

