現已釋出!閱讀關於 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.react.dev/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.