AIFCC
記事一覧へ
TipsClaude隠し機能claude-setup

99.9%が無視するClaude Codeの隠し機能10選

36321
クイックスタートも、一般的なワークフローも超えて、hooksリファレンス、channelsページ、実験的フラグまで読み込んだ。 そこにある機能は単に時間を節約するだけでなく、Claude Codeそのものを変える。 I / Channels:Claude が作業中に Telegram、Discord、iMessage からメッセージを受け取る claude --channels plugin:telegram@claude-plugins-official --channels フラグで Claude を起動してプラグインをインストールする。設定が完了すると、Claude は選択したプラットフォームのDMで連絡可能になる。 午前2時にCIが失敗すると、Claude はそのイベントをセッションに受け取り、失敗を診断し、あなたが目覚める前にTelegramに修正サマリーを送る。「やって」と返信すれば修正を適用する。 これはポーリングでも、新しいセッションへのWebhookでもない。イベントはすでに開いているClaudeセッション、完全なコンテキストを持ったまま、に届く。 Telegram、Discord、iMessageの3プラットフォームに対応。APIキーではなくclaude aiログインが必要。 II / /batch:コマンド1つで、5〜30の並列エージェント、それぞれPRを作成 大規模な指示の後に /batch と入力すると、Claudeはコードベースを独立したユニットに分割し、承認を求め、各ユニットに対して別々のgit worktreeで独立したエージェントを生成する。 /batch migrate src/ from Solid to React 各エージェントが自分の部分を実装し、テストを実行し、プルリクエストを開く。 4000行のdiffではなく、PRのスタックが返ってくる。作業は並列で行われるので、手を放しておける。 バンドルスキルなのですべてのセッションで使える。/batch と入力したことがある人はほとんどいない。 III / エージェントチーム:あなただけでなく、お互いに話し合うチームメイト 環境変数1つで有効化し、チームを作成するよう Claude に指示してロールを説明する。 CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 「チームを作って。UX担当、アーキテクチャ担当、新しいauth フローに反論する担当」 サブエージェントはあなただけに報告するが、チームメイトはタスクリストを共有して直接メッセージし合う。 一人がセキュリティ問題を見つけてアーキテクチャ担当のチームメイトに伝える。そのチームメイトが計画を修正する。反論担当が反論し、あなたはそれを見守って必要なときに割り込む。 各チームメイトが1行も書く前に計画の承認を提出することを要求できる。「テストカバレッジを含む計画のみ承認する」という基準を設定する。リードが強制する。 IV / CLAUDE_CODE_NEW_INIT=1 フラグ付きの /init:Claude がコードベース、次にあなたにインタビューする ほとんどの人は /init を一度実行して基本的な CLAUDE.md を得る。このフラグを先に有効にすると、すべてが変わる。 CLAUDE_CODE_NEW_INIT=1 Claude はマルチステップのセットアッププロセスを実行する。コードベースをスキャンして、ビルドコマンド、テスト、アーキテクチャを特定し、次に少しの質問でギャップを埋め、何かを変更する前に確認するためにプロポーザルを見せる。 プロジェクトが実際にどう機能するかに合わせた CLAUDE.md が得られる。将来のセッションは Claude がすでにルールを知っている状態で始まる。 V / TaskCompleted フック:Claude が自分の作業を完了と呼ぶことを拒否できるシェルスクリプト フックはエージェントライフサイクルの特定の点で発火する。ほとんどの人は PreToolUse を知っているが、TaskCompleted を設定している人はほぼいない。 TaskCompleted → あなたのスクリプトが実行 → コード2で終了すると却下 コード2で終了すると、メッセージが Claude に戻る:「テストはまだ失敗している、タスクは完了していない」。Claude は作業を続け、あなたは見ていなくていい。 TaskCreated とペアにして、標準を満たさないタスクを始まる前に拒否する。 これは Claude が従うことを期待するプロンプトではなく、エージェントループ自体に組み込まれた品質強制だ。 VI / CwdChanged フック:Claude がディレクトリを変更したときに自動で環境をリロード このフックは Claude が cd コマンドを実行するたびに発火する。ドキュメントにはdirenvを使ったリアクティブな環境管理というユースケースが直接書かれている。 CwdChanged → direnv リロードをトリガー モノレポで、Claude が packages/payments に移動して課金モジュールに取り組む。そのパッケージの環境変数が自動でロードされる。Claude が packages/auth に移動すると、異なる変数が自動でリロードされる。 Claude が間違った環境でコマンドを実行してセッションが壊れることがなくなる。 VII / FileChanged フック:ディスク上のファイルが変化したときに Claude が反応する matcher フィールドがどのファイル名を監視するかをこのフックに伝える。何かが変更されると、Claude によるものでなくても、フックが発火する。 FileChanged (matcher: "package-lock.json") → セキュリティ監査を実行 依存関係のロックファイルが変更されると、Claude は自動で依存関係監査を実行する。設定ファイルが変更されると、Claude がそれを再検証する。生成されたファイルが変更されると、Claude がソースがまだ同期しているか確認する。 これにより Claude は、プロンプトするものからプロジェクトを監視して反応するものに変わる。 VIII / 特に有用なこれ:他のスキルを再実行する /loop — 任意のスキルをインターバルでスケジュール ほとんどの人はポーリング用に /loop を知っているが、ドキュメントが示しているのは、スケジュールされたプロンプトが別のスキル呼び出しになれるということだ。 /loop 20m /simplify focus on the auth module 20分ごとに、Claude が auth モジュールの現状に対して /simplify スキルを実行して報告する。 PRレビュースキル、セキュリティチェッカー、ドキュメントリンター、それらのどれでも、あなたが別の作業をしている間タイマーにセットできる。 スキルがスケジューリングと組み合わさる。ドキュメントに書いてあるが、ほぼ誰もやっていない。 IX / サブエージェントの永続メモリ:エージェントがセッションをまたいで記憶する カスタムサブエージェントを作成するとき、永続メモリディレクトリを有効にできる。 サブエージェントは学んだことをディスクに書き込み、将来のすべてのセッションの開始時にロードする。 memory: user → ~/.claude/agent-memory/ コードレビュアーがあなたのよくある非同期エラー処理の間違いを発見して記憶する。次のセッションでは、すでに把握している状態で始まる。デバッガーが共通の障害パターンを追跡する。データアナリストがあなたの好む出力形式を使い続ける。 毎回再教育が必要なツールと、あなたを学ぶツールの違いがここにある。 X / CLAUDE.md のHTMLコメント:人間にはロードされるが Claude には見えないメモ CLAUDE.md はすべてのセッションでコンテキストウィンドウにロードされる。すべての行がトークンを消費する。 しかし標準のHTMLブロックコメントは、ファイルがコンテキストに注入される前に除去される。 <!-- Last reviewed: March 2025. Update auth section after OAuth migration. --> メンテナーへのメモ、変更履歴、ルールが存在する理由の説明を残せる。コンテキストウィンドウには一切当たらず、Claude は見ない。チームメイトはファイルを開いたときに見る。 これはメモリページの1文に書かれているが、ほぼ誰も気づいていない。
原文を表示 / Show original
I went past the quickstart, past the common workflows, all the way to the hooks reference, the channels page, the experimental flags. The features there don't just save time, they change what Claude Code is: I / Channels: message Claude from Telegram, Discord, or iMessage while it works. claude --channels plugin:telegram@claude-plugins-official Start Claude with the `--channels` flag and install a plugin, once set up, Claude is reachable by DM on whichever platform you choose. Your CI fails at 2 a.m, Claude gets the event pushed into its session, diagnoses the failure, and sends you a fix summary on Telegram before you wake up. You reply with “do it” and it applies the fix. This is not polling, it’s not a webhook to a new session. The event arrives in the Claude session that’s already open, with full context. Telegram, Discord, and iMessage are the three supported platforms, it requires a claude ai login, not an API key. II / /batch: one command, 5-30 parallel agents, one PR each Type /batch followed by any large-scale instruction and Claude breaks the codebase into independent units, asks for approval, then spawns one isolated agent per unit in a separate git worktree. /batch migrate src/ from Solid to React Each agent implements its piece, runs tests, and opens a pull request. You get back a stack of PRs, not a 4000-line diff, the work happens in parallel, so you don't babysit any of it. This is a bundled skill, so it's available in every session. Most people have never typed /batch. III / Agent teams: teammates that talk to each other, not just to you Enable with one env variable, then ask Claude to create a team and describe the roles. CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 Create a team: one on UX, one on architecture, one playing devil's advocate on my new auth flow Unlike subagents, which only report back to you, teammates share a task list and message each other directly. One finds a security issue and tells the architecture teammate, that teammate revises the plan. The devil's advocate pushes back and you watch it play out and jump in when needed. You can require each teammate to submit a plan for approval before writing a single line. You set the criteria: "only approve plans that include test coverage." The lead enforces it. IV / /init with CLAUDE_CODE_NEW_INIT=1: Claude interviews your codebase, then you Most people run /init once and get a basic CLAUDE.md, enable this flag first and the whole thing changes. CLAUDE_CODE_NEW_INIT=1 Claude runs a multi-step setup flow. It scans your codebase, identifies build commands, tests, and architecture, then asks a few questions to fill the gaps, before changing anything, it shows you a proposal to review. You get a CLAUDE.md tailored to how your project actually works, so future sessions start with Claude already knowing your rules. V / TaskCompleted hook: a shell script that can veto Claude calling its own work done Hooks fire at specific points in the agent lifecycle, most people know about PreToolUse, BUT! Almost nobody configures TaskCompleted. TaskCompleted → your script runs → exit 2 to block it Exit with code 2, and your message goes back to Claude: "tests are still failing, task is not done" Claude keeps working and you never had to be watching Pair it with TaskCreated to reject tasks that don’t meet your standards before they even start. This is quality enforcement baked into the agent loop itself, not a prompt you hope Claude follows. VI / CwdChanged hook: auto-reload your env when Claude changes directories This hook fires whenever Claude executes a cd command, the docs call out its use case directly: reactive environment management with direnv. CwdChanged → trigger direnv reload You’re in a monorepo, Claude moves into packages/payments to work on the billing module, and the environment variables for that package load automatically. Claude moves to packages/auth, different vars, reloaded automatically. No more broken sessions because Claude is running commands in the wrong environment. VII / FileChanged hook: Claude reacts when a file changes on disk The matcher field tells this hook which filenames to watch, when one changes, by anything, not just Claude, the hook fires. FileChanged (matcher: "package-lock.json") → run security audit Your dependency lock file changes, Claude automatically runs a dependency audit. Your config file changes, Claude re-validates it, A generated file changes, Claude checks whether the source is still in sync. This turns Claude from something you prompt into something that watches your project and responds. VIII / THIS ESPECIALLY USEFUL ONE: /loop that re-runs other skills: schedule any skill on an interval Most people know /loop for polling, what the docs show is that the scheduled prompt can be another skill invocation. /loop 20m /simplify focus on the auth module Every 20 minutes, Claude runs your /simplify skill on the current state of the auth module and reports back. Your PR review skill, security checker, documentation linter, any of them can be set on a timer while you work on something else. Skills composing with scheduling, it’s in the docs tho almost nobody does it. IX / Subagent persistent memory: your agents remember things across sessions When creating a custom subagent, you can enable a persistent memory directory. The subagent writes what it learns to disk and loads it at the start of every future session. memory: user → ~/.claude/agent-memory/ Your code reviewer catches your recurring async error-handling mistakes and remembers them. Next session, it’s already up to speed, your debugger tracks your common failure patterns. Your data analyst sticks to your preferred outputs. That’s the difference between a tool you have to re-teach every time and one that learns you. X / HTML comments in CLAUDE.md: notes that load for humans but not Claude CLAUDE.md is loaded into the context window every session, every line costs tokens. But standard HTML block comments are stripped before the file is injected into context. <!-- Last reviewed: March 2025. Update auth section after OAuth migration. --> You can leave maintainer notes, change history, explanations of why a rule exists, none of it hits the context window, Claude never sees it, ur teammates do when they open the file. This is documented in a single sentence in the memory page, almost nobody noticed it.

AIFCC — AI Fluent CxO Club

読み書きそろばん、AI。経営者が AI を自分で動かせるようになるコミュニティ。

99.9%が無視するClaude Codeの隠し機能10選 | AIFCC