バックエンドエンジニアの白坂です。
弊社ではClaude CodeのMaxプラン($100/月)を一部エンジニア向けに経費申請で利用できるようにしています。
今回は、Claude Codeのスラッシュコマンドについて、公式ドキュメントと実際の/helpコマンド出力、さらに裏側のプロンプト内容について記事にまとめます。
Claude Codeの組み込みスラッシュコマンド一覧(公式ドキュメント記載)
Claude Codeでは、インタラクティブセッション中にスラッシュコマンドで様々な操作ができます。
スラッシュコマンドは以下の通りです(2025年7月時点、公式ドキュメントより抜粋):
| コマンド | 目的 |
|---|---|
/add-dir |
追加の作業ディレクトリを追加 |
/bug |
バグを報告(会話をAnthropicに送信) |
/clear |
会話履歴をクリア |
/compact [instructions] |
オプションのフォーカス指示で会話をコンパクト化 |
/config |
設定の表示・変更 |
/cost |
トークン使用統計を表示 |
/doctor |
Claude Codeインストールの健全性をチェック |
/help |
使用方法のヘルプを取得 |
/init |
CLAUDE.mdガイドでプロジェクトを初期化 |
/login |
Anthropicアカウントを切り替え |
/logout |
Anthropicアカウントからサインアウト |
/mcp |
MCPサーバー接続とOAuth認証を管理 |
/memory |
CLAUDE.mdメモリファイルを編集 |
/model |
AIモデルを選択または変更 |
/permissions |
権限を表示または更新 |
/pr_comments |
プルリクエストコメントを表示 |
/review |
コードレビューをリクエスト |
/status |
アカウントとシステムのステータスを表示 |
/terminal-setup |
改行用のShift+Enterキーバインドをインストール(iTerm2/VSCodeのみ) |
/vim |
Vimモードと通常モードを切り替え |
/helpコマンドでのみ表示されるコマンド一覧
/helpコマンドを実行すると、公式ドキュメントに記載されていないスラッシュコマンドもいくつか表示されます。:
| コマンド | 目的・説明 |
|---|---|
/exit |
REPLを終了する |
/export |
現在の会話をファイルやクリップボードにエクスポート |
/hooks |
ツールイベント用のhook設定を管理 |
/ide |
IDE連携の管理やステータス表示 |
/install-github-app |
Claude GitHub Actionsをリポジトリにセットアップ |
/pr-comments |
GitHubプルリクエストのコメントを取得 |
/release-notes |
リリースノートを表示 |
/resume |
会話を再開 |
/upgrade |
Maxプランへのアップグレード(レート制限やOpus利用枠拡大) |
Claude Codeのログを見よう
先日行われた Claude Code Deep Dive 〜t-wada, mizchiとAgentic Codingの「今」を眺める〜 というイベントに参加したのですが、大変面白かったです。
このイベントでは、Claude Codeのサブエージェントや、スラッシュコマンド実行時に裏側でどんなプロンプトが投げられているのかが紹介されていました。
また、登壇者の方が作成したツールを使うと、Claude Codeのログを人間が見やすい形で確認できます。
スラッシュコマンドに渡されているプロンプト例
上記のツールを使って、実際にスラッシュコマンドを使った際、Claude CodeがどんなプロンプトをLLMに渡しているのかを見てみます。
スラッシュコマンドの一部のコマンドは自然言語で作業指示を渡しているため、ログから具体的にどのような指示を渡しているのかを確認できます。
/init
/initコマンドはプロジェクトで初めてClaude Codeを使用する際に実施することで、プロジェクトの概要をまとめてくれます。



/review
/reviewコマンドはPRの番号を引数に渡すとレビューしてくれます。
You are an expert code reviewer. Follow these steps:
1. If no PR number is provided in the args, use Bash("gh pr list") to show open PRs
2. If a PR number is provided, use Bash("gh pr view <number>") to get PR details
3. Use Bash("gh pr diff <number>") to get the diff
4. Analyze the changes and provide a thorough code review that includes:
- Overview of what the PR does
- Analysis of code quality and style
- Specific suggestions for improvements
- Any potential issues or risks
Keep your review concise but thorough. Focus on:
- Code correctness
- Following project conventions
- Performance implications
- Test coverage
- Security considerations
Format your review with clear sections and bullet points.
PR number: #119
/pr-comments
/pr-commentsは、PRの番号を引数に渡すと該当PRのコメントを出力してくれます。
You are an AI assistant integrated into a git-based version control system. Your task is to fetch and display comments from a GitHub pull request.
Follow these steps:
1. Use `gh pr view --json number,headRepository` to get the PR number and repository info
2. Use `gh api /repos/{owner}/{repo}/issues/{number}/comments` to get PR-level comments
3. Use `gh api /repos/{owner}/{repo}/pulls/{number}/comments` to get review comments. Pay particular attention to the following fields: `body`, `diff_hunk`, `path`, `line`, etc. If the comment references some code, consider fetching it using eg `gh api /repos/{owner}/{repo}/contents/{path}?ref={branch} | jq .content -r | base64 -d`
4. Parse and format all comments in a readable way
5. Return ONLY the formatted comments, with no additional text
Format the comments as:
## Comments
[For each comment thread:]
- @author file.ts#line:
```diff
[diff_hunk from the API response]
```
> quoted comment text
[any replies indented]
If there are no comments, return "No comments found."
Remember:
1. Only show the actual comments, no explanatory text
2. Include both PR-level and code review comments
3. Preserve the threading/nesting of comment replies
4. Show the file and line number context for code review comments
5. Use jq to parse the JSON responses from the GitHub API
Additional user input: #3666
このように一部のスラッシュコマンドは、実際にどのようなプロンプトが渡されているのかを確認することができます。
Claude CodeなどAIエージェントを使う際、一言で指示することもできますが、やはりこのような一定量のプロンプトを渡すことが重要なんだと感じました。
また、実際のプロンプト内容を見ることで、カスタムスラッシュコマンドやCLAUDE.mdファイルを作成する際の参考になりました。
どのような記載をすれば効果的に指示できるのかについて、いつも悩んでいたので今後参考にしていきたいです。
これらのプロンプトをベースにして、これからPRレビューのカスタムスラッシュコマンドをアレンジしていきたいと思っています。
参考リンク
まとめ
Claude Codeのスラッシュコマンドは、日々の開発やAIエージェント活用をより効率的にしてくれる便利な機能です。
公式ドキュメント(Anthropic公式ドキュメント)や、実際の/helpコマンド出力、そして裏側のプロンプト内容もぜひ参考にしてみてください。
次回は草間さんが「「PoCが進まない」を脱却!UXデザイナーがAIと共創する時代へ」をお届けする予定です!