Skip to main content

Getting started with prompts for Copilot Chat

Get an overview of ways to use Copilot Chat.

You can ask Copilot Chat specific questions about your project or general software questions. You can also ask Copilot Chat to write code, fix errors, write tests, and document code.

Use the tabs above to select the environment where you are using Copilot Chat.

Some of the example prompts require you to be in a specific context on the GitHub website. For more information on how to access those contexts, see Asking Copilot Chat questions in different contexts.

Ask general software questions

You can ask Copilot Chat general software questions. For example:

  • tell me about nodejs web server frameworks
  • how to create an express app
  • what is the best way to update an npm package

Ask questions about a repository

You can ask Copilot Chat questions about a repository. For example:

  • what is the purpose of this repository?
  • When was the most recent release?
  • Where is rate limiting implemented in our API?
  • What was the last merged PR by USERNAME

Ask questions about a specific file or symbol

You can ask Copilot Chat questions about a specific file or symbol. For example:

  • what sorting algorithm does this function use
  • how are these files related
  • what is the purpose of this function

Ask questions about a knowledge base

You can ask Copilot Chat questions about a knowledge base. For example:

  • How do I deploy a new application?
  • What's the process for creating a new REST API?
  • What are our best practices for logging?

Ask questions about a specific piece of code

You can ask Copilot Chat questions about a specific piece of code. You might ask a question about a whole file, or a specific line. For example:

If you are asking about a whole file, you could enter:

  • Explain this file.
  • How could I improve this code?
  • How can I test this script?

If you are asking about specific lines, you could enter:

  • Explain the function at the selected lines.
  • How could I improve this class?
  • Add error handling to this code.
  • Write a unit test for this method.

Ask questions about GitHub Advanced Security alerts

You can ask Copilot Chat questions about security alerts in repositories in your organization from GitHub Advanced Security features (code scanning, secret scanning, and Dependabot alerts). For example:

  • How would I fix this alert?
  • How many alerts do I have on this pull request?
  • Which line of code is this code scanning alert referencing?
  • What library is affected by this Dependabot alert?

Ask Copilot Chat questions in a pull request

You can ask Copilot Chat questions in a pull request. Your question could relate to various elements of the pull request For example:

You might ask for a summary of the changes in the pull request:

  • Summarize this PR for me.
  • Summarize the comments in this PR.
  • Summarize the changes in this PR.

You might ask about the changes in a specific file in the pull request:

  • What's the purpose of this file?
  • Why has this module been included?

You might ask about the changes in a specific line in the pull request:

  • What is "actorData" in this line?
  • Explain this "do..end" block.

You might ask why a workflow failed:

  • Tell me why this job failed
  • Suggest a fix for this error

Ask Copilot Chat questions about a specific issue or discussion

You can ask Copilot Chat questions about a specific issue or discussion. For example:

  • what is the purpose of this issue?

Ask Copilot Chat questions about a specific commit

You can ask Copilot Chat questions about a specific commit. For example:

  • what is the purpose of this commit?
  • what is the expected output of this commit?
  • what is the best way to test this commit?