Copilot はコードの学習に役立つか?
はい。 Copilot は、コーディング体験を通じて変化するニーズに適応できます。 経験豊富な開発者は、Copilot をコーディング アシスタントとして使用できます。 コーディングを学んでいる間は、それはサポート コンパニオンとしていっそう有益です。
このガイドでは、コードの自動作成に利用するのではなく、プログラミング概念の理解を深めるのに役立つ家庭教師として機能するように、Copilot を設定する方法について説明します。 学習を最適なものにするには、作業するリポジトリごとに以下の手順を行います。
前提条件
このガイドは、VS Code で Copilot を使うことを前提に書かれています。 セットアップについては、Visual Studio Code のドキュメントで VS Code での Copilot の設定に関する記事をご覧ください。
ステップ 1: コード補完を無効にする
最初に、コード補完を無効にしましょう。 このようにすると、自分で記述するコードが増えて、プログラミングの概念の理解を深める機会が得られます。
-
VS Code でプロジェクトを開きます。
-
ルート ディレクトリに
.vscode
という名前のフォルダーを作成します。 -
.vscode
内に、settings.json
という名前のファイルを作成します。 -
ファイルに次のテキストを追加します。
JSON { "github.copilot.enable": { "*": false } }
{ "github.copilot.enable": { "*": false } }
-
ファイルを保存します。 現在、VS Code のこのプロジェクトでは、Copilot のコード補完は無効になっています。
ステップ 2: 学習の指示を追加する
次に、学習をサポートする家庭教師のように動作するよう、Copilot Chat に指示を提供しましょう。
-
プロジェクトのルート フォルダーに、
copilot-instructions.md
という名前のファイルを作成します。 -
次のテキストを追加するか、個人の学習目標に合わせてそれをカスタマイズします。
Markdown I am learning to code. You are to act as a tutor; assume I am a beginning coder. Teach me coding concepts and best practices, but do not provide solutions. Explain code conceptually and help me understand what is happening in the code without giving answers. Do not provide code snippets, even if I ask you for implementation advice in my prompts. Teach me all the basic coding concepts in your answers. And help me understand the overarching approach that you are suggesting. Whenever possible, share links to relevant external documentation and sources of truth. At the end of every response, add "Always check the correctness of AI-generated responses."
I am learning to code. You are to act as a tutor; assume I am a beginning coder. Teach me coding concepts and best practices, but do not provide solutions. Explain code conceptually and help me understand what is happening in the code without giving answers. Do not provide code snippets, even if I ask you for implementation advice in my prompts. Teach me all the basic coding concepts in your answers. And help me understand the overarching approach that you are suggesting. Whenever possible, share links to relevant external documentation and sources of truth. At the end of every response, add "Always check the correctness of AI-generated responses."
-
ファイルを保存します。 Copilot は、Copilot Chat で質問するときに、これらの指示を使います。
ステップ 3: Copilot Chat を使用して学習する
Copilot の助けを借りて、実際のコーディング スキルの向上を始める準備ができました。
プロジェクトでの作業全体を通し、長い時間をかけて Copilot Chat と対話します。 それを個人の家庭教師として扱い、わからないことがあったら質問し、それを使って課題に取り組んだり、概念を明確にしたりします。
Tip
キーボード ショートカットで Copilot Chat を開くことができます: Ctrl + Alt + I (Windows/Linux) または Command + Shift + I (Mac)。
Copilot Chat は、コードのデバッグに特に役立ちます。 詳細な手順のガイダンスについては、「GitHub Copilot を使ったデバッグ方法」をご覧ください。