Claude認定 対策ノート

講座 › 分野3 Claude Code

3.1 Claude Codeの操作

配点 3.1%Claude Code Operation

常に効かせたい事実はCLAUDE.md、手順はスキル、部分的な決まりはルール、任せる作業はサブエージェント。自動化は -p と出力形式で。

未読

コアコンポーネント:ルール・スキル・コマンド・エージェント・メモリ

図解:コアコンポーネント:ルール・スキル・コマンド・エージェント・メモリ

CLAUDE.mdには、毎回守ってほしい事実(ビルドのコマンド、決まり、構成)を書きます。特定のファイルの種類やフォルダだけに効かせたい決まりは、.claude/rules/ にルールとして分けます。何度も貼り付ける手順は、SKILL.mdを書いてスキルにします。スキルの本文は、使うときだけ読み込まれます。以前のカスタムコマンドは、スキルに統合されました。サブエージェントは、自分のコンテキストウィンドウと、専用のシステムプロンプトとツールの権限で動きます。オートメモリは、ユーザーの指摘や好みから、Claudeが自分で書くメモです。

出典:Memory (CLAUDE.md)
Rules let you scope instructions to specific file types or subdirectories.
https://code.claude.com/docs/en/memory.md(取得 2026-11-17)
出典:Skills
Create a skill when you keep pasting the same instructions, checklist, or multi-step procedure into chat
https://code.claude.com/docs/en/skills.md(取得 2026-11-17)
出典:Skills
Custom commands have been merged into skills.
https://code.claude.com/docs/en/skills.md(取得 2026-11-17)
出典:Subagents
Each subagent runs in its own context window with a custom system prompt, specific tool access, and independent permissions.
https://code.claude.com/docs/en/sub-agents.md(取得 2026-11-17)
出典:Memory (CLAUDE.md)
notes Claude writes itself based on your corrections and preferences
https://code.claude.com/docs/en/memory.md(取得 2026-11-17)

CLAUDE.mdの階層と初期化

図解:CLAUDE.mdの階層と初期化

作業フォルダより上の階層にあるCLAUDE.mdは起動時に読み込まれ、下の階層のものは必要になったときに読み込まれます。リポジトリで初めて使うときは /init を実行すると、Claudeがコードを調べて、ビルドやテストの方法を書いたCLAUDE.mdのたたき台を作ります。

出典:Memory (CLAUDE.md)
CLAUDE.md and CLAUDE.local.md files in the directory hierarchy above the working directory are loaded at launch. Files in subdirectories load on demand.
https://code.claude.com/docs/en/memory.md(取得 2026-11-17)
出典:Memory (CLAUDE.md)
Claude analyzes your codebase and creates a file with build commands, test instructions, and project conventions it discovers.
https://code.claude.com/docs/en/memory.md(取得 2026-11-17)

セッションの管理とスラッシュコマンド

図解:セッションの管理とスラッシュコマンド

/clear は、プロジェクトのメモリを残したまま新しい作業を始めます。/resume は以前の会話に戻ります。claude --continue は、そのフォルダの直近のセッションを開きます。/plan は大きな変更の前に計画モードに切り替え、/context はコンテキストを何が埋めているかを表示します。

出典:Commands
`/clear` starts fresh on a new task while keeping project memory.
https://code.claude.com/docs/en/commands.md(取得 2026-11-17)
出典:Sessions
Reopens the most recent session in the current directory
https://code.claude.com/docs/en/sessions.md(取得 2026-11-17)
出典:Commands
`/plan` switches into plan mode before a large change.
https://code.claude.com/docs/en/commands.md(取得 2026-11-17)

ヘッドレスモードとストリーミングの出力

図解:ヘッドレスモードとストリーミングの出力

claude に -p を付けると、対話なしで実行できます。CIやスクリプトに組み込むときに使います。出力の形式は、text(既定)、json(結果とセッションIDなど)、stream-json(1行ずつのJSONで、その場で流れてくる)から選べます。

出典:Headless mode
Add the `-p` (or `--print`) flag to any `claude` command to run it non-interactively.
https://code.claude.com/docs/en/headless.md(取得 2026-11-17)
出典:Headless mode
`stream-json`: newline-delimited JSON for real-time streaming
https://code.claude.com/docs/en/headless.md(取得 2026-11-17)

権限モードと自動モード、settings.json

図解:権限モードと自動モード、settings.json

権限モードは、確認なしに何をしてよいかを決めます。default(手動)は読み取りだけ、acceptEdits はファイルの編集も、plan は調べるだけ、auto は背景の安全の検査を付けてすべてを許します。bypassPermissions は、隔離したコンテナやVMだけで使います。権限やフックなどは settings.json で設定します。

出典:Permission modes (auto mode)
A permission mode sets which actions Claude can take in a session without asking you first.
https://code.claude.com/docs/en/permission-modes.md(取得 2026-11-17)
出典:Permission modes (auto mode)
Everything, with background safety checks | Long tasks, reducing prompt fatigue
https://code.claude.com/docs/en/permission-modes.md(取得 2026-11-17)
出典:Permission modes (auto mode)
Everything | Isolated containers and VMs only
https://code.claude.com/docs/en/permission-modes.md(取得 2026-11-17)
試験のポイント