0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Copilotの再利用可能なプロンプト機能を試した雑記録

Posted at

はじめに

mainブランチでブランチを切らずに作業していた時にブランチ作成→コミットまでをAIで良い感じに出来そうだなと思って試した雑記事です🙇‍♂️

VSCodeのバージョン1.100で変わった再利用可能なプロンプト機能(機能名間違っているかも)を使いました

再利用可能なプロンプト機能とは

少し前からVSCodeのGitHub Copilotで追加されていた機能です

元々はワークスペースの .github/prompts ディレクトリに *.prompt.md ファイルを置くと、Copilot Chatのコンテキストとして選択できるみたいな機能でした

(プロンプトファイルを置く場所は chat.promptFilesLocations で指定可能)

それがVSCodeのバージョン1.100から大幅に変わりました

実行可能なツールやモードを指定できたり、添付画像のような実行ボタンが追加されたりなど

image.png

実際に試した例

以下のように使用するモードや実行可能なツール、やらせたいタスクを記述します

ちなみに⇧⌘P → Chat: New Prompt File を実行するとファイルを作るのが楽になります

---
mode: 'agent'
tools: ['git_status', 'git_diff_unstaged', 'git_diff_staged', 'git_diff', 'git_commit', 'git_add', 'git_log', 'git_create_branch', 'git_checkout', 'git_show']
description: 'ブランチを作成し、チェックアウトし、差分をコミットします。'
---

あなたはGitの扱いに長けたエンジニアです。以下のタスクを実行してください。指示を仰がずに、すべてのステップを自動的に実行してください。

## タスク
1. 現在の差分に基づいてブランチ名を提案し、そのブランチを作成します。
2. 作成したブランチにチェックアウトします。
3. 現在の差分を `git add` します。
4. 現在の差分に基づいて、日本語のコミットメッセージを提案し、`git commit` します。

▶️ボタンをクリックしたらCopilotが動いてチャットに反映されていきます

image.png

感想

簡単な例ですが思い通りに行って嬉しかったのと、しっかり作ればかなり便利に使えそうだなと思いました!

PATをあまり発行したくなくて、GitHub MCPは使わなかったですが、一緒に使えば PR作成までできて便利だろうなと思います

少しでも参考になれば幸いです!

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?