Files
Luong NGUYEN ac9ee17169 docs: make version stamps and Compatible Models footers true (#259)
Type: docs

Makes the version stamps, Compatible Models footers and locale README badges say only what has been checked. Every claim below was checked against `https://code.claude.com/docs/en/<page>.md` or the raw changelog (2.1.303–2.1.322), not written from memory.

## Part A: English footers at 2.1.310 / 2.1.302

Each file's behavioural claims were checked against every changelog entry after its stamp, up to 2.1.322, and against the current docs. A stamp moves only when every claim checks out.

| File | Claims checked | Fixes | Sources | New stamp |
|---|---|---|---|---|
| `INDEX.md` | ~75: AGENTS.md rule (v2.1.277); skill/agent/MCP install paths; `/mcp__github__list_prs`; 5 hook types, 33 events, task-tool model note; `--plugin-dir`; checkpoint menu (6 options); `/workflows`, ultracode (v2.1.284), size guideline; 6 permission modes; `/loop` and the cron tools; Chrome; Remote Control; `SendMessage`/`ListAgents`/`notify_when_idle`; CLI flags | 1. Workflow size: medium aims for fewer than 10 agents only since v2.1.271 (15 before), and the default is small on a Pro plan. 2. dontAsk: file reads inside the working directories also run, as do *most* calls a `permissions.allow` rule or a `PreToolUse` hook approves (neither can approve critical-path `rm`/`rmdir` or network-path reads), and an installed mod can approve some calls. No version is given: the changelog doesn't say when a mod's `tool.check` allow arrived (it is already referenced in 2.1.290, 2.1.292 and 2.1.299). 3. `SendMessage` also reaches sessions on other machines and in the cloud, from a session connected to Remote Control with a claude.ai sign-in; a cloud session can't answer with `SendMessage`. The L383 use-case column now says the same. 4. The `--model` list adds the Fable models. 5. Plan mode: "Read-only analysis" → researches and proposes, runs shell commands to explore, edits blocked until the plan is approved. | [workflows#set-a-size-guideline](https://code.claude.com/docs/en/workflows#set-a-size-guideline) ("The default is `medium`, or `small` when you're signed in on a Pro plan with Claude Code v2.1.271 or later"); CL 2.1.219 ("aim for fewer than 15 agents"), CL 2.1.271 ("lowered the medium size guideline from 15 to 10 agents"); [permission-modes](https://code.claude.com/docs/en/permission-modes#allow-only-pre-approved-tools-with-dontask-mode) ("a mod you installed can still approve some of those calls"; "Claude still runs … file reads inside your working directories and read-only Bash commands"; "It also denies the built-in `AskUserQuestion` tool even if your allow rules match it"; "An allow rule or `PreToolUse` hook can't approve these: Recognized `rm` and `rmdir` critical-path removals … Reads from a network path"); CL 2.1.292 ("Fixed a plugin's `tool.check` hook answering allow running a tool…"), CL 2.1.299 ("…that a `PreToolUse` hook or a mod's `tool.check` hook allowed"); [permission-modes#analyze-before-you-edit-with-plan-mode](https://code.claude.com/docs/en/permission-modes#analyze-before-you-edit-with-plan-mode) ("Claude reads files, runs shell commands to explore, and writes a plan, but does not edit your source. Except in interactive terminal sessions with bypass permissions available, edits stay blocked until you approve the plan."); [cross-session-messaging](https://code.claude.com/docs/en/cross-session-messaging) ("reach your sessions on other machines or in the cloud"; "from a session that is connected to Remote Control, which needs a claude.ai sign-in"; "A cloud session … can't use `SendMessage` to answer a message from another machine"); model-config. The "device card" line checked out against [whats-new/2026-w34](https://code.claude.com/docs/en/whats-new/2026-w34). | **2.1.322** |
| `LEARNING-ROADMAP.md` | 33 hook events / 5 types; 6 built-in subagents (Explore, Plan, General-purpose, claude, statusline-setup, claude-code-guide); 60+ commands (commands page has 121 rows); `/design` (v2.1.265); `/plan`, `/rewind`, `/loop 5m`, `/schedule`; 6 permission modes (Manual since v2.1.200); Alt+T; skill `effort`/`shell`; plugin `workflows`/`channels`/`dependencies`; agent-teams env var; `claude mcp add --transport http`; `-r`, `--max-turns`, `--output-format json`; all 17 source links resolve | 1. Remote Control: "generally available" → "out of research preview", the docs' own wording. 2. Extended thinking (L368, Exercise 3, checklist): Opus 5.5, Sonnet 5.5, Haiku 5.5 and the Fable models always use extended thinking, so the exercise uses `/effort` and scopes Alt+T / Option+T to models that allow turning thinking off. 3. Exercise 4: checkpoints are automatic and unnamed, so step 1 no longer creates a named "Clean state" checkpoint and step 5 says which one to `/rewind` to. | [whats-new/2026-w34](https://code.claude.com/docs/en/whats-new/2026-w34): "Any machine running `claude remote-control` now shows up as a device card at the top of the Code tab in the Claude app. Remote Control is also out of research preview."; [interactive-mode](https://code.claude.com/docs/en/interactive-mode): Alt+T "Has no effect on Opus 5.5, Sonnet 5.5, Haiku 5.5, or the Fable models, which always use extended thinking."; [model-config](https://code.claude.com/docs/en/model-config): "the effort level is the primary control for how much thinking happens"; [checkpointing](https://code.claude.com/docs/en/checkpointing): "Every prompt you send that starts a turn creates a new checkpoint" | **2.1.322** |
| `resources.md` | Adaptive reasoning on Opus 4.7+, Sonnet 5+, Haiku 5.5 and the Fable models; permission modes; 33 hook events; `/loop` and cron; 7 memory tiers; Chrome; keybinding chords; Code Review; Monitor (2.1.98); `/goal` and `claude agents` (2.1.139); `--json` (2.1.145); all links | none needed | model-config, hooks, memory, agent-view, changelog | **stays 2.1.310**: L253 gives `/run`, `/verify`, `/run-skill-generator` as "(v2.1.145+)". Neither the changelog, the v2.1.145 release notes, the skills/commands docs nor the what's-new pages for weeks 19–22 give a version. |
| `03-skills/claude-md/SKILL.md` | `name`/`description` frontmatter, `$ARGUMENTS`; CLAUDE.md locations and loading; "under 200 lines"; AGENTS.md gates (v2.1.277, v2.1.281), blocking files, `/config` Project instructions values and default; `@AGENTS.md`/symlink fallback; `.claude/agents/` | L196: the list of cases where AGENTS.md isn't read now includes a disabled built-in plugin, and limits the upgrade case to "in some cases" after upgrading from v2.1.276 or earlier | [memory#when-agents-md-support-is-unavailable](https://code.claude.com/docs/en/memory#when-agents-md-support-is-unavailable): "You used `/plugin` to disable the built-in plugin that reads `AGENTS.md`"; "In some cases, it's your first session after you upgrade from v2.1.276 or earlier" | **stays 2.1.302**: no primary source states L24 ("~150-200 instructions", "system prompt already uses ~50") or L214 (the system reminder says CLAUDE.md "may or may not be relevant") |
| `07-plugins/devops-automation/README.md` | `--plugin-dir` install; commands; agents; hooks; MCP; workflow; source URLs (all 200) | none: the stale claims need a design decision (below) | [plugins/components](https://code.claude.com/docs/en/plugins/components): "Save a command at `commands/<file>.md` and it becomes `/<plugin>:<file>`"; [plugins-reference](https://code.claude.com/docs/en/plugins-reference) standard layout: "Hooks \| `hooks/hooks.json`", "MCP servers \| `.mcp.json`" | **stays 2.1.302**: bare `/deploy`, `/rollback`, `/status` (`/status` is also a built-in), `/incident`; `hooks/*.js` are never registered (no `hooks/hooks.json`); `mcp/kubernetes-config.json` never loads (no `.mcp.json` or `mcpServers`) |
| `07-plugins/documentation/README.md` | same | none | same | **stays 2.1.302**: bare command names; `mcp/github-docs-config.json` never loads, so the `GITHUB_TOKEN` setup has no effect |
| `07-plugins/pr-review/README.md` | same | none | same | **stays 2.1.302**: bare command names; `hooks/pre-review.js` is not registered; `mcp/github-config.json` never loads |

No changelog entry from 2.1.303 to 2.1.322 touched the plugin READMEs or SKILL.md. Their problems predate the stamps, and #209 already listed the hook/MCP files that never load.

**Locale copies:** the same factual fixes went into every locale with the same sentence. That's dontAsk and plan mode in all six INDEX files; workflow size in fa and ko; `SendMessage` and the use-case column in fa and ko; the `--model` list in fa and ko; "generally available" in fa and ko LEARNING-ROADMAP; the extended-thinking exercise/checklist and the checkpoint exercise in all six LEARNING-ROADMAP copies; the AGENTS.md cases in all six SKILL.md copies. Locale stamps were not bumped. INDEX and LEARNING-ROADMAP stay at 2.1.310 in every locale, and the SKILL.md copies keep their footers.

## Part B: Compatible Models footers

The new list is **Claude Fable 5.2, Claude Fable 5.1, Claude Fable 5, Claude Opus 5.5, Claude Opus 5, Claude Sonnet 5.5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 5.5, Claude Haiku 4.5**. It is used on root docs and module pages alike, and it's the README FAQ's list, so the footers and the FAQ no longer disagree.

Why one list for both file types: STYLE_GUIDE's footer rule ("List all compatible models") applies to both. A shorter "current models only" list on module pages would break that rule. Justification from [model-config](https://code.claude.com/docs/en/model-config):

- **Current models:** "| Anthropic API | Opus 5.5 | Sonnet 5.5 | Haiku 5.5 |"; "the `fable` alias resolves to Fable 5 in Claude apps gateway sessions and to Fable 5.2 everywhere else"; "Fable 5.2 requires Claude Code v2.1.321 or later".
- **Older models still in use:**
  - "**Fable 5.1 or Fable 5**: select it by model ID."
  - "| Claude Platform on AWS | Opus 5.5 | Sonnet 4.6 | Haiku 4.5 |".
  - "biology-flagged requests re-run on Opus 5, and cybersecurity-flagged requests re-run on Opus 4.8".
  - "**Sonnet 5.5**: cybersecurity-flagged requests re-run on Sonnet 5."
- **None are retired.** The [models overview](https://platform.claude.com/docs/en/about-claude/models/overview) that model-config links marks only Opus 4.1, Opus 4 and Sonnet 4 as "retired". All eleven listed models appear there without that mark.

Scope: 336 lines in 331 files. The changed lines are the `**Compatible Models**` lines (92, some of them in locale files) and every localized label (`호환 모델`, `مدل‌های سازگار`, `Các Mô Hình Tương Thích`, `Сумісні моделі`, `対応モデル`, `互換モデル`, `兼容模型`), plus the italic `*対応:…*` / `*Для …*` / `*适用于 …*` lines in the ja/uk/zh concepts guides. Labels, separators (`, ` `、` `، `) and locale stamps are unchanged. The README FAQ lines and the 05-mcp `tool_reference` note are not footers and were left alone. The footer lines of `CHANGELOG.md`, `fa/CHANGELOG.md` and `ko/CHANGELOG.md` also carry the new list; only the footer line changed, not the entries.

## Part C: locale README badges

Real state: the newest version that most (more than half) of the locale's ten module READMEs carry or exceed, backed by the sync commit that brought them there.

A badge is marked **(partial)** when one or more of the locale's module READMEs has no version footer (never synced since its first translation), or when the locale is a condensed translation. A module synced to an older version than the badge doesn't make it partial on its own; the majority rule above already covers that. Only zh meets the rule (02-memory and 05-mcp have no footer, and #247 calls zh condensed).

| Locale | Old badge / "latest" | Evidence | New |
|---|---|---|---|
| ja | 2.1.119 (badge, "latest", FAQ) | module footers: 3×2.1.322, 5×2.1.316, 1×2.1.310, 1×2.1.302; 8/10 ≥ 2.1.316 (#230); #247 carried only the sections ja has | **2.1.316** (Oct 2026) |
| uk | 2.1.112 (FAQ line; no badge) | 3×2.1.322, 4×2.1.316, 1×2.1.310, 2×2.1.302; 7/10 ≥ 2.1.316 (#230) | **2.1.316** (Oct 2026) |
| zh | 2.1.112 (badge, "latest", FAQ) | 2.1.316, 2.1.310 ×2, 2.1.302 ×2, 2.1.300 ×2, 2.1.278; 02 and 05 have no footer (untouched since the first translation); 7/10 ≥ 2.1.300 (#193); #247 was "condensed", model lists only | **2.1.300 (partial)** (Oct 2026): the badge, "latest" and FAQ lines say zh is condensed and that 02-memory and 05-mcp haven't been synced since the April 2026 translation |
| ko | 2.1.310 | 5×2.1.322, 5×2.1.310; #228 synced ko to 2.1.310, and #247 says 2.1.316 "was not backfilled" | **2.1.310** (unchanged) |
| fa | 2.1.310 | 5×2.1.322, 5×2.1.316; #241 "syncs the translation from v2.1.310 to v2.1.316"; #247 carried only the 2.1.322 P1 changes | **2.1.316** (Oct 2026) |
| vi | none (README has no badge or version line) | 4×2.1.322, 6×2.1.316 | no change |

Months come from the docs changelog: 2.1.300 was released October 14, 2026 and 2.1.316 October 31, 2026. The README *footers* in fa/ja/ko/uk/zh stay at 2.1.322: #247 checked those files themselves, while the badge describes the whole locale.

## Deliberately left

- **Stamps not bumped:** `resources.md` (2.1.310), `03-skills/claude-md/SKILL.md` and the three plugin READMEs (2.1.302), for the reasons in the Part A table.
- **Example plugins:** the fix is a design choice between wiring up `hooks/hooks.json` / `.mcp.json` and rewording the READMEs, and renaming commands to `/<plugin>:<name>` touches seven languages plus `07-plugins/README.md` (bare `/review-pr`). It needs a follow-up issue.
- **Same unverifiable version elsewhere:** `03-skills/README.md` also said `/run-skill-generator` is v2.1.145+. Handled by #262, now merged into this branch from `main`.
- **Older `--model` lists:** ja/uk/vi/zh INDEX have pre-5.x lists (e.g. "Sonnet 4.6, Opus 4.7, Haiku 4.5"). That isn't the English sentence, so it belongs to a locale sync.

## Follow-ups
- **LEARNING-ROADMAP `/effort` line (review r3 N13):** line 368 can read as if `/effort` applies only to the models that always use extended thinking; per model-config's effort table it also works on Opus 5, Sonnet 5 and Opus 4.8. Not wrong; clarify in the next pass.

- **Compatible Models scope (review S3):** Opus 4.6 is Microsoft Foundry's current `opus`, and Sonnet 4.5 is the current `sonnet` on Bedrock, Google Cloud's Agent Platform and Foundry (deprecated, retiring Nov 30, 2026), per model-config's alias table. Both are still in use, so either add them to the FAQ and every footer (Sonnet 4.5 marked deprecated), or define the list's scope in STYLE_GUIDE (e.g. the models the aliases resolve to on the Anthropic API plus older models in active use) and cite the deprecations table.
- **Model order (review N8):** the list puts Opus 4.8 after Sonnet 4.6. Grouping by family (Fable, Opus 5.5/5/4.8, Sonnet, Haiku) would read better; the order is shared by STYLE_GUIDE, the FAQ and every footer, so change it everywhere at once.
- **Example plugins:** the follow-up issue proposed above.

## Validation

- `SKIP=mermaid,vietnamese-mermaid,japanese-mermaid,korean-mermaid,persian-mermaid pre-commit run --files <338 changed files>`: every hook passes, including link-check (246 URLs per language). The Mermaid hooks can't install here (`language: node must have package.json or additional_dependencies`, the same failure #247 reported). `python scripts/check_mermaid.py --strict` was run directly instead: Pele 1.6.0 rendered all 416 blocks.
- `python scripts/check_cross_references.py`: all valid (674 files).
- Review fix round 1 (18 files): the same `pre-commit run --files` passes every hook (Mermaid hooks skipped as above; no Mermaid block was touched), and the cross-reference check is still valid after merging `main`.
- Review fix round 2 (14 files: the extended-thinking wording in all 7 LEARNING-ROADMAP files, the dontAsk line in all 7 INDEX files): `pre-commit run --files` passes every hook (Mermaid hooks skipped; no Mermaid block touched), and the cross-reference check is valid (674 files) after merging `main` again (#257).
- Pre-push secret scan: it flagged `06-hooks/README.md:1683` (en, fa, vi), a false positive. The `sk-…{20,}` pattern matches the docs anchor `hooks#pretooluse-ask-decisions-in-auto-mode`, which has been on `main` since 11b2ae3 (en), c2f92c8 (fa) and 8de1820 (vi), and is not on a line this PR changes. The PR's added lines have no secret-pattern matches.

Closes #256
2026-11-12 14:29:18 +01:00
..

Claude How To

メモリガイド

メモリにより、Claude はセッションや会話をまたいでコンテキストを保持できる。メモリには 2 つの形態がある: claude.ai の自動合成と、Claude Code のファイルシステムベースの CLAUDE.md である。

概要

Claude Code のメモリは、複数のセッションや会話をまたいで持続するコンテキストを提供する。一時的なコンテキストウィンドウとは異なり、メモリファイルは次のことを可能にする:

  • プロジェクト標準をチームで共有する
  • 個人の開発上の好みを保存する
  • ディレクトリ固有のルールと設定を維持する
  • 外部ドキュメントをインポートする
  • メモリをプロジェクトの一部としてバージョン管理する

メモリシステムは、グローバルな個人設定から特定のサブディレクトリまで複数の階層で動作し、Claude が何を覚え、それをどう適用するかを細かく制御できる。

メモリコマンドのクイックリファレンス

コマンド 用途 使い方 使うタイミング
/init プロジェクトメモリを初期化 /init 新規プロジェクト開始時、初回の CLAUDE.md セットアップ
/memory エディタでメモリファイルを編集 /memory 大規模な更新、再構成、内容のレビュー
# プレフィックス 単一行を素早くメモリに追加 廃止 — 代わりに /memory を使うか会話で依頼する
@path/to/file 外部コンテンツをインポート @README.md または @docs/api.md CLAUDE.md から既存ドキュメントを参照する

クイックスタート: メモリの初期化

/init コマンド

/init コマンドは Claude Code でプロジェクトメモリをセットアップする最速の方法である。基本となるプロジェクトドキュメントを含む CLAUDE.md ファイルを初期化する。

使い方:

/init

機能:

  • プロジェクトに新しい CLAUDE.md ファイルを作成(通常は ./CLAUDE.md または ./.claude/CLAUDE.md)
  • プロジェクトの慣習とガイドラインを確立する
  • セッションをまたいだコンテキスト持続の基盤をセットアップ
  • プロジェクト標準を文書化するためのテンプレート構造を提供

強化されたインタラクティブモード: CLAUDE_CODE_NEW_INIT=1 を設定すると、ステップごとにプロジェクトセットアップを案内する複数フェーズのインタラクティブフローが有効になる:

CLAUDE_CODE_NEW_INIT=1 claude
/init

/init を使う場面:

  • Claude Code で新規プロジェクトを開始するとき
  • チームのコーディング標準と慣習を確立するとき
  • コードベース構造に関するドキュメントを作るとき
  • 共同開発のためにメモリ階層をセットアップするとき

ワークフロー例:

# In your project directory
/init

# Claude creates CLAUDE.md with structure like:
# Project Configuration
## Project Overview
- Name: Your Project
- Tech Stack: [Your technologies]
- Team Size: [Number of developers]

## Development Standards
- Code style preferences
- Testing requirements
- Git workflow conventions

メモリの簡易更新

注意: インラインメモリ用の # ショートカットは廃止された。/memory でメモリファイルを直接編集するか、Claude に会話で覚えてほしいことを依頼する(例: 「TypeScript の strict モードを必ず使うことを覚えておいて」)。

メモリに情報を追加する推奨方法:

方法 1: /memory コマンドを使う

/memory

メモリファイルがシステムのエディタで開かれ、直接編集できる。

方法 2: 会話で依頼する

Remember that we always use TypeScript strict mode in this project.
Please add to memory: prefer async/await over promise chains.

Claude に何かを覚えるよう頼むと、自動メモリに保存される。代わりに CLAUDE.md を変更したい場合は「これを CLAUDE.md に追加して」と頼むか、/memory でファイルを直接編集する。

履歴用メモ(現在は機能しない):

# プレフィックスショートカットは以前、ルールをインラインで追加できた:

# Always use TypeScript strict mode in this project  ← no longer works

このパターンに依存していた場合は、/memory コマンドや会話依頼に切り替える。

/memory コマンド

/memory コマンドは、Claude Code セッション内から CLAUDE.md メモリファイルを直接編集する手段を提供する。メモリファイルをシステムのエディタで開き、包括的に編集できる。

使い方:

/memory

機能:

  • メモリファイルをシステムのデフォルトエディタで開く
  • 大規模な追加、修正、再構成を行える
  • 階層内のすべてのメモリファイルへの直接アクセスを提供
  • セッションをまたいだ永続コンテキストの管理を可能にする

/memory を使う場面:

  • 既存のメモリ内容をレビューするとき
  • プロジェクト標準を大規模に更新するとき
  • メモリ構造を再構成するとき
  • 詳細なドキュメントやガイドラインを追加するとき
  • プロジェクトの進化に合わせてメモリを保守・更新するとき

比較: /memory と /init

観点 /memory /init
目的 既存メモリファイルの編集 新規 CLAUDE.md の初期化
使う場面 プロジェクトコンテキストの更新/修正 新規プロジェクト開始時
動作 編集用にエディタを開く スターターテンプレートを生成
ワークフロー 継続的なメンテナンス 一回限りのセットアップ

ワークフロー例:

# Open memory for editing
/memory

# Claude presents options:
# 1. Managed Policy Memory
# 2. Project Memory (./CLAUDE.md)
# 3. User Memory (~/.claude/CLAUDE.md)
# 4. Local Project Memory

# Choose option 2 (Project Memory)
# Your default editor opens with ./CLAUDE.md content

# Make changes, save, and close editor
# Claude automatically reloads the updated memory

メモリインポートの利用:

CLAUDE.md ファイルは、外部コンテンツを取り込む @path/to/file 構文をサポートする:

# Project Documentation
See @README.md for project overview
See @package.json for available npm commands
See @docs/architecture.md for system design

# Import from home directory using absolute path
@~/.claude/my-project-instructions.md

インポート機能:

  • 相対パスと絶対パスの両方をサポート(例: @docs/api.md、@~/.claude/my-project-instructions.md)
  • 再帰的インポートをサポート(最大深度 4 ホップ)
  • 外部ロケーションからの初回インポートはセキュリティのため承認ダイアログが出る
  • インポートディレクティブは Markdown のコードスパンやコードブロック内では評価されない(例として記述しても安全)
  • 既存ドキュメントを参照することで重複を避けられる
  • 参照されたコンテンツが Claude のコンテキストに自動で含まれる

メモリアーキテクチャ

Claude Code のメモリは、スコープごとに異なる目的を持つ階層システムに従う:

graph TB
    A["Claude Session"]
    B["User Input"]
    C["Memory System"]
    D["Memory Storage"]

    B -->|User provides info| C
    C -->|Synthesizes every 24h| D
    D -->|Loads automatically| A
    A -->|Uses context| C

Claude Code のメモリ階層

Claude Code は多階層のメモリシステムを使う。Claude Code 起動時にメモリファイルが自動でロードされ、上位レベルのファイルが優先される。

メモリ階層全体(優先度の高い順):

  1. Managed Policy — 組織全体の指示

    • macOS: /Library/Application Support/ClaudeCode/CLAUDE.md
    • Linux/WSL: /etc/claude-code/CLAUDE.md
    • Windows: C:\Program Files\ClaudeCode\CLAUDE.md
  2. Managed Drop-ins — アルファベット順にマージされるポリシーファイル(v2.1.83+)

    • 管理ポリシー CLAUDE.md と並ぶ managed-settings.d/ ディレクトリ
    • モジュール式のポリシー管理のため、アルファベット順にマージされる
  3. Project Memory — チーム共有のコンテキスト(バージョン管理対象)

    • ./.claude/CLAUDE.md または ./CLAUDE.md(リポジトリのルート)
    • v2.1.277 以降、作業ディレクトリとその上位に CLAUDE.md も CLAUDE.local.md も存在しない場合、同じ階層で代わりに ./AGENTS.md が読み込まれる。/config の Project instructions で制御する
  4. Project Rules — モジュール式・トピック別のプロジェクト指示

    • ./.claude/rules/*.md
  5. User Memory — 個人設定(全プロジェクト)

    • ~/.claude/CLAUDE.md
  6. User-Level Rules — 個人ルール(全プロジェクト)

    • ~/.claude/rules/*.md
  7. Local Project Memory — プロジェクト固有の個人設定

    • ./CLAUDE.local.md

注意: CLAUDE.local.md は完全にサポートされ、公式ドキュメント にも記載されている。バージョン管理にコミットしないプロジェクト固有の個人設定を提供する。CLAUDE.local.md は .gitignore に追加すること。

  1. Auto Memory — Claude による自動メモと学習内容
    • ~/.claude/projects/<project>/memory/

メモリ探索の挙動:

Claude は次の順序でメモリファイルを探索し、上位の場所が優先される:

graph TD
    A["Managed Policy<br/>/Library/.../ClaudeCode/CLAUDE.md"] -->|highest priority| A2["Managed Drop-ins<br/>managed-settings.d/"]
    A2 --> B["Project Memory<br/>./CLAUDE.md"]
    B --> C["Project Rules<br/>./.claude/rules/*.md"]
    C --> D["User Memory<br/>~/.claude/CLAUDE.md"]
    D --> E["User Rules<br/>~/.claude/rules/*.md"]
    E --> F["Local Project Memory<br/>./CLAUDE.local.md"]
    F --> G["Auto Memory<br/>~/.claude/projects/.../memory/"]

    B -->|imports| H["@docs/architecture.md"]
    H -->|imports| I["@docs/api-standards.md"]

    style A fill:#fce4ec,stroke:#333,color:#333
    style A2 fill:#fce4ec,stroke:#333,color:#333
    style B fill:#e1f5fe,stroke:#333,color:#333
    style C fill:#e1f5fe,stroke:#333,color:#333
    style D fill:#f3e5f5,stroke:#333,color:#333
    style E fill:#f3e5f5,stroke:#333,color:#333
    style F fill:#e8f5e9,stroke:#333,color:#333
    style G fill:#fff3e0,stroke:#333,color:#333
    style H fill:#e1f5fe,stroke:#333,color:#333
    style I fill:#e1f5fe,stroke:#333,color:#333

claudeMdExcludes で CLAUDE.md ファイルを除外する

大規模モノレポでは、現在の作業に関係ない CLAUDE.md があり得る。claudeMdExcludes 設定により、特定の CLAUDE.md ファイルをスキップしてコンテキストにロードしないようにできる:

// In ~/.claude/settings.json or .claude/settings.json
{
  "claudeMdExcludes": [
    "**/packages/legacy-app/CLAUDE.md",
    "**/vendors/**/CLAUDE.md"
  ]
}

パターンは glob 構文で絶対ファイルパスに対して照合されるため、リポジトリ内のパターンは **/ で始める。とくに次の場合に有用である:

  • 多くのサブプロジェクトを抱えるモノレポで、関連するのが一部のみのとき
  • ベンダー製・サードパーティ製の CLAUDE.md を含むリポジトリ
  • 古い・無関係な指示を除外して Claude のコンテキストウィンドウのノイズを減らしたいとき

設定ファイルの階層

Claude Code の設定(autoMemoryDirectory、claudeMdExcludes などを含む)は 5 段階の階層から解決され、上位レベルが優先される:

レベル 場所 スコープ
1(最高) 管理ポリシー(システムレベル) 組織全体への強制
2 managed-settings.d/(v2.1.83+) モジュール式のポリシードロップイン、アルファベット順にマージ
3 .claude/settings.local.json ローカルオーバーライド(git 無視)
4 .claude/settings.json プロジェクトレベル(git にコミット)
5(最低) ~/.claude/settings.json ユーザー設定

プラットフォーム固有の設定(v2.1.51+):

設定は次の方法でも構成できる:

  • macOS: プロパティリスト(plist)ファイル
  • Windows: Windows レジストリ

これらのプラットフォームネイティブの仕組みは JSON 設定ファイルとともに読み込まれ、同じ優先順位ルールに従う。

注意(v2.1.119): /config の変更は ~/.claude/settings.json に永続化されるようになった。/config で書かれた値は、上記のポリシー/ローカル/プロジェクトの優先順位チェーンに参加する — もはやセッション限りではない。インタラクティブな編集には /config を、スクリプト化または管理された設定には settings.json ファイルの直接編集を使う。

保持期間とクリーンアップ設定

設定 型 デフォルト 説明
cleanupPeriodDays 整数(日) 30 セッショントランスクリプトおよび ~/.claude/ 配下のその他のアプリケーションデータの保持期間。file-history/(チェックポイントのスナップショット)、plans/、debug/、tasks/、shell-snapshots/、backups/ などが対象となる。~/.claude/checkpoints/ というフォルダは存在しない。期間より古いファイルは起動時に削除される。
// ~/.claude/settings.json
{
  "cleanupPeriodDays": 14
}

帰属表示・音声・PR URL の設定

設定 型 説明
attribution.commit string Claude が作成したコミットに追加するテキスト(既定は Co-Authored-By: Claude トレーラ)。"" で非表示。非推奨の includeCoAuthoredBy フラグを置き換え。
attribution.pr string Claude が作成したプルリクエストの説明に追加するテキスト。"" で非表示。PR について非推奨の includeCoAuthoredBy フラグを置き換え。
voice.enabled boolean プッシュトゥトーク音声入力(/voice)を有効化。非推奨の voiceEnabled フラグを置き換え。
prUrlTemplate string v2.1.119 で新規。 フッターの PR バッジ用カスタム URL テンプレート。GitLab、Bitbucket、社内コードレビュー基盤などで有用。{host}、{owner}、{repo}、{number}、{url} プレースホルダをサポート。GitLab のマージリクエストリンクは変更されない。
// ~/.claude/settings.json
{
  "attribution": {
    "commit": "",
    "pr": ""
  },
  "voice": {
    "enabled": true
  },
  "prUrlTemplate": "https://reviews.example.com/{owner}/{repo}/pull/{number}"
}

空文字列("")でその帰属表示を非表示にでき、"attribution": false ですべて非表示になる(v2.1.281+)。

非推奨となった設定キー

以下のレガシー設定キーは引き続き動作するが非推奨。上記の置き換えを優先する。

非推奨キー 置き換え 備考
includeCoAuthoredBy attribution.commit / attribution.pr 旧来の単一フラグはコミット用と PR 用の別スイッチに分割された。古いインストール環境のユーザーはレガシーキーを使い続けてよいが、新規プロジェクトはネスト形式を使うべき。
voiceEnabled voice.enabled 将来の音声関連オプションと同様、voice 名前空間にまとめられた。

モジュール式ルールシステム

.claude/rules/ ディレクトリ構造を使うと、整理された・パス固有のルールを作成できる。ルールはプロジェクトレベルとユーザーレベルの両方で定義できる:

your-project/
├── .claude/
│   ├── CLAUDE.md
│   └── rules/
│       ├── code-style.md
│       ├── testing.md
│       ├── security.md
│       └── api/                  # Subdirectories supported
│           ├── conventions.md
│           └── validation.md

~/.claude/
├── CLAUDE.md
└── rules/                        # User-level rules (all projects)
    ├── personal-style.md
    └── preferred-patterns.md

ルールは rules/ ディレクトリ内で再帰的に発見される(サブディレクトリも含む)。~/.claude/rules/ のユーザーレベルルールはプロジェクトレベルルールより前にロードされ、プロジェクトが上書きできる個人デフォルトを設定できる。

YAML フロントマターによるパス固有ルール

特定のファイルパスにのみ適用されるルールを定義できる:

---
paths: src/api/**/*.ts
---

# API Development Rules

- All API endpoints must include input validation
- Use Zod for schema validation
- Document all parameters and response types
- Include error handling for all operations

glob パターン例:

  • **/*.ts — すべての TypeScript ファイル
  • src/**/* — src/ 配下のすべてのファイル
  • src/**/*.{ts,tsx} — 複数の拡張子
  • {src,lib}/**/*.ts, tests/**/*.test.ts — 複数のパターン

サブディレクトリとシンボリックリンク

.claude/rules/ のルールは 2 つの整理機能をサポートする:

  • サブディレクトリ: ルールは再帰的に発見されるため、トピック別フォルダに整理できる(例: rules/api/、rules/testing/、rules/security/)
  • シンボリックリンク: 複数プロジェクト間でルールを共有するためにシンボリックリンクをサポート。例えば、共有ルールファイルを中央の場所から各プロジェクトの .claude/rules/ ディレクトリにシンボリックリンクできる

メモリ配置一覧

場所 スコープ 優先度 共有 アクセス 適した用途
/Library/Application Support/ClaudeCode/CLAUDE.md(macOS) Managed Policy 1(最高) 組織 システム 会社全体のポリシー
/etc/claude-code/CLAUDE.md(Linux/WSL) Managed Policy 1(最高) 組織 システム 組織標準
C:\Program Files\ClaudeCode\CLAUDE.md(Windows) Managed Policy 1(最高) 組織 システム 全社ガイドライン
managed-settings.d/*.md(ポリシーと並ぶ) Managed Drop-ins 1.5 組織 システム モジュール式ポリシーファイル(v2.1.83+)
./CLAUDE.md または ./.claude/CLAUDE.md Project Memory 2 チーム Git チーム標準、共有アーキテクチャ
./.claude/rules/*.md Project Rules 3 チーム Git パス固有・モジュール式ルール
~/.claude/CLAUDE.md User Memory 4 個人 ファイルシステム 個人設定(全プロジェクト)
~/.claude/rules/*.md User Rules 5 個人 ファイルシステム 個人ルール(全プロジェクト)
./CLAUDE.local.md Project Local 6 個人 Git(無視) プロジェクト固有の個人設定
~/.claude/projects/<project>/memory/ Auto Memory 7(最低) 個人 ファイルシステム Claude による自動メモと学習内容

メモリ更新のライフサイクル

Claude Code セッションでメモリ更新がどう流れるかを示す:

sequenceDiagram
    participant User
    participant Claude as Claude Code
    participant Editor as File System
    participant Memory as CLAUDE.md

    User->>Claude: "Add async/await rule to CLAUDE.md"
    Claude->>User: "Which memory file?"
    User->>Claude: "Project memory"
    Claude->>Editor: Open ./CLAUDE.md
    Claude->>Memory: Write to ./CLAUDE.md
    Memory-->>Claude: File saved
    Claude->>Claude: Load updated memory
    Claude-->>User: "Memory saved!"

自動メモリ(Auto Memory)

自動メモリは、Claude がプロジェクトでの作業中に型付きのメモ(user、feedback、project、reference)を自動で保存する永続ディレクトリである。アーキテクチャ、ファイルパス、デバッグの修正内容など、コードベースから導けるものは保存しない。手動で書いて維持する CLAUDE.md ファイルとは異なり、自動メモリはセッション中に Claude 自身が書き込む。

自動メモリの仕組み

  • 場所: ~/.claude/projects/<project>/memory/
  • エントリポイント: MEMORY.md が自動メモリディレクトリのメインファイルとして機能する
  • トピックファイル: メモリごとに 1 つのオプションファイル(例: prefers-pnpm.md、release-checklist.md)
  • ロード挙動: セッション開始時に MEMORY.md の最初の 200 行(または最初の 25KB のうち先に達したほう)がコンテキストにロードされる。トピックファイルは起動時ではなくオンデマンドでロードされる
  • 読み書き: Claude はユーザーの好み、フィードバック、プロジェクトの文脈を学びながら、セッション中にメモリファイルを読み書きする

自動メモリのアーキテクチャ

graph TD
    A["Claude Session Starts"] --> B["Load MEMORY.md<br/>(first 200 lines / 25KB)"]
    B --> C["Session Active"]
    C --> D["Claude learns<br/>preferences & feedback"]
    D --> E{"Write to<br/>auto memory"}
    E -->|General notes| F["MEMORY.md"]
    E -->|Topic-specific| G["prefers-pnpm.md"]
    E -->|Topic-specific| H["release-checklist.md"]
    C --> I["On-demand load<br/>topic files"]
    I --> C

    style A fill:#e1f5fe,stroke:#333,color:#333
    style B fill:#e1f5fe,stroke:#333,color:#333
    style C fill:#e8f5e9,stroke:#333,color:#333
    style D fill:#f3e5f5,stroke:#333,color:#333
    style E fill:#fff3e0,stroke:#333,color:#333
    style F fill:#fce4ec,stroke:#333,color:#333
    style G fill:#fce4ec,stroke:#333,color:#333
    style H fill:#fce4ec,stroke:#333,color:#333
    style I fill:#f3e5f5,stroke:#333,color:#333

自動メモリのディレクトリ構造

~/.claude/projects/<project>/memory/
├── MEMORY.md              # Entrypoint (first 200 lines / 25KB loaded at startup)
├── prefers-pnpm.md        # Topic file (loaded on demand)
├── release-checklist.md   # Topic file (loaded on demand)
└── team-contacts.md       # Topic file (loaded on demand)

バージョン要件

自動メモリには Claude Code v2.1.59 以降 が必要である。古いバージョンを使っている場合は先にアップグレードする:

npm install -g @anthropic-ai/claude-code@latest

注意: npm 12 はデフォルトで Claude Code の postinstall ステップをスキップするため、このコマンドは Error: claude native binary not installed. で終了する。ネイティブインストーラーに切り替えるか、Fix an npm 12 install の手順に従う。

カスタム自動メモリディレクトリ

デフォルトでは自動メモリは ~/.claude/projects/<project>/memory/ に保存される。autoMemoryDirectory 設定(v2.1.74 以降で利用可能)で場所を変更できる:

// In any settings file: user, project, local, or managed policy
{
  "autoMemoryDirectory": "/path/to/custom/memory/directory"
}

注意: autoMemoryDirectory はすべての設定スコープ(ユーザー、プロジェクト、ローカル、管理ポリシー、--settings)から読み込まれる。値は絶対パスか ~/ で始まるパスでなければならない。

これは次のような用途で便利である:

  • 自動メモリを共有・同期可能な場所に保存したい場合
  • デフォルトの Claude 設定ディレクトリから自動メモリを分離したい場合
  • デフォルト階層の外にプロジェクト固有のパスを使いたい場合

ワークツリーとリポジトリ間の共有

同じ git リポジトリ内のすべてのワークツリーとサブディレクトリは、単一の自動メモリディレクトリを共有する。つまり、ワークツリーを切り替えても、同じリポジトリの別サブディレクトリで作業しても、同じメモリファイルを読み書きする。

サブエージェントのメモリ

サブエージェント(Agent ツールで起動されるもの)は、独自の永続メモリを保持できる。サブエージェント定義の memory フロントマターフィールドで、そのメモリディレクトリの置き場所を指定する:

memory: user      # ~/.claude/agent-memory/<agent-name>/
memory: project   # .claude/agent-memory/<agent-name>/ (git で共有可能)
memory: local     # .claude/agent-memory-local/<agent-name>/ (チェックインしない)

サブエージェントは起動時にそのディレクトリの MEMORY.md の先頭 200 行 / 25KB を読み込み、それを維持するための Read/Write/Edit を与えられる。自動メモリが無効な場合は効果がない。

注意: サブエージェントは独自の自動メモリも保持できる。詳細は 公式サブエージェントメモリドキュメント を参照。

自動メモリの制御

自動メモリは CLAUDE_CODE_DISABLE_AUTO_MEMORY 環境変数で制御できる:

値 挙動
0 自動メモリを 強制 ON
1 自動メモリを 強制 OFF
(未設定) デフォルト挙動(自動メモリ有効)
# Disable auto memory for a session
CLAUDE_CODE_DISABLE_AUTO_MEMORY=1 claude

# Force auto memory on explicitly
CLAUDE_CODE_DISABLE_AUTO_MEMORY=0 claude

--add-dir で追加ディレクトリを指定する

--add-dir フラグにより、現在の作業ディレクトリ以外のディレクトリからも CLAUDE.md ファイルをロードできる。モノレポや、他ディレクトリのコンテキストが関連するマルチプロジェクト構成で便利である。

この機能を有効化するには、環境変数を設定する:

CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD=1

そしてフラグを付けて Claude Code を起動する:

claude --add-dir /path/to/other/project

Claude は、現在の作業ディレクトリのメモリファイルに加えて、指定された追加ディレクトリの CLAUDE.md をロードする。

実例

例 1: プロジェクトメモリの構造

ファイル: ./CLAUDE.md

# Project Configuration

## Project Overview
- **Name**: E-commerce Platform
- **Tech Stack**: Node.js, PostgreSQL, React 18, Docker
- **Team Size**: 5 developers
- **Deadline**: Q4 2025

## Architecture
@docs/architecture.md
@docs/api-standards.md
@docs/database-schema.md

## Development Standards

### Code Style
- Use Prettier for formatting
- Use ESLint with airbnb config
- Maximum line length: 100 characters
- Use 2-space indentation

### Naming Conventions
- **Files**: kebab-case (user-controller.js)
- **Classes**: PascalCase (UserService)
- **Functions/Variables**: camelCase (getUserById)
- **Constants**: UPPER_SNAKE_CASE (API_BASE_URL)
- **Database Tables**: snake_case (user_accounts)

### Git Workflow
- Branch names: `feature/description` or `fix/description`
- Commit messages: Follow conventional commits
- PR required before merge
- All CI/CD checks must pass
- Minimum 1 approval required

### Testing Requirements
- Minimum 80% code coverage
- All critical paths must have tests
- Use Jest for unit tests
- Use Cypress for E2E tests
- Test filenames: `*.test.ts` or `*.spec.ts`

### API Standards
- RESTful endpoints only
- JSON request/response
- Use HTTP status codes correctly
- Version API endpoints: `/api/v1/`
- Document all endpoints with examples

### Database
- Use migrations for schema changes
- Never hardcode credentials
- Use connection pooling
- Enable query logging in development
- Regular backups required

### Deployment
- Docker-based deployment
- Kubernetes orchestration
- Blue-green deployment strategy
- Automatic rollback on failure
- Database migrations run before deploy

## Common Commands

| Command | Purpose |
|---------|---------|
| `npm run dev` | Start development server |
| `npm test` | Run test suite |
| `npm run lint` | Check code style |
| `npm run build` | Build for production |
| `npm run migrate` | Run database migrations |

## Team Contacts
- Tech Lead: Sarah Chen (@sarah.chen)
- Product Manager: Mike Johnson (@mike.j)
- DevOps: Alex Kim (@alex.k)

## Known Issues & Workarounds
- PostgreSQL connection pooling limited to 20 during peak hours
- Workaround: Implement query queuing
- Safari 14 compatibility issues with async generators
- Workaround: Use Babel transpiler

## Related Projects
- Analytics Dashboard: `/projects/analytics`
- Mobile App: `/projects/mobile`
- Admin Panel: `/projects/admin`

例 2: ディレクトリ固有メモリ

ファイル: ./src/api/CLAUDE.md

# API Module Standards

This file supplements root CLAUDE.md for everything in /src/api/. Memory files are
concatenated, not overridden — the root CLAUDE.md still applies, and Claude Code
loads this file on demand when it reads, writes, or edits files in this subtree.

## API-Specific Standards

### Request Validation
- Use Zod for schema validation
- Always validate input
- Return 400 with validation errors
- Include field-level error details

### Authentication
- All endpoints require JWT token
- Token in Authorization header
- Token expires after 24 hours
- Implement refresh token mechanism

### Response Format

All responses must follow this structure:

```json
{
  "success": true,
  "data": { /* actual data */ },
  "timestamp": "2025-11-06T10:30:00Z",
  "version": "1.0"
}
```

Error responses:
```json
{
  "success": false,
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "User message",
    "details": { /* field errors */ }
  },
  "timestamp": "2025-11-06T10:30:00Z"
}
```

### Pagination
- Use cursor-based pagination (not offset)
- Include `hasMore` boolean
- Limit max page size to 100
- Default page size: 20

### Rate Limiting
- 1000 requests per hour for authenticated users
- 100 requests per hour for public endpoints
- Return 429 when exceeded
- Include retry-after header

### Caching
- Use Redis for session caching
- Cache duration: 5 minutes default
- Invalidate on write operations
- Tag cache keys with resource type

例 3: 個人メモリ

ファイル: ~/.claude/CLAUDE.md

# My Development Preferences

## About Me
- **Experience Level**: 8 years full-stack development
- **Preferred Languages**: TypeScript, Python
- **Communication Style**: Direct, with examples
- **Learning Style**: Visual diagrams with code

## Code Preferences

### Error Handling
I prefer explicit error handling with try-catch blocks and meaningful error messages.
Avoid generic errors. Always log errors for debugging.

### Comments
Use comments for WHY, not WHAT. Code should be self-documenting.
Comments should explain business logic or non-obvious decisions.

### Testing
I prefer TDD (test-driven development).
Write tests first, then implementation.
Focus on behavior, not implementation details.

### Architecture
I prefer modular, loosely-coupled design.
Use dependency injection for testability.
Separate concerns (Controllers, Services, Repositories).

## Debugging Preferences
- Use console.log with prefix: `[DEBUG]`
- Include context: function name, relevant variables
- Use stack traces when available
- Always include timestamps in logs

## Communication
- Explain complex concepts with diagrams
- Show concrete examples before explaining theory
- Include before/after code snippets
- Summarize key points at the end

## Project Organization
I organize my projects as:

   project/
   ├── src/
   │   ├── api/
   │   ├── services/
   │   ├── models/
   │   └── utils/
   ├── tests/
   ├── docs/
   └── docker/

## Tooling
- **IDE**: VS Code with vim keybindings
- **Terminal**: Zsh with Oh-My-Zsh
- **Format**: Prettier (100 char line length)
- **Linter**: ESLint with airbnb config
- **Test Framework**: Jest with React Testing Library

私のテスト Claude に新しいルールを保存するよう依頼する。

Ask Claude to save a new rule どこにも Claude.md ファイルを置いていなかったため、Claude はルールを保存しなかった。続いて Claude に保存場所の確認を依頼した。

Ask Claude to save a new rule

例 4: セッション中のメモリ更新

アクティブな Claude Code セッション中に CLAUDE.md へ新しいルールを追加できる(Claude に「覚えて」と頼むと、代わりに自動メモリに保存される)。方法は 2 つある。

方法 1: 直接依頼

User: Add this to CLAUDE.md: I prefer using React hooks instead of class components
     for all new components.

Claude: I'm adding that to your memory. Which memory file should this go in?
        1. Project memory (./CLAUDE.md)
        2. Personal memory (~/.claude/CLAUDE.md)

User: Project memory

Claude: ✅ Memory saved!

Added to ./CLAUDE.md:
---

### Component Development
- Use functional components with React Hooks
- Prefer hooks over class components
- Custom hooks for reusable logic
- Use useCallback for event handlers
- Use useMemo for expensive computations

方法 2: 「# new rule into memory」パターンを使う

明示的なパターン「# new rule into memory」でメモリ更新を発火させることもできる:

User: # new rule into memory
      Always validate user input with Zod schemas before processing.

Claude: I'm saving this rule to memory. Which memory file should I use?
        1. Project memory (./CLAUDE.md)
        2. Personal memory (~/.claude/CLAUDE.md)

User: Project memory

Claude: ✅ Memory saved!

Added to ./CLAUDE.md:
---

### Input Validation
- Always validate user input with Zod schemas before processing
- Define schemas at the top of each API handler file
- Return 400 status with validation errors

メモリ追加のコツ

  • ルールは具体的かつ実行可能にする
  • 関連するルールはセクション見出しの下にまとめる
  • 内容を重複させず、既存セクションを更新する
  • 適切なメモリスコープ(プロジェクト vs 個人)を選ぶ

メモリ機能の比較

機能 Claude Web/Desktop Claude Code(CLAUDE.md)
自動合成 ✅ 24 時間ごと ✅ 自動メモリ
プロジェクト横断 ✅ 共有 ❌ プロジェクト固有
チームアクセス ✅ 共有プロジェクト ✅ Git 管理
検索可能 ✅ 標準搭載 ✅ /memory 経由
編集可能 ✅ チャット内 ✅ 直接ファイル編集
インポート/エクスポート ✅ 可 ✅ コピー/ペースト
永続性 ✅ 24 時間以上 ✅ 無期限

Claude Web/Desktop のメモリ

メモリ合成のタイムライン

graph LR
    A["Day 1: User<br/>Conversations"] -->|24 hours| B["Day 2: Memory<br/>Synthesis"]
    B -->|Automatic| C["Memory Updated<br/>Summarized"]
    C -->|Loaded in| D["Day 2-N:<br/>New Conversations"]
    D -->|Add to| E["Memory"]
    E -->|24 hours later| F["Memory Refreshed"]

メモリサマリの例:

## Claude's Memory of User

### Professional Background
- Senior full-stack developer with 8 years experience
- Focus on TypeScript/Node.js backends and React frontends
- Active open source contributor
- Interested in AI and machine learning

### Project Context
- Currently building e-commerce platform
- Tech stack: Node.js, PostgreSQL, React 18, Docker
- Working with team of 5 developers
- Using CI/CD and blue-green deployments

### Communication Preferences
- Prefers direct, concise explanations
- Likes visual diagrams and examples
- Appreciates code snippets
- Explains business logic in comments

### Current Goals
- Improve API performance
- Increase test coverage to 90%
- Implement caching strategy
- Document architecture

ベストプラクティス

Do — 含めるべきこと

  • 具体的かつ詳細に: 曖昧なガイダンスではなく、明確で詳細な指示を使う

    • ✅ 良い: 「すべての JavaScript ファイルで 2 スペースのインデントを使う」
    • ❌ 避ける: 「ベストプラクティスに従う」
  • 整理する: 明確な Markdown のセクションと見出しでメモリファイルを構造化する

  • 適切な階層レベルを使う:

    • Managed Policy: 全社ポリシー、セキュリティ標準、コンプライアンス要件
    • Project Memory: チーム標準、アーキテクチャ、コーディング規約(git にコミット)
    • User Memory: 個人設定、コミュニケーションスタイル、ツール選択
    • Directory Memory: モジュール固有のルールとオーバーライド
  • インポートを活用する: @path/to/file 構文で既存ドキュメントを参照する

    • 最大 5 段階の再帰的ネストをサポート
    • メモリファイル間の重複を避ける
    • 例: See @README.md for project overview
  • 頻出コマンドを記録する: 繰り返し使うコマンドを含めて時間を節約する

  • プロジェクトメモリをバージョン管理する: チームに恩恵があるよう、プロジェクトレベル CLAUDE.md を git にコミットする

  • 定期的に見直す: プロジェクトの進化や要件変更に合わせ、メモリを定期的に更新する

  • 具体例を提示する: コードスニペットや具体的なシナリオを含める

Don't — 避けるべきこと

  • シークレットを保存しない: API キー、パスワード、トークン、認証情報を絶対に含めない

  • 機微データを含めない: 個人情報、私的情報、独自の機密情報は不可

  • 内容を重複させない: 既存ドキュメントを参照するためにインポート(@path)を使う

  • 曖昧にしない: 「ベストプラクティスに従う」「良いコードを書く」のような汎用的記述を避ける

  • 長くしすぎない: 個々のメモリファイルは焦点を絞り、500 行以下に保つ

  • 整理しすぎない: 階層は戦略的に使う。サブディレクトリオーバーライドを過剰に作らない

  • 更新を忘れない: 古いメモリは混乱と時代遅れの慣習を招く

  • ネスト上限を超えない: メモリインポートは最大 5 段階まで

メモリ管理のヒント

適切なメモリレベルを選ぶ:

ユースケース メモリレベル 理由
全社セキュリティポリシー Managed Policy 組織全体の全プロジェクトに適用
チームのコードスタイルガイド Project git でチームに共有
自分の好みのエディタショートカット User 個人設定であり共有しない
API モジュール標準 Directory そのモジュールのみに固有

素早い更新ワークフロー:

  1. 単一ルールの場合: 会話で # プレフィックスを使う
  2. 複数の変更の場合: /memory でエディタを開く
  3. 初期セットアップの場合: /init でテンプレートを作成する

インポートのベストプラクティス:

# Good: Reference existing docs
@README.md
@docs/architecture.md
@package.json

# Avoid: Copying content that exists elsewhere
# Instead of copying README content into CLAUDE.md, just import it

インストール手順

プロジェクトメモリのセットアップ

方法 1: /init コマンドを使う(推奨)

プロジェクトメモリをセットアップする最速の方法:

  1. プロジェクトディレクトリに移動:

    cd /path/to/your/project
    
  2. Claude Code で init コマンドを実行:

    /init
    
  3. Claude がテンプレート構造で CLAUDE.md を作成・記入する

  4. 生成されたファイルをプロジェクトに合わせてカスタマイズする

  5. git にコミット:

    git add CLAUDE.md
    git commit -m "Initialize project memory with /init"
    

方法 2: 手動作成

手動でセットアップしたい場合:

  1. プロジェクトルートに CLAUDE.md を作成:

    cd /path/to/your/project
    touch CLAUDE.md
    
  2. プロジェクト標準を追加:

    cat > CLAUDE.md << 'EOF'
    # Project Configuration
    
    ## Project Overview
    - **Name**: Your Project Name
    - **Tech Stack**: List your technologies
    - **Team Size**: Number of developers
    
    ## Development Standards
    - Your coding standards
    - Naming conventions
    - Testing requirements
    EOF
    
  3. git にコミット:

    git add CLAUDE.md
    git commit -m "Add project memory configuration"
    

方法 3: # で素早く更新する

CLAUDE.md が存在したら、会話中に素早くルールを追加できる:

# Use semantic versioning for all releases

# Always run tests before committing

# Prefer composition over inheritance

Claude はどのメモリファイルを更新するかを尋ねる。

個人メモリのセットアップ

  1. ~/.claude ディレクトリを作成:

    mkdir -p ~/.claude
    
  2. 個人 CLAUDE.md を作成:

    touch ~/.claude/CLAUDE.md
    
  3. 設定を追加:

    cat > ~/.claude/CLAUDE.md << 'EOF'
    # My Development Preferences
    
    ## About Me
    - Experience Level: [Your level]
    - Preferred Languages: [Your languages]
    - Communication Style: [Your style]
    
    ## Code Preferences
    - [Your preferences]
    EOF
    

ディレクトリ固有メモリのセットアップ

  1. 特定ディレクトリ用のメモリを作成:

    mkdir -p /path/to/directory/.claude
    touch /path/to/directory/CLAUDE.md
    
  2. ディレクトリ固有のルールを追加:

    cat > /path/to/directory/CLAUDE.md << 'EOF'
    # [Directory Name] Standards
    
    This file supplements root CLAUDE.md for this directory. Memory files are
    concatenated, not overridden — Claude Code loads this file on demand when it
    reads, writes, or edits files in this directory.
    
    ## [Specific Standards]
    EOF
    
  3. バージョン管理にコミット:

    git add /path/to/directory/CLAUDE.md
    git commit -m "Add [directory] memory configuration"
    

セットアップ確認

  1. メモリの場所を確認:

    # Project root memory
    ls -la ./CLAUDE.md
    
    # Personal memory
    ls -la ~/.claude/CLAUDE.md
    
  2. Claude Code はセッション開始時にこれらのファイルを自動でロードする

  3. プロジェクトで新しいセッションを始め Claude Code でテストする

公式ドキュメント

最新情報は公式 Claude Code ドキュメントを参照する:

公式ドキュメントから抜粋した主要な技術詳細

メモリのロード:

  • 作業ディレクトリとその上位にある CLAUDE.md ファイル、パス指定のないルール、MEMORY.md の冒頭部分は Claude Code 起動時に自動でロードされる
  • Claude は現在の作業ディレクトリから上位へさかのぼって CLAUDE.md ファイルを発見する
  • サブツリー内のファイルはそのディレクトリにアクセスする際にコンテキスト的に発見・ロードされる

インポート構文:

  • 外部コンテンツの取り込みに @path/to/file を使う(例: @~/.claude/my-project-instructions.md)
  • 相対パスと絶対パスの両方をサポート
  • 再帰的インポートをサポート(最大深度 4 ホップ)
  • 外部からの初回インポートは承認ダイアログが出る
  • Markdown のコードスパンやコードブロック内では評価されない
  • 参照されたコンテンツが Claude のコンテキストに自動で含まれる

メモリ階層の優先順位:

  1. Managed Policy(最高優先度)
  2. Managed Drop-ins(managed-settings.d/、v2.1.83+)
  3. Project Memory
  4. Project Rules(.claude/rules/)
  5. User Memory
  6. User-Level Rules(~/.claude/rules/)
  7. Local Project Memory
  8. Auto Memory(最低優先度)

関連概念へのリンク

統合ポイント

関連する Claude 機能


最終更新: 2026 年 11 月 1 日 Claude Code バージョン: 2.1.316 Sources: