GitHub Copilot CLI のカスタムスラッシュコマンドを自作してみる GitHub Copilot CLI のカスタムスラッシュコマンドを自作してみる
登壇してお話しました .NETラボ 勉強会 2026年6月 で 「GitHub Copilot CLI のスラッシュコマンドを自作してみる」 というタイトルでお話しました. アーカイブ もあります. 資料はこちら. https://spea
GitHub Copilot CLI で独自の「スラッシュコマンド」を自作する方法を紹介する記事が公開された。これは .NETラボ 勉強会 2026年6月での登壇内容をまとめたもので、ターミナル上での AI 活用を一段と効率化する手法として注目される。発表資料とアーカイブ動画もあわせて公開されている。
GitHub Copilot CLI は、コードエディタに統合された従来の Copilot とは異なり、コマンドラインから直接 AI とやり取りできるツールである。ファイルの読み書きやコマンド実行を伴うエージェント的な作業を、ターミナルを離れずに完結できる点が特徴だ。その操作の中で頻繁に使われるのが、先頭に「/」を付けて呼び出すスラッシュコマンドである。
スラッシュコマンドには、あらかじめ用意された組み込みのものに加えて、ユーザーが独自に定義できるカスタムコマンドの仕組みが備わっている。多くの場合、Markdown 形式のファイルにプロンプトや手順を記述しておくことで、定型的な指示を短いコマンド一つで呼び出せるようになる。たとえばコードレビューやテスト生成、コミットメッセージの作成といった繰り返し作業を、毎回同じ長文を入力することなく実行できるようになると考えられる。
こうしたカスタムコマンドの考え方は、Copilot CLI に固有のものではない。Anthropic の Claude Code をはじめ、近年のターミナル系 AI コーディングツールでは、プロジェクト固有のワークフローを再利用可能な形でまとめる機能が広く取り入れられている。チーム内でコマンド定義を共有すれば、作業の標準化や属人化の解消にもつながると見られる。
GitHub Copilot 自体は機能追加の頻度が高く、CLI まわりの仕様も今後変化する可能性がある。カスタムコマンドを業務に組み込む際には、まず小さな定型作業から試し、公式ドキュメントで最新の挙動を確認しながら運用していくのが現実的だろう。登壇資料は実際に手を動かしながら理解を深める入り口として役立ちそうだ。
GitHub Copilot CLI brings GitHub's AI assistant into the terminal, and among its extensibility features is support for custom slash commands. A recent Japanese-language blog post, drawn from a talk delivered at the .NET Lab study group in June 2026, demonstrates how developers can author their own slash commands to reduce repetitive typing and standardize common workflows. The author has also published the presentation slides and an archived recording, making the post a useful entry point for anyone exploring the tool.
Slash commands are short instructions prefixed with a forward slash that invoke predefined behavior inside an interactive session. GitHub Copilot CLI ships with a set of built-in commands for tasks such as managing the session, adjusting settings, or clearing context. Custom slash commands build on this pattern by letting users define their own reusable prompts, so that a frequently used instruction—say, generating a commit message, reviewing a diff, or scaffolding a test—can be triggered with a single keyword rather than retyped each time.
In practice, a custom command typically pairs a name with a block of natural-language instructions that the model receives when the command is invoked. This approach treats prompts as reusable assets that can be version-controlled alongside a project, shared across a team, and refined over time. Because the command body is essentially text, it can also include placeholders or arguments, allowing a single command to adapt to different inputs without rewriting the underlying prompt.
The appeal of this model is consistency. Teams that rely on AI assistance often develop informal conventions for how they phrase requests, and small differences in wording can produce noticeably different results. By encoding those conventions into named commands, a team can ensure that everyone benefits from the same well-tested prompt, and that institutional knowledge about effective prompting is captured rather than lost. It also lowers the barrier for newer contributors, who can use a command without needing to understand every detail of the prompt behind it.
This pattern is not unique to GitHub Copilot CLI. Similar custom-command mechanisms appear in other agentic coding tools, including Anthropic's Claude Code, which stores user-defined commands as Markdown files, and various editor integrations that expose reusable prompt snippets. The convergence suggests that the industry is settling on a shared mental model: the terminal or editor becomes a host for a library of parameterized prompts, much as shell aliases and scripts have long served to automate repetitive command-line work. Viewed this way, custom slash commands are a natural extension of established developer habits rather than an entirely new concept.
It is worth situating GitHub Copilot CLI within GitHub's broader push to move Copilot beyond inline code completion. Over the past several releases, GitHub has added chat interfaces, agent-style features capable of multi-step tasks, and deeper integration with the command line and pull-request workflows. The CLI in particular targets developers who prefer to stay in the terminal, where an assistant can read files, run commands, and respond to questions without context switching to a separate application. Custom slash commands fit this direction by making the tool more adaptable to individual and team-specific needs.
For readers who want to experiment, the prerequisites are modest: a GitHub account with access to Copilot, the CLI installed and authenticated, and familiarity with the terminal. From there, defining a first command is largely a matter of writing clear instructions and choosing a memorable name. As with any AI-assisted workflow, the output still warrants review, and commands that touch source code or run shell operations should be tested carefully before being relied upon.
The talk and its accompanying materials appear aimed at practitioners who already use Copilot and want to get more out of it. While the specifics of command syntax and configuration may evolve as GitHub iterates on the CLI, the underlying idea—capturing repeatable prompts as named, shareable commands—is likely to remain a durable part of how developers work with terminal-based AI assistants.
本ページの本文・要約は AI による自動生成です。正確性は元記事 (zenn.dev) をご確認ください。