现已发布!阅读关于 11 月新增功能和修复的内容。

VS Code 中聊天提示示例

本文档提供了 Visual Studio Code 中聊天在不同场景和代理中的示例提示。请使用这些示例作为灵感,为您的开发任务制作有效的提示。

如果您是 VS Code 中聊天的新手,请了解更多关于开始使用聊天的信息,或查看制作提示的最佳实践

常规编码和技术问题

在 VS Code 中使用聊天快速了解编码概念、技术主题和一般编程问题。

What is a linked list?
Provide 3 ways to implement a search feature in React.
Explain the difference between async/await and promises.

理解和探索您的代码库

在 VS Code 中使用聊天来了解您的项目如何工作、查找特定功能或探索代码关系。

Explain how authentication works in #codebase
Where is the database connection string configured? #codebase
How do I build this #codebase?
Which testing framework is used for #calculator.test.js?

代码生成和编辑

在 VS Code 中使用聊天来生成新代码、添加功能或修改现有功能。

Add a login button and style it based on #styles.css
Create a meal-planning web app using React and Node.js
Refactor this code to use async/await

测试和质量保证

在 VS Code 中使用聊天来生成测试或修复失败的测试。

Add unit tests for the user service.
Fix the failing tests #testFailure

调试和修复问题

在 VS Code 中使用聊天来识别和修复代码中的问题。

Fix the issues in #problems
Fix the failing tests #testFailure
Why is this function returning undefined?

使用源代码管理

在 VS Code 中使用聊天来处理挂起的更改并生成发布文档。

Summarize the #changes
Generate release notes based on the #changes
Summarize the changes in #changes

使用外部资源

在 VS Code 中使用聊天来引用网页或 GitHub 存储库中的内容。

How do I use the 'useState' hook in react 18? #fetch https://18.reactjs.ac.cn/reference/react/useState#usage
Build an API endpoint to fetch address info, use the template from #githubRepo contoso/api-templates
What are the top #extensions for this workspace?

终端和命令行任务

使用终端内联聊天来获取 shell 命令和终端操作的帮助。

How do I install npm packages?
List the top 5 largest files in the src directory
undo the last git commit

使用 Jupyter 笔记本

在 VS Code 中使用聊天来创建、编辑和使用 Jupyter 笔记本。

/newNotebook use pandas and seaborn to read and visualize the titanic dataset. Show key information from the dataset.
Create a notebook to read data from #housing.csv and plot the distribution of prices
Make sure the data is cleaned before visualizing and processing it
Show the correlation between different features in the dataset

制作有效提示的技巧

  • 具体明确:提供您想要完成的任务、要使用的技术以及期望的输出格式的详细信息。
  • 添加上下文:使用 #-提及来引用文件、符号或上下文变量,例如 #codebase#changes#problems
  • 迭代:从一个简单的提示开始,并根据响应进行调整。提出后续问题以改进结果。
  • 分解复杂任务:不要一次性要求所有内容,而是将大型任务分解为更小、可管理的步骤。

了解更多关于制作提示的最佳实践为提示添加上下文的信息。

© . This site is unofficial and not affiliated with Microsoft.