Copilot Best Practices (What Not To Do)

Visual Studio Code
29 Feb 202408:43

Summary

TLDRThe video provides best practices for using Copilot efficiently. Key points include not letting Copilot entirely control coding without oversight, using inline prompts and chat features appropriately, leveraging existing slash commands before creating new prompts, clearly establishing context so Copilot suggestions are relevant, and providing feedback to help Copilot improve over time. The goal is for developers to maximize Copilot's capabilities as an assistant while retaining responsibility as the pilot directing the coding.

Takeaways

  • 😀 Copilot is meant to assist, not fully replace the developer
  • 👩‍💻 Review Copilot's code suggestions instead of blindly accepting them
  • ✈️ You are the pilot, Copilot is the copilot - it should support you, not fly the plane
  • ⚙️ Use the right Copilot features for the task, like inline chat for code prompts
  • 🔀 Don't recreate existing prompts - use slash commands for fixes and explanations
  • 🗺️ Keep relevant code selected and remove off track chat history to help Copilot's context
  • 📄 Add project files to give Copilot workspace context
  • 🔙 Use up arrow in chat to reuse previous prompts
  • 👍 Use thumbs up/down and report issues to improve Copilot over time
  • ✅ Check out more Copilot best practice videos to optimize usage

Q & A

  • What is the main purpose of Copilot?

    -Copilot is meant to be an assistant that helps developers write code faster and better by providing relevant code suggestions.

  • What are some things you should not do with Copilot?

    -You should not let Copilot write full programs on its own without reviewing the code it produces. You should also not misuse Copilot's prompting tools or forget about context when asking it questions.

  • Why is it important to review Copilot's code suggestions?

    -Copilot does not always produce correct, optimal, or secure code so it's important for developers to review everything Copilot generates before using it.

  • What is the best way to prompt Copilot when you are within code?

    -When within code, you should use inline chat to prompt Copilot rather than comments, as inline chat is more efficient.

  • How can you improve Copilot's context when conversing with it?

    -You can delete previous off-track questions, highlight code you want to ask about, and add relevant files to your project.

  • How can you navigate previous questions you asked Copilot?

    -When your cursor is at the bottom of the chat panel, you can hit the up arrow key to access your previous questions to Copilot.

  • What feedback features does Copilot have?

    -Copilot has thumbs up/thumbs down buttons to rate suggestions and an option to report issues to help it improve over time.

  • What are some common slash commands in Copilot?

    -Some common slash commands are 'fix' to fix problems in code, 'explain' to get explanations of code, and 'test' to generate tests.

  • Why should you avoid recreating prompts?

    -You should first check if a prompt already exists using the slash commands before manually recreating a prompt to be more efficient.

  • What Copilot agent is aware of your workspace context?

    -The '@workspace' agent knows details about your current project files and workspace to provide better solutions.

Outlines

plate

此内容仅限付费用户访问。 请升级后访问。

立即升级

Mindmap

plate

此内容仅限付费用户访问。 请升级后访问。

立即升级

Keywords

plate

此内容仅限付费用户访问。 请升级后访问。

立即升级

Highlights

plate

此内容仅限付费用户访问。 请升级后访问。

立即升级

Transcripts

plate

此内容仅限付费用户访问。 请升级后访问。

立即升级
Rate This

5.0 / 5 (0 votes)

您是否需要英文摘要?