が利用可能になりました!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 のチャットを使用して、Web や 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?

ターミナルとコマンドラインタスク

ターミナルインラインチャットを使用して、シェルコマンドやターミナル操作に関するヘルプを得ることができます。

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

Jupyter Notebook との連携

VS Code のチャットを使用して、Jupyter Notebook を作成、編集、および操作することができます。

/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.