This skill provides guidance on using the mcp-tasks MCP server for task and story management.
Provides task and story management using the mcp-tasks MCP server. Triggers when users request task creation, refinement, or execution via slash commands like `/mcp-tasks:execute-task` or direct instructions to "work on task N".
/plugin marketplace add hugoduncan/mcp-tasks/plugin install mcp-tasks-skill@mcp-tasksThis skill inherits all available tools. When active, it can use any tool Claude has access to.
This skill provides guidance on using the mcp-tasks MCP server for task and story management.
The mcp-tasks MCP server provides:
| Tool | Purpose | Key Parameters |
|---|---|---|
select-tasks | Query tasks with filtering | task-id, parent-id, category, type, status, title-pattern, limit, unique |
add-task | Create new task | Required: category, title. Optional: description, parent-id, type, prepend |
update-task | Update task fields | Required: task-id. Optional: title, description, design, category, type, status, parent-id, meta, relations |
complete-task | Mark complete and archive | Identify by task-id or title. Optional: completion-comment |
delete-task | Delete task | Identify by task-id or title-pattern. Cannot delete with non-closed children |
work-on - Prepares task execution environment (called automatically by execute prompts)
task-id:task-id, :category, :type, :title, :status), environment info (:worktree-path, :worktree-name, :branch-name, :worktree-clean?, :worktree-created?), state file pathEach activity can be invoked via slash command or by programmatically accessing the MCP resource using ReadMcpResourceTool.
Execute task by criteria
/mcp-tasks:execute-task [selection-criteria...]category=X, parent-id=N, type=X (combinable)prompt://execute-taskExecute next task for category
/mcp-tasks:next-<category>prompt://next-<category>Refine task
/mcp-tasks:refine-task [task-spec] [context...]prompt://refine-taskCreate story tasks
/mcp-tasks:create-story-tasks [story-spec] [context...]prompt://create-story-tasksExecute story task
/mcp-tasks:execute-story-child [story-spec] [context...]prompt://execute-story-childCreate story PR
/mcp-tasks:create-story-pr [story-spec]prompt://create-story-prReview story implementation
/mcp-tasks:review-story-implementation [story-spec]prompt://review-story-implementationComplete story
/mcp-tasks:complete-story [story-spec]prompt://complete-storyStory creation and task breakdown are separate workflow steps.
When creating a story via add-task:
create-story-tasksThis separation ensures the user can:
Correct workflow:
1. User requests story creation
2. Agent creates story with add-task (type: story)
3. Agent stops and informs user story is created
4. User reviews story, optionally requests refinement
5. User explicitly requests task breakdown
6. Agent invokes create-story-tasks
Incorrect workflow (never do this):
1. User requests story creation
2. Agent creates story with add-task
3. Agent immediately invokes create-story-tasks ← WRONG
Stories maintain a shared context (:shared-context field) that
enables inter-task communication during story execution. This allows
child tasks to coordinate by reading context from previous tasks and
appending discoveries, decisions, and important information for
subsequent tasks.
How It Works:
:parent-shared-context field returned by select-tasksupdate-task with the story's task ID.mcp-tasks-current.edn) and automatically prefixes each entry with "Task NNN: "Context Precedence Rule:
Shared context takes precedence over a task's static :description and
:design fields when conflicts exist or new information emerges. This
ensures tasks work with the most current state.
When to Update Shared Context:
Update during execution when you:
The system automatically prefixes your update with "Task NNN:" where NNN is the current task ID. Multiple updates accumulate with newest first.
Key Points:
update-task)Category instructions:
prompt://category-<category> - Execution instructions for specific category (e.g., prompt://category-simple)Execution state:
resource://current-execution - Current execution state (story-id, task-id, started-at);; Example: Access execute-task prompt
(ReadMcpResourceTool
:server "mcp-tasks"
:uri "prompt://execute-task")
Common workflow: All execution activities follow: Find task → Call work-on → Execute category workflow → Mark complete
Execute simple task:
/mcp-tasks:next-simple
Story workflow:
/mcp-tasks:create-story-tasks 59 # Break into tasks
/mcp-tasks:execute-story-child 59 # Execute (repeat for each task)
/mcp-tasks:review-story-implementation 59
/mcp-tasks:complete-story 59
Refine then execute:
/mcp-tasks:refine-task 123
/mcp-tasks:execute-task task-id=123
.mcp-tasks/ directory:worktree-management? enabled in .mcp-tasks.edn:base-branch configured for branch managementThis section covers two workflows: Standalone Tasks and Story-Based Workflows.
Example: Executing standalone task #123 "Add user authentication" (category: medium).
/mcp-tasks:refine-task 123
What happens:
update-task toolmeta: {"refined": "true"}When to skip: Simple tasks with clear requirements need no refinement.
/mcp-tasks:execute-task task-id=123
Behind the scenes - work-on tool (automatic):
The execute prompt calls work-on which:
.mcp-tasks-current.edn:worktree-management? enabled)123-add-user-authentication (if branch management configured)See work-on Tool Reference for complete return value specification.
Agent displays working environment:
Worktree: project-123-add-user-authentication
Directory: /Users/user/project-123-add-user-authentication
Branch: 123-add-user-authentication
Category workflow execution (medium):
After successful implementation, the agent calls:
(complete-task :task-id 123 :completion-comment "Implemented JWT auth")
What happens:
:closedtasks.ednl to complete.ednl.mcp-tasks-current.edn:worktree-management? enabled) - see Worktree Cleanup Mechanism| Feature | Enabled | Disabled |
|---|---|---|
| Worktree Management | Creates sibling directory worktree, auto-cleanup on completion | Works in current directory |
| Branch Management | Creates <id>-<title-slug> branch automatically | Uses current branch |
See Git Integration for naming conventions and Error Recovery for failure handling.
Example: Story #408 "Improve mcp-tasks skill" with multiple child tasks.
/mcp-tasks:refine-task 408
What happens:
update-task toolmeta: {"refined": "true"}Note: The create-story-tasks prompt will halt and require explicit user confirmation to proceed if story is unrefined. Agents must never proceed automatically.
/mcp-tasks:create-story-tasks 408
What happens:
select-tasks (type: story)add-task with:
parent-id: Story ID (408)category: Appropriate category per tasktype: Usually :task, :feature, or :bugExample tasks created:
Task #410: Add walkthrough section (category: medium, parent-id: 408)
Task #411: Document git integration (category: medium, parent-id: 408)
Task #412: Add error recovery section (category: simple, parent-id: 408)
/mcp-tasks:execute-story-child 408
What happens:
work-on tool with task IDproject-408-improve-mcp-tasks-skill/408-improve-mcp-tasks-skillcomplete-taskRepeat until all story tasks complete.
/mcp-tasks:create-story-pr 408
What happens:
select-tasksPrerequisites:
gh CLI or similar tool available/mcp-tasks:complete-story 408
What happens:
Worktree cleanup: After PR is merged, manually remove worktree:
git worktree remove /path/to/project-408-improve-mcp-tasks-skill
Or if automatic cleanup enabled, it happens on last task completion.
| Context | Invocation | Who Calls |
|---|---|---|
| Execute prompts | Automatic | Execute prompt calls work-on before category workflow |
| Manual setup | Manual | User calls work-on directly via tool |
| Typical use | Automatic | Most users never call work-on directly |
When to call manually:
Agents must call the work-on tool explicitly when the user instructs them to work on a specific task or story:
User instruction patterns requiring explicit work-on call:
Process:
mcp__mcp-tasks__work-on with the task IDContrast with execute prompts:
/mcp-tasks:execute-story-child) call work-on automaticallywork-on before proceedingwork-on returns a map with task and environment information:
| Field | Type | Always Present | Description |
|---|---|---|---|
:task-id | int | Yes | Task ID being worked on |
:category | string | Yes | Task category |
:type | keyword | Yes | Task type (:task, :bug, :feature, :story, :chore) |
:title | string | Yes | Task title |
:status | keyword | Yes | Task status (:open, :in-progress, :blocked, :closed) |
:message | string | Yes | Status message about operation |
:execution-state-file | string | Yes | Path to .mcp-tasks-current.edn |
:worktree-path | string | Conditional | Full path to worktree (only if in worktree) |
:worktree-name | string | Conditional | Worktree directory name (only if :worktree-path present) |
:branch-name | string | Conditional | Current branch name (only if branch management active) |
:worktree-clean? | boolean | Conditional | No uncommitted changes (only if in worktree) |
:worktree-created? | boolean | Conditional | New worktree created vs reused (only if in worktree) |
Example response (with worktree management enabled):
{:task-id 123
:category "medium"
:type :task
:title "Add user authentication"
:status :open
:message "Task validated successfully and execution state written"
:worktree-path "/Users/user/project-123-add-user-authentication"
:worktree-name "project-123-add-user-authentication"
:branch-name "123-add-user-authentication"
:worktree-clean? true
:worktree-created? true
:execution-state-file "/Users/user/project-123-add-user-authentication/.mcp-tasks-current.edn"}
Example response (worktree management disabled):
{:task-id 123
:category "medium"
:type :task
:title "Add user authentication"
:status :open
:message "Task validated successfully and execution state written"
:execution-state-file ".mcp-tasks-current.edn"}
Format: <id>-<title-slug>
Slugification process:
:branch-title-words)Examples:
| Task ID | Title | :branch-title-words | Branch Name |
|---|---|---|---|
| 123 | "Implement user authentication with OAuth" | 4 (default) | 123-implement-user-authentication-with |
| 123 | "Implement user authentication with OAuth" | 2 | 123-implement-user |
| 123 | "Implement user authentication with OAuth" | nil | 123-implement-user-authentication-with-oauth |
| 59 | "Add JWT support" | 4 | 59-add-jwt-support |
| 408 | "Improve mcp-tasks skill" | 4 | 408-improve-mcp-tasks-skill |
Format: Depends on :worktree-prefix configuration
:worktree-prefix | Format | Example |
|---|---|---|
:project-name | <project>-<id>-<title-slug> | mcp-tasks-123-implement-user-authentication-with |
:none | <id>-<title-slug> | 123-implement-user-authentication-with |
Title slug: Same process as branch naming (first N words, slugified)
Location: Sibling directory to main repository
/Users/user/project/ # Main repo
/Users/user/project-123-add-auth/ # Worktree (with :project-name prefix)
/Users/user/123-add-auth/ # Worktree (with :none prefix)
When commits occur:
Where commits occur:
.git directory location)Who creates commits:
Story Task #408 "Improve mcp-tasks skill"
├─ Branch: 408-improve-mcp-tasks-skill
├─ Worktree: /path/to/project-408-improve-mcp-tasks-skill/
│
├─ Child Task #410 (category: medium)
│ └─ Uses same branch + worktree as parent story
│
├─ Child Task #411 (category: medium)
│ └─ Uses same branch + worktree as parent story
│
└─ Child Task #412 (category: simple)
└─ Uses same branch + worktree as parent story
Standalone Task #123 "Add authentication"
├─ Branch: 123-add-authentication
└─ Worktree: /path/to/project-123-add-authentication/
Rules:
Automatic cleanup (when :worktree-management? enabled):
Triggered by complete-task tool when:
Safety checks before removal:
| Check | Requirement | Failure Result |
|---|---|---|
| Clean working directory | No uncommitted changes | Task marked complete, worktree preserved, warning shown |
| Pushed commits | All commits pushed to remote (if remote configured) | Task marked complete, worktree preserved, warning shown |
Cleanup outcomes:
| Scenario | Task Status | Worktree | Branch | Message |
|---|---|---|---|---|
| Success | :closed | Removed | Preserved | "Worktree removed at /path (switch directories to continue)" |
| Uncommitted changes | :closed | Preserved | Preserved | "Warning: Could not remove worktree: Uncommitted changes exist" |
| Unpushed commits | :closed | Preserved | Preserved | "Warning: Could not remove worktree: Unpushed commits exist" |
| Git error | :closed | Preserved | Preserved | "Warning: Could not remove worktree: <error message>" |
Manual cleanup commands:
# From main repository directory
git worktree remove /path/to/worktree
# Force removal (use with caution)
git worktree remove --force /path/to/worktree
# List all worktrees
git worktree list
# Remove worktree that was already deleted from filesystem
git worktree prune
When to use manual cleanup:
If task execution fails or is interrupted:
.mcp-tasks-current.edn remains with :started-at timestamp:open (not marked complete)work-on overwrites stale execution state automaticallyCommon failure scenarios:
| Failure | Recovery Action |
|---|---|
| Agent context limit exceeded | Break task into smaller subtasks, execute separately |
| Implementation error/bug | Fix manually, re-run execute prompt to continue |
| Network/tool failure | Re-run execute prompt (idempotent) |
| User interruption (Ctrl-C) | Re-run execute prompt |
When a task depends on another task:
;; Mark current task as blocked
(update-task
:task-id 123
:status :blocked
:relations [{:relates-to 456, :as-type :blocked-by}])
Relation types:
| Type | Meaning | Example |
|---|---|---|
:blocked-by | Cannot proceed until other task completes | Task #123 blocked by #456 |
:related | Related but not blocking | Task #123 related to #456 |
:discovered-during | Found while working on another task | Task #123 found during #456 |
Unblocking workflow:
:openDecision matrix:
| Scenario | Action | Tool | Reason |
|---|---|---|---|
| Task done successfully | Complete | complete-task | Preserves audit trail in complete.ednl |
| Task no longer needed | Delete | delete-task | Removes from tasks.ednl, archives in complete.ednl with :status :deleted |
| Task needs clarification | Update | update-task | Modify :description or :design fields |
| Task scope changed | Update | update-task | Modify :title, :description, :category |
| Task blocked temporarily | Update | update-task | Set :status :blocked, add :relations |
| Task duplicates another | Delete | delete-task | Add :relations to other task first |
| Task split into subtasks | Create subtasks then delete parent | add-task + delete-task | Use :parent-id for subtasks |
Constraints:
:open first)Stale execution state detection:
External tools detect stale executions via :started-at timestamp in .mcp-tasks-current.edn:
{:story-id 408
:task-id 411
:started-at "2025-10-29T10:30:00Z"} ; If hours/days old = likely stale
Recovery steps:
Check current execution state:
cat .mcp-tasks-current.edn
Verify if execution actually stale:
Resume or restart:
.mcp-tasks-current.ednManual state cleanup (if needed):
rm .mcp-tasks-current.edn
Note: work-on automatically overwrites execution state, so manual cleanup rarely needed.
parent-id when creating story tasksresource://current-execution.mcp-tasks/tasks.ednl.mcp-tasks/complete.ednl.mcp-tasks-current.edn.mcp-tasks/prompts/<category>.md (optional overrides).mcp-tasks/story/prompts/<name>.md (optional overrides)This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.