docs/tutorial.md
This tutorial will guide you through setting up and using Task Master for AI-driven development.
There are two ways to set up Task Master: using MCP (recommended) or via npm installation.
MCP (Model Control Protocol) provides the easiest way to get started with Task Master directly in your editor.
npm i -g task-master-ai
{
"mcpServers": {
"taskmaster-ai": {
"command": "npx",
"args": ["-y", "task-master-ai"],
"env": {
"ANTHROPIC_API_KEY": "YOUR_ANTHROPIC_API_KEY_HERE",
"PERPLEXITY_API_KEY": "YOUR_PERPLEXITY_API_KEY_HERE",
"OPENAI_API_KEY": "YOUR_OPENAI_KEY_HERE",
"GOOGLE_API_KEY": "YOUR_GOOGLE_KEY_HERE",
"MISTRAL_API_KEY": "YOUR_MISTRAL_KEY_HERE",
"OPENROUTER_API_KEY": "YOUR_OPENROUTER_KEY_HERE",
"XAI_API_KEY": "YOUR_XAI_KEY_HERE",
"AZURE_OPENAI_API_KEY": "YOUR_AZURE_KEY_HERE"
}
}
}
}
IMPORTANT: An API key is required for each AI provider you plan on using. Run the task-master models command to see your selected models and the status of your API keys across .env and mcp.json
To use AI commands in CLI you MUST have API keys in the .env file To use AI commands in MCP you MUST have API keys in the .mcp.json file (or MCP config equivalent)
We recommend having keys in both places and adding mcp.json to your gitignore so your API keys aren't checked into git.
Enable the MCP in your editor settings
Prompt the AI to initialize Task Master:
Can you please initialize taskmaster-ai into my project?
The AI will:
Place your PRD document in the .taskmaster/docs/ directory (e.g., .taskmaster/docs/prd.txt)
Use natural language commands to interact with Task Master:
Can you parse my PRD at .taskmaster/docs/prd.txt?
What's the next task I should work on?
Can you help me implement task 3?
If you prefer to use the command line interface directly:
# Install globally
npm install -g task-master-ai
# OR install locally within your project
npm install task-master-ai
Initialize a new project:
# If installed globally
task-master init
# If installed locally
npx task-master init
This will prompt you for project details and set up a new project with the necessary files and structure.
After setting up Task Master, you can use these commands (either via AI prompts or CLI):
# Parse a PRD and generate tasks
task-master parse-prd your-prd.txt
# List all tasks
task-master list
# Show the next task to work on
task-master next
Task Master is designed to work seamlessly with Cursor AI, providing a structured workflow for AI-driven development.
If you've already set up Task Master with MCP in Cursor, the integration is automatic. You can simply use natural language to interact with Task Master:
What tasks are available to work on next?
Can you analyze the complexity of our tasks?
I'd like to implement task 4. What does it involve?
If you're not using MCP, you can still set up Cursor integration:
.cursor/rules/dev_workflow.mdc file is automatically loaded by Cursor, providing the AI with knowledge about the task management system.taskmaster/docs/ directory (e.g., .taskmaster/docs/prd.txt)You can also set up the MCP server in Cursor settings:
Once configured, you can interact with Task Master's task management commands directly through Cursor's interface, providing a more integrated experience.
In Cursor's AI chat, instruct the agent to generate tasks from your PRD:
Please use the task-master parse-prd command to generate tasks from my PRD. The PRD is located at .taskmaster/docs/prd.txt.
The agent will execute:
task-master parse-prd .taskmaster/docs/prd.txt
This will:
tasks.json file with tasks, dependencies, priorities, and test strategiesNext, ask the agent to generate individual task files:
Please generate individual task files from tasks.json
The Cursor agent is pre-configured (via the rules file) to follow this workflow:
Ask the agent to list available tasks:
What tasks are available to work on next?
Can you show me tasks 1, 3, and 5 to understand their current status?
The agent will:
task-master list to see all taskstask-master next to determine the next task to work ontask-master show 1,3,5 to display multiple tasks with interactive optionsWhen implementing a task, the agent will:
You can ask:
Let's implement task 3. What does it involve?
For efficient context gathering and batch operations:
Show me tasks 5, 7, and 9 so I can plan my implementation approach.
The agent will:
task-master show 5,7,9 to display a compact summary tableBefore marking a task as complete, verify it according to:
When a task is completed, tell the agent:
Task 3 is now complete. Please update its status.
The agent will execute:
task-master set-status --id=3 --status=done
If during implementation, you discover that:
Tell the agent:
We've decided to use MongoDB instead of PostgreSQL. Can you update all future tasks (from ID 4) to reflect this change?
The agent will execute:
task-master update --from=4 --prompt="Now we are using MongoDB instead of PostgreSQL."
# OR, if research is needed to find best practices for MongoDB:
task-master update --from=4 --prompt="Update to use MongoDB, researching best practices" --research
This will rewrite or re-scope subsequent tasks in tasks.json while preserving completed work.
If you need to reorganize your task structure:
I think subtask 5.2 would fit better as part of task 7 instead. Can you move it there?
The agent will execute:
task-master move --from=5.2 --to=7.3
You can reorganize tasks in various ways:
--from=5 --to=7--from=5.2 --to=7--from=5.2 --to=7.3--from=5.2 --to=5.4--from=5 --to=25 (even if task 25 doesn't exist yet)--from=10,11,12 --to=16,17,18 (must have same number of IDs, Taskmaster will look through each position)When moving tasks to new IDs:
This is particularly useful as your project understanding evolves and you need to refine your task structure.
When working with a team, you might encounter merge conflicts in your tasks.json file if multiple team members create tasks on different branches. The move command makes resolving these conflicts straightforward:
I just merged the main branch and there's a conflict with tasks.json. My teammates created tasks 10-15 while I created tasks 10-12 on my branch. Can you help me resolve this?
The agent will help you:
# Move your tasks to new positions (e.g., 16-18)
task-master move --from=10 --to=16
task-master move --from=11 --to=17
task-master move --from=12 --to=18
This approach preserves everyone's work while maintaining a clean task structure, making it much easier to handle task conflicts than trying to manually merge JSON files.
For complex tasks that need more granularity:
Task 5 seems complex. Can you break it down into subtasks?
The agent will execute:
task-master expand --id=5 --num=3
You can provide additional context:
Please break down task 5 with a focus on security considerations.
The agent will execute:
task-master expand --id=5 --prompt="Focus on security aspects"
You can also expand all pending tasks:
Please break down all pending tasks into subtasks.
The agent will execute:
task-master expand --all
For research-backed subtask generation using the configured research model:
Please break down task 5 using research-backed generation.
The agent will execute:
task-master expand --id=5 --research
I've just initialized a new project with Claude Task Master. I have a PRD at .taskmaster/docs/prd.txt.
Can you help me parse it and set up the initial tasks?
What's the next task I should work on? Please consider dependencies and priorities.
I'd like to implement task 4. Can you help me understand what needs to be done and how to approach it?
I need to regenerate the subtasks for task 3 with a different approach. Can you help me clear and regenerate them?
We've decided to use MongoDB instead of PostgreSQL. Can you update all future tasks to reflect this change?
I've finished implementing the authentication system described in task 2. All tests are passing.
Please mark it as complete and tell me what I should work on next.
Can you analyze the complexity of our tasks to help me understand which ones need to be broken down further?
Can you show me the complexity report in a more readable format?
Task Master includes a powerful research tool that provides fresh, up-to-date information beyond the AI's knowledge cutoff. This is particularly valuable for:
Before implementing task 5 (authentication), research the latest JWT security recommendations.
The agent will execute:
task-master research "Latest JWT security recommendations 2024" --id=5
Research React Query v5 migration strategies for our current API implementation.
The agent will execute:
task-master research "React Query v5 migration strategies" --files=src/api.js,src/hooks.js
A powerful workflow is to research first, then update tasks with findings:
Research the latest Node.js performance optimization techniques and update task 12 with the findings.
The agent will:
task-master research "Node.js performance optimization 2024" --id=12task-master update-subtask --id=12.2 --prompt="Updated with latest performance findings: [research results]"The research tool automatically includes relevant project context and provides fresh information that can significantly improve implementation quality.
Task Master supports tagged task lists for multi-context development, which is particularly useful when working with git branches or different project phases.
Tags provide isolated task contexts, allowing you to maintain separate task lists for different features, branches, or experiments:
I'm starting work on a new feature branch. Can you create a new tag for this work?
The agent will execute:
# Create a tag based on your current git branch
task-master add-tag --from-branch
Or you can create a tag with a specific name:
Create a new tag called 'user-auth' for authentication-related tasks.
The agent will execute:
task-master add-tag user-auth --description="User authentication feature tasks"
When working on different features or branches:
Switch to the 'user-auth' tag context so I can work on authentication tasks.
The agent will execute:
task-master use-tag user-auth
When you need to duplicate work across contexts:
Copy all tasks from the current tag to a new 'testing' tag for QA work.
The agent will execute:
task-master add-tag testing --copy-from-current --description="QA and testing tasks"
View and manage your tag contexts:
Show me all available tags and their current status.
The agent will execute:
task-master tags --show-metadata
A typical git workflow with Task Master tags:
git checkout -b feature/user-authtask-master add-tag --from-branchtask-master use-tag <name> to switch between different work streamstask-master delete-tag <name>This workflow ensures your task management stays organized and conflicts are minimized when working with teams or multiple features simultaneously.