Loading...
    • 開発者ガイド
    • APIリファレンス
    • MCP
    • リソース
    • リリースノート
    Search...
    ⌘K
    最初のステップ
    Claudeの紹介クイックスタート
    モデルと価格
    モデル概要モデルの選択Claude 4.5の新機能Claude 4.5への移行モデルの廃止予定価格
    Claudeで構築
    機能概要Messages APIの使用コンテキストウィンドウプロンプトのベストプラクティス
    機能
    プロンプトキャッシングコンテキスト編集拡張思考エフォートストリーミングメッセージバッチ処理引用多言語対応トークンカウント埋め込みビジョンPDF対応Files API検索結果構造化出力
    ツール
    概要ツール使用の実装方法細粒度ツールストリーミングBashツールコード実行ツールプログラマティックツール呼び出しコンピュータ使用ツールテキストエディタツールWebフェッチツールWeb検索ツールメモリツールツール検索ツール
    エージェントスキル
    概要クイックスタートベストプラクティスAPIでスキルを使用
    Agent SDK
    概要クイックスタートTypeScript SDKTypeScript V2(プレビュー)Python SDK移行ガイド
    ストリーミング入力権限の処理フックで実行を制御セッション管理ファイルチェックポイントSDKの構造化出力Agent SDKのホスティングAIエージェントの安全なデプロイシステムプロンプトの変更SDKのMCPカスタムツールSDKのサブエージェントSDKのスラッシュコマンドSDKのエージェントスキルコストと使用状況の追跡ToDoリストSDKのプラグイン
    APIのMCP
    MCPコネクタリモートMCPサーバー
    サードパーティプラットフォームのClaude
    Amazon BedrockMicrosoft FoundryVertex AI
    プロンプトエンジニアリング
    概要プロンプトジェネレータプロンプトテンプレートの使用プロンプト改善ツール明確で直接的に例を使用(マルチショットプロンプティング)Claudeに考えさせる(CoT)XMLタグを使用Claudeに役割を与える(システムプロンプト)Claudeの応答を事前入力複雑なプロンプトをチェーン長いコンテキストのヒント拡張思考のヒント
    テストと評価
    成功基準の定義テストケースの開発評価ツールの使用レイテンシの削減
    ガードレールの強化
    ハルシネーションの削減出力の一貫性を向上ジェイルブレイクの軽減ストリーミング拒否プロンプトリークの削減Claudeをキャラクターのままに
    管理とモニタリング
    Admin API概要使用状況とコストAPIClaude Code Analytics API
    Console
    Log in
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...

    Solutions

    • AI agents
    • Code modernization
    • Coding
    • Customer support
    • Education
    • Financial services
    • Government
    • Life sciences

    Partners

    • Amazon Bedrock
    • Google Cloud's Vertex AI

    Learn

    • Blog
    • Catalog
    • Courses
    • Use cases
    • Connectors
    • Customer stories
    • Engineering at Anthropic
    • Events
    • Powered by Claude
    • Service partners
    • Startups program

    Company

    • Anthropic
    • Careers
    • Economic Futures
    • Research
    • News
    • Responsible Scaling Policy
    • Security and compliance
    • Transparency

    Learn

    • Blog
    • Catalog
    • Courses
    • Use cases
    • Connectors
    • Customer stories
    • Engineering at Anthropic
    • Events
    • Powered by Claude
    • Service partners
    • Startups program

    Help and security

    • Availability
    • Status
    • Support
    • Discord

    Terms and policies

    • Privacy policy
    • Responsible disclosure policy
    • Terms of service: Commercial
    • Terms of service: Consumer
    • Usage policy
    ガイド

    Todo リスト

    整理されたタスク管理のためにClaude Agent SDKを使用してtodoを追跡・表示する

    Todo追跡は、タスクを管理し、ユーザーに進捗を表示するための構造化された方法を提供します。Claude Agent SDKには、複雑なワークフローを整理し、タスクの進行状況についてユーザーに情報を提供するのに役立つ組み込みのtodo機能が含まれています。

    Todoのライフサイクル

    Todoは予測可能なライフサイクルに従います:

    1. タスクが特定されたときにpendingとして作成される
    2. 作業が開始されたときにin_progressにアクティブ化される
    3. タスクが正常に完了したときに完了する
    4. グループ内のすべてのタスクが完了したときに削除される

    Todoが使用される場合

    SDKは以下の場合に自動的にtodoを作成します:

    • 3つ以上の異なるアクションを必要とする複雑な複数ステップのタスク
    • 複数の項目が言及されているユーザー提供のタスクリスト
    • 進捗追跡の恩恵を受ける重要な操作
    • ユーザーがtodo整理を求める明示的な要求

    例

    Todo変更の監視

    import { query } from "@anthropic-ai/claude-agent-sdk";
    
    for await (const message of query({
      prompt: "React アプリのパフォーマンスを最適化し、todoで進捗を追跡する",
      options: { maxTurns: 15 }
    })) {
      // Todo更新はメッセージストリームに反映されます
      if (message.type === "tool_use" && message.name === "TodoWrite") {
        const todos = message.input.todos;
        
        console.log("Todoステータス更新:");
        todos.forEach((todo, index) => {
          const status = todo.status === "completed" ? "✅" : 
                        todo.status === "in_progress" ? "🔧" : "❌";
          console.log(`${index + 1}. ${status} ${todo.content}`);
        });
      }
    }

    リアルタイム進捗表示

    import { query } from "@anthropic-ai/claude-agent-sdk";
    
    class TodoTracker {
      private todos: any[] = [];
      
      displayProgress() {
        if (this.todos.length === 0) return;
        
        const completed = this.todos.filter(t => t.status === "completed").length;
        const inProgress = this.todos.filter(t => t.status === "in_progress").length;
        const total = this.todos.length;
        
        console.log(`\n進捗: ${completed}/${total} 完了`);
        console.log(`現在作業中: ${inProgress} タスク\n`);
        
        this.todos.forEach((todo, index) => {
          const icon = todo.status === "completed" ? "✅" : 
                      todo.status === "in_progress" ? "🔧" : "❌";
          const text = todo.status === "in_progress" ? todo.activeForm : todo.content;
          console.log(`${index + 1}. ${icon} ${text}`);
        });
      }
      
      async trackQuery(prompt: string) {
        for await (const message of query({
          prompt,
          options: { maxTurns: 20 }
        })) {
          if (message.type === "tool_use" && message.name === "TodoWrite") {
            this.todos = message.input.todos;
            this.displayProgress();
          }
        }
      }
    }
    
    // 使用方法
    const tracker = new TodoTracker();
    await tracker.trackQuery("todoを使用して完全な認証システムを構築する");

    関連ドキュメント

    • TypeScript SDK リファレンス
    • Python SDK リファレンス
    • ストリーミング vs シングルモード
    • カスタムツール
    • Todoのライフサイクル
    • Todoが使用される場合
    • Todo変更の監視