一行要約

日常作業のレシピ集。プロンプトの型が「広く聞く → 絞る → 適用する → 検証する」の4段で統一されているのが実質的な教訓で、後半にセッション再開・worktree 並列・plan mode・subagent 委譲・スクリプト連携の5つの運用パターンがある。

要点

プロンプトのレシピ

新しいコードベースを理解する — 広い問いから始めて絞る。

give me an overview of this codebase
explain the main architecture patterns used here
what are the key data models?
how is authentication handled?

Tips: プロジェクト固有の用語集を作らせるのも有効。

関連コードを探す:

find the files that handle user authentication
how do these authentication files work together?
trace the login process from front-end to database

バグを直す再現コマンドとスタックトレースを Claude に伝えるのが要点。断続的か常時かも伝える。

I'm seeing an error when I run npm test
suggest a few ways to fix the @ts-ignore in user.ts
update user.ts to add the null check you suggested

リファクタする小さくテスト可能な単位で。後方互換が要るなら明示する。

find deprecated API usage in our codebase
suggest how to refactor utils.js to use modern JavaScript features
refactor utils.js to use ES2024 features while maintaining the same behavior
run tests for the refactored code

テストを書く:

find functions in NotificationsService.swift that are not covered by tests
add tests for the notification service
add test cases for edge conditions in the notification service
run the new tests and fix any failures

Claude examines your existing test files to match the style, frameworks, and assertion patterns already in use. Claude は既存のテストファイルを調べ、すでに使われている書き方・フレームワーク・アサーションの型に合わせる

PR を作る:

summarize the changes I've made to the authentication module
create a pr
enhance the PR description with more context about the security improvements

gh pr create で PR を作ると、セッションが自動的にその PR に紐づく。後で claude --from-pr 1234 で、その PR に紐づくセッションに絞った picker が開く。

ドキュメントを書く:

find functions without proper JSDoc comments in the auth module
add JSDoc comments to the undocumented functions in auth.js
improve the generated documentation with more context and examples
check if the documentation follows our project standards

コード以外のフォルダで使う

Claude Code works in any directory. Run it inside a notes vault, a documentation folder, or any collection of markdown files. Claude Code はどのディレクトリでも動く。メモの保管庫、ドキュメントのフォルダ、あるいは markdown ファイルの集まりの中でも走らせられる。

.claude/CLAUDE.md は他ツールの設定ディレクトリと衝突せずに共存する。 Claude はツール呼び出しのたびにファイルを読み直すので、他のアプリで編集した内容も次の読み取りで反映される

画像を使う — ドラッグ&ドロップ、Ctrl+V(macOS の iTerm2 では Cmd+V も)、パスを渡す。

Here's a screenshot of the error. What's causing it?
This is our current database schema. How should we modify it for the new feature?
Generate CSS to match this design mockup

ファイルとディレクトリを @ で参照する:

Explain the logic in @src/utils/auth.js
What's the structure of @src/components?
Show me the data from @github:repos/owner/repo/issues

@ によるファイル参照は、そのファイルのディレクトリと親ディレクトリの CLAUDE.md も context に追加する。 ディレクトリ参照は一覧を出すだけで内容は読まない。

Claude 自身に機能を聞く — Claude は使っているバージョンに関わらず、常に最新の Claude Code ドキュメントにアクセスできる

can Claude Code create pull requests?
how does Claude Code handle permissions?
what skills are available?

スケジュール実行の4つの選択肢

選択肢実行場所向く用途
Routinesクラウド(既定で Anthropic 管理)PC が落ちていても走るべきタスク。スケジュールに加えて API 呼び出しや GitHub イベントでも起動できる
Desktop scheduled tasks自分のマシン(デスクトップアプリ経由)ローカルファイル・ツール・未コミットの変更への直接アクセスが要るもの
GitHub ActionsCI パイプラインPR オープンのようなリポジトリイベントに紐づくもの
/loop現在の CLI セッションセッションが開いている間の手軽なポーリング

When writing prompts for scheduled tasks, be explicit about what success looks like and what to do with results. The task runs autonomously, so it can’t ask clarifying questions. スケジュール実行するタスクのプロンプトを書くときは、何をもって成功とするか、結果をどう扱うかを明示せよ。タスクは自律的に走るので、確認の質問をすることができない

5つの運用パターン

1. 会話を再開する

claude --continue          # カレントディレクトリの最新セッション
claude --resume            # 一覧から選ぶ

2. worktree で並列セッションを走らせる

claude --worktree feature-auth

リポジトリに最低1つのコミットが必要(既存コミットから作るため)。コミットがないと Failed to resolve base branch "HEAD" で失敗する。

3. 編集の前に計画する

claude --permission-mode plan

4. 調査を subagent に委譲する

use a subagent to investigate how our auth system handles token refresh

5. スクリプトにパイプする

git log --oneline -20 | claude -p "summarize these recent commits"

そのまま使える具体例

コードベース理解の4段(広く → 絞る):

give me an overview of this codebase
explain the main architecture patterns used here
what are the key data models?
how is authentication handled?

リファクタの4段(特定 → 提案 → 適用 → 検証):

find deprecated API usage in our codebase
suggest how to refactor utils.js to use modern JavaScript features
refactor utils.js to use ES2024 features while maintaining the same behavior
run tests for the refactored code

スケジュールタスク用プロンプトの書き方(成功の定義と結果の扱いを明示する):

Review open PRs labeled `needs-review`, leave inline comments on any issues,
and post a summary in the `#eng-reviews` Slack channel.

主要コマンド:

claude --continue                    # 最新セッションを再開
claude --resume                      # 一覧から選ぶ
claude --worktree feature-auth       # 隔離された並列セッション
claude --permission-mode plan        # 計画から始める
claude --from-pr 1234                # その PR に紐づくセッションを探す
git log --oneline -20 | claude -p "summarize these recent commits"
/powerup    アニメーション付きの対話レッスン

原典で言及されている関連文書

未取得の派生リンク