Loading...
    • 開発者ガイド
    • API リファレンス
    • MCP
    • リソース
    • リリースノート
    Search...
    ⌘K
    はじめに
    Claude の紹介クイックスタート
    モデルと料金
    モデル概要モデルの選び方Claude 4.6 の新機能移行ガイドモデルの廃止料金
    Claude で構築する
    機能概要Messages API の使用停止理由の処理プロンプトのベストプラクティス
    コンテキスト管理
    コンテキストウィンドウコンパクションコンテキスト編集
    機能
    プロンプトキャッシング拡張思考適応型思考エフォートメッセージのストリーミングバッチ処理引用多言語サポートトークンカウントエンベディングビジョンPDF サポートFiles API検索結果構造化出力
    ツール
    概要ツール使用の実装方法きめ細かいツールストリーミングBash ツールコード実行ツールプログラムによるツール呼び出しコンピュータ使用ツールテキストエディタツールWeb フェッチツールWeb 検索ツールメモリツールツール検索ツール
    Agent Skills
    概要クイックスタートベストプラクティスエンタープライズ向け SkillsAPI での Skills の使用
    Agent SDK
    概要クイックスタートTypeScript SDKTypeScript V2(プレビュー)Python SDK移行ガイド
    ストリーミング入力リアルタイムでレスポンスをストリーミング停止理由の処理権限の処理ユーザー承認と入力フックによる実行制御セッション管理ファイルチェックポイントSDK での構造化出力Agent SDK のホスティングAI エージェントの安全なデプロイシステムプロンプトの変更SDK での MCPカスタムツールSDK でのサブエージェントSDK でのスラッシュコマンドSDK での Agent Skillsコストと使用量の追跡Todo リストSDK でのプラグイン
    API での MCP
    MCP コネクタリモート MCP サーバー
    サードパーティプラットフォームの Claude
    Amazon BedrockMicrosoft FoundryVertex AI
    プロンプトエンジニアリング
    概要プロンプトジェネレータープロンプトテンプレートの使用プロンプト改善ツール明確かつ直接的に例を使う(マルチショットプロンプティング)Claude に考えさせる(CoT)XML タグを使うClaude に役割を与える(システムプロンプト)複雑なプロンプトを連鎖させる長文コンテキストのヒント拡張思考のヒント
    テストと評価
    成功基準の定義テストケースの開発評価ツールの使用レイテンシの削減
    ガードレールの強化
    ハルシネーションの削減出力の一貫性を高めるジェイルブレイクの軽減ストリーミング拒否プロンプト漏洩の防止Claude をキャラクターに保つ
    管理とモニタリング
    Admin API 概要データレジデンシーワークスペースUsage and Cost 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 シングルモード
    • カスタムツール

    Was this page helpful?

    • Todoのライフサイクル
    • Todoが使用される場合
    • Todo変更の監視