From deepagents-skills
Use the write_todos tool effectively for task planning and decomposition in Deep Agents. Use when users want to (1) implement task planning with write_todos, (2) break down complex tasks into subtasks, (3) track agent progress through todos, (4) debug why todos aren't completing, (5) design todo structures for different task types (research, coding, analysis), (6) understand todo status lifecycle and best practices, or (7) visualize todo progression from LangSmith traces.
How this skill is triggered — by the user, by Claude, or both
Slash command
/deepagents-skills:deepagents-planning-todosThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Master the `write_todos` tool for effective task planning and decomposition in Deep Agents.
Master the write_todos tool for effective task planning and decomposition in Deep Agents.
| Use write_todos | Execute Directly |
|---|---|
| ✅ Complex multi-step tasks (3-6 steps) | ✅ Simple 1-2 step queries |
| ✅ Tasks requiring user approval first | ✅ Single tool calls |
| ✅ Long-running workflows needing progress tracking | ✅ Quick information lookups |
| ✅ Tasks where planning adds clarity | ✅ Straightforward API calls |
Decision rule: If you'd benefit from showing the user "Here's my plan..." before starting, use write_todos.
from deepagents import create_deep_agent
# TodoListMiddleware is included by default in create_deep_agent
agent = create_deep_agent(
model="anthropic:claude-sonnet-4-5-20250929",
tools=[search_tool, summarize_tool],
system_prompt="You are a research assistant. Use write_todos for multi-step tasks."
)
# Agent workflow:
# 1. Call write_todos with initial plan
# 2. Ask user: "Does this plan look good?"
# 3. User approves → start executing
# 4. Update the todo list as work progresses
# 5. Keep todos aligned with the current plan and execution state
Example todo creation:
# Agent calls write_todos internally:
{
"name": "write_todos",
"arguments": {
"todos": [
{"content": "Search for papers on LLM agents", "status": "pending"},
{"content": "Read and extract findings from top 5 papers", "status": "pending"},
{"content": "Identify common themes", "status": "pending"},
{"content": "Write summary report", "status": "pending"}
]
}
}
{
"content": "Task description (clear, actionable)",
"status": "pending" | "in_progress" | "completed"
}
Full-list updates: Treat each write_todos call as a full state update and include all active todos.
Per-turn discipline: Prefer one write_todos update per model turn to avoid conflicting plan changes.
Best granularity: Keep lists to 3-6 items maximum (avoid over-fragmentation).
Deep Agents documentation describes write_todos as the built-in interface for todo planning/tracking.
Keep todo state accurate by rewriting the list with updated statuses as execution progresses.
pending → in_progress → completed
Best practices:
"status": "pending" for newly planned work."in_progress" when starting work on a todo."completed" when finished (don't delete - keeps context).Typical workflow:
# Step 1: Create initial plan (all pending)
write_todos([
{"content": "Research topic", "status": "pending"},
{"content": "Write summary", "status": "pending"}
])
# Step 2: Ask user approval
# User: "Yes, proceed"
# Step 3: Start first task
write_todos([
{"content": "Research topic", "status": "in_progress"},
{"content": "Write summary", "status": "pending"}
])
# Step 4: Complete first task, start second
write_todos([
{"content": "Research topic", "status": "completed"},
{"content": "Write summary", "status": "in_progress"}
])
# Step 5: Finish all tasks
write_todos([
{"content": "Research topic", "status": "completed"},
{"content": "Write summary", "status": "completed"}
])
| Task Type | Pattern | Example Todos |
|---|---|---|
| Research | gather → synthesize → report | Search docs, Read examples, Analyze patterns, Synthesize findings |
| Coding | design → implement → test | Design API, Implement endpoints, Write tests, Test end-to-end |
| Analysis | collect → process → analyze | Collect data, Process traces, Analyze patterns, Visualize results |
| Document Processing | read → extract → transform | Read files, Extract key info, Transform format, Output result |
For detailed patterns with code examples, see references/todo-patterns.md.
Symptom: Todo stuck in in_progress, agent loops or gets confused.
Causes & fixes:
Symptom: Agent creates todos but doesn't follow them.
Causes & fixes:
Symptom: 10+ todos, hard to track, agent overwhelmed.
Causes & fixes:
references/todo-patterns.md).Symptom: Agent loses track of what's been done.
Causes & fixes:
FilesystemBackend or StoreBackend for long sessions.write_todos whenever status changes or scope shifts.MemoryMiddleware for long-term context.Use the included script to parse LangSmith traces and visualize todo progression:
# Export trace from LangSmith (download JSON)
# Then run:
uv run skills/deepagents-planning-todos/scripts/visualize_todos.py trace.json
# Show Mermaid diagram:
uv run skills/deepagents-planning-todos/scripts/visualize_todos.py trace.json --format mermaid
# Show full timeline:
uv run skills/deepagents-planning-todos/scripts/visualize_todos.py trace.json --show-timeline
Output example:
Todo Timeline for trace abc123:
Initial Plan (Step 1):
⏳ [pending] Search for papers on LLM agents
⏳ [pending] Read and extract findings
⏳ [pending] Identify common themes
⏳ [pending] Write summary report
Final State:
✅ [completed] Search for papers on LLM agents
✅ [completed] Read and extract findings
✅ [completed] Identify common themes
✅ [completed] Write summary report
References (detailed patterns):
references/todo-patterns.md: Task-specific patterns with code examplesExamples (working code):
assets/examples/todo-driven-agent/: Research agent demonstrating full workflowExample structures (templates):
assets/todo-structures/research-todos.json: Research task breakdownassets/todo-structures/coding-todos.json: Coding task breakdownExternal docs:
npx claudepluginhub mindxpansion/langchain-agent-skills --plugin langgraph-skillsGuides collaborative design exploration before implementation: explores context, asks clarifying questions, proposes approaches, and writes a design doc for user approval.
Creates structured, bite-sized implementation plans from specs or requirements before writing code. Useful for breaking down multi-step tasks into testable steps with file structure and task boundaries.
Implements work from a spec or tickets using TDD at agreed seams, with regular typechecking and test runs, followed by code review.