筆者プロフィール: ソフトウェアエンジニア。「知った気にならない。いつまでも学び続ける」を信条に、業務と個人開発の両輪で技術を磨いています。AI 駆動開発で複数の個人開発アプリを構築・運用中。
👉 ポートフォリオ: 筆者ホームページ
この記事は約4分で読めます。
Claude Code には Web 版・API 版にはない強力な機能が多数あります。 Claude Code 公式ベストプラクティスから、Skills / Subagents / Hooks / Auto Mode など使い分けが重要な機能を整理します。連載「Claude プロンプト術 完全ガイド」の第5回です。
1. Claude Code 固有機能 一覧 🟡
公式が紹介する主要機能:
| 機能 | 用途 | 公式コマンド |
|---|---|---|
/init |
プロジェクトから CLAUDE.md の雛形を生成 | /init |
| Skills | ドメイン知識・繰り返し作業を .claude/skills/ に定義 |
.claude/skills/SKILL.md |
| Subagents | 専門タスクを別コンテキストで実行 | .claude/agents/*.md |
| Hooks | 特定タイミングで自動実行するスクリプト | .claude/settings.json |
| Plugins | Skills/Hooks/Subagents/MCP のバンドル | /plugin |
| MCP servers | 外部ツール連携(Notion, Figma, DB 等) | claude mcp add |
| Auto mode | 分類器が安全性を判定、承認プロンプトを削減 | --permission-mode auto |
🟢 Hooks の特徴(公式明言)
Unlike CLAUDE.md instructions which are advisory, hooks are deterministic and guarantee the action happens.
CLAUDE.md は推奨、Hooks は決定的 という役割分担。「必ず実行する」ことは Hooks で。
2. Claude に質問させる(逆インタビュー)🟢
For larger features, have Claude interview you first. Start with a minimal prompt and ask Claude to interview you using the
AskUserQuestiontool.
🟡 公式のプロンプト例
I want to build [brief description]. Interview me in detail using the AskUserQuestion tool.
Ask about technical implementation, UI/UX, edge cases, concerns, and tradeoffs. Don't ask obvious questions, dig into the hard parts I might not have considered.
Keep interviewing until we've covered everything, then write a complete spec to SPEC.md.
大きな機能は Claude に逆インタビューさせる のが公式の推奨。要件定義の抜け漏れを Claude が発見してくれます。
3. サブエージェントで調査を分離する 🟢
🟢 公式の戦略
Since context is your fundamental constraint, subagents are one of the most powerful tools available. When Claude researches a codebase it reads lots of files, all of which consume your context. Subagents run in separate context windows and report back summaries.
🟡 使い方(公式例)
Use subagents to investigate how our authentication system handles token refresh, and whether we have any existing OAuth utilities I should reuse.
サブエージェントは別コンテキストで動くため、メイン会話のコンテキストを汚さずに調査できます。
4. Writer/Reviewer パターン 🟢
🟢 公式の推奨
A fresh context improves code review since Claude won't be biased toward code it just wrote.
同一 Claude がレビューすると自分のコードに肯定的になるバイアス があるため、別セッションでレビューさせる。
🟡 公式のパターン例
| Session A (Writer) | Session B (Reviewer) |
|---|---|
Implement a rate limiter for our API endpoints |
|
Review the rate limiter implementation in @src/middleware/rateLimiter.ts. Look for edge cases, race conditions, and consistency with our existing middleware patterns. |
|
Here's the review feedback: [Session B output]. Address these issues. |
5. 非対話モードで自動化 🟢
🟡 公式の使い方
# ワンショットクエリ
claude -p "Explain what this project does"
# JSON 出力(スクリプト連携)
claude -p "List all API endpoints" --output-format json
# ストリーミング出力
claude -p "Analyze this log file" --output-format stream-json
CI パイプラインや pre-commit hook に組み込めます。
6. 避けるべきアンチパターン 🟢(公式明記)
公式が "Common failure patterns" として明記しているもの:
| アンチパターン | 症状 | 公式の対策 |
|---|---|---|
| Kitchen sink session | 1セッションで無関係タスクを混ぜる | タスク切替時に /clear
|
| Correcting over and over | 同じ指摘を繰り返す | 2回失敗したら /clear して改善プロンプトで再開 |
| Over-specified CLAUDE.md | CLAUDE.md が長すぎて無視される | 容赦なく刈り込む |
| Trust-then-verify gap | 動きそうで動かないコード | 必ず検証手段を提供、できないなら出荷しない |
| Infinite exploration | スコープなしの調査で context 消費 | スコープを切るか、サブエージェントを使う |
7. Claude Opus 4.7 固有の注意点 🟢
🟢 effort パラメータ(公式推奨)
Start with the new
xhigheffort level for coding and agentic use cases, and use a minimum ofhigheffort for most intelligence-sensitive use cases.
| effort | 用途 |
|---|---|
max |
高負荷タスク。過剰思考のリスクあり |
xhigh(新) |
コーディング・エージェントの推奨デフォルト |
high |
バランス重視。知識タスクの最低ライン |
medium |
コスト重視、知能とのトレードオフ |
low |
短時間タスク・低レイテンシ要件 |
🟢 より文字通りの指示解釈(公式明言)
Claude Opus 4.7 interprets prompts more literally and explicitly than Claude Opus 4.6, particularly at lower effort levels. It will not silently generalize an instruction from one item to another.
「1箇所に適用した指示を他にも自動適用する」挙動が減った ため、スコープを明示する必要があります。
8. 🔵 コスト削減優先度ランキング(筆者解釈)
⚠️ 以下は筆者の解釈です。公式は各施策の効果量を定量比較していません。
| 優先度 | 施策 | 根拠 |
|---|---|---|
| ⭐⭐⭐ | 検証手段(テスト・スクショ)を提供 | 公式が "the single highest-leverage thing" と明言 🟢 |
| ⭐⭐⭐ |
/clear をタスク切替で実行 |
公式が "the most important resource to manage" と明言 🟢 |
| ⭐⭐⭐ | Explore → Plan → Code の順守 | 公式が "recommended workflow" として提示 🟢 |
| ⭐⭐ | サブエージェントで調査を分離 | 公式が "one of the most powerful tools" と表現 🟢 |
| ⭐⭐ |
@ でファイル参照 |
トークン効率が良い(筆者の推論 🔵) |
| ⭐⭐ | CLAUDE.md を 150 行以内に刈り込む | 公式が "bloated files cause Claude to ignore" と警告 🟢 |
| ⭐ | XML タグで構造化 | 複雑プロンプトで効果的(公式記述 🟢) |
| ⭐ | effort パラメータを調整 | コスト vs 知能の明示的なトレードオフ 🟢 |
まとめ — 機能の使い分け早見表
| やりたいこと | 使う機能 |
|---|---|
| プロジェクトの永続ルール | CLAUDE.md |
| 必ず実行する処理 | Hooks |
| 繰り返し使う手順 | Skills |
| 別コンテキストで専門タスク | Subagents |
| 大きな機能の要件定義 | AskUserQuestion |
| 承認プロンプトを減らす | Auto Mode |
| CI への組み込み | 非対話モード (claude -p) |
次回予告
次回は Claude プロンプト 思考編13パターン。情報収集・学習・意思決定など頭を使うタスクで、思考の質を上げるプロンプト例を紹介します。
参考(一次ソース)
関連記事(連載「Claude プロンプト術 完全ガイド」全8回)
- 第1回: Claude プロンプト最重要3原則
- 第2回: Claude 開発ワークフロー
- 第3回: Claude プロンプト 開発編11パターン
- 第4回: Claude に伝わる指示の書き方
- 第5回(本記事): Claude Code 固有機能の使い分け
- 第6回: Claude プロンプト 思考編13パターン
- 第7回: Claude プロンプト 日常編18パターン
- 第8回: Claude プロンプト術 完全ガイド — 全記事まとめ