---
description: Quick task status, details, and completion commands
argument-hint: [status|show <id>|complete <id>]
allowed-tools: mcp__task_master_ai__*, Bash(git branch)
---

# Task Commands: $ARGUMENTS

Quick access to Task Master task management. See [~/.claude/guides/agents.task-master.md](../guides/agents.task-master.md) for full documentation.

## Argument Parsing

Parse `$ARGUMENTS` to route to the appropriate sub-command:

```javascript
// Parse arguments
const args = $ARGUMENTS.trim();
const [command, ...rest] = args.split(/\s+/);

// Route to sub-command
if (!command || command === 'status') {
  // Default: show status overview
  // Refer to: docs/commands/task/status.md
  executeStatusCommand();
} else if (command === 'show') {
  // Show task details
  const taskId = rest.join(' ');
  executeShowCommand(taskId);
} else if (command === 'complete') {
  // Complete task
  const taskId = rest.join(' ');
  executeCompleteCommand(taskId);
} else {
  // Unknown command
  console.log('❌ Unknown command:', command);
  console.log('\nAvailable commands:');
  console.log('  /task [status]    - Show status overview');
  console.log('  /task show <id>   - Show task details');
  console.log('  /task complete <id> - Complete task');
}
```

## Usage

````bash
# View all tasks (default command - optimized for speed)
/task
/task status
/task:status

# View specific task details (optional ID)
/task show <id>
/task:show <id>

# Complete a task (optional ID)
/task complete <id>
/task:complete <id>
```text

## Command: /task (Status Overview)

**Optimized for speed - provides quick snapshot of project status.**

**Implementation:** See [docs/commands/task/status.md](task/status.md) for the complete status command implementation.

### 1. Get Current Context

```bash
# Get current branch for tag context
BRANCH=$(git branch --show-current)
TICKET_ID=$(echo "$BRANCH" | grep -oE '[A-Z]+-[0-9]+' | head -1)
```text

### 2. Get Task Lists

```javascript
// Get all tasks efficiently
const allTasks = mcp__task_master_ai__get_tasks({
  projectRoot: process.cwd(),
  withSubtasks: false, // Skip subtasks for speed
});

// Get current tag
const tags = mcp__task_master_ai__list_tags({
  projectRoot: process.cwd(),
});
```text

### 3. Display Status Template

```bash
# Task Master Status

**Branch:** $BRANCH
**Tag:** $TICKET_ID (or current tag)

## 📊 Progress Overview

**Tasks by Status:**
- ✅ Done: X tasks
- 🏃 In Progress: Y tasks
- ⏸️ Blocked: Z tasks
- ⏳ Pending: N tasks

**Total:** X/Total tasks complete (XX%)

## 🎯 Current Work

### In Progress (Y)
1. [1.2] Implement JWT Authentication (70% - 3/4 subtasks)
2. [3.1] Setup CI/CD pipeline (30% - 1/3 subtasks)

### Blocked (Z)
1. [2.3] Database migration - waiting on [2.1]
2. [4.1] API documentation - waiting on [3.2]

## ⚡ Next Available Tasks

### Recommended
**[1.3] Add refresh token logic**
- Priority: High
- Dependencies: ✅ All met ([1.1], [1.2])
- Complexity: Medium
- Estimated: 4 subtasks

### Quick Wins (<1 hour)
- [2.1] Add input validation
- [5.2] Update error messages

### High Priority
- [1.3] Add refresh token logic
- [3.4] Database backup strategy

## 📈 Recommendation

**Next Task:** [1.3] Add refresh token logic

**Rationale:**
- Follows completed authentication work ([1.2])
- High priority with no blockers
- Natural progression in current context

**To start:**
```text

/task:next

```text

**Or start immediately:**
```text

/task:show 1.3

```text

---
*Tip: Use `/task:next` for intelligent task selection with full context and validation.*
```text

### 4. Performance Optimization

**Keep it fast:**

- Skip subtask details in initial view
- Cache task counts
- Minimal MCP calls (2 calls maximum)
- No complexity analysis or validation (use `/task:next` for that)
- Simple recommendation based on:
  - Status (prefer continuing in-progress first)
  - Dependencies (unblocked tasks only)
  - Priority (high > medium > low)
  - Sequence (follow recent work)

## Command: /task:show <id>

View detailed information about a specific task.

### 1. Parse Arguments

```javascript
// Extract task ID from $ARGUMENTS
let taskId = $ARGUMENTS.trim();

// If no ID provided, find first in-progress task
if (!taskId) {
  const inProgressTasks = mcp__task_master_ai__get_tasks({
    projectRoot: process.cwd(),
    status: 'in-progress',
    withSubtasks: true,
  });

  if (inProgressTasks.length === 0) {
    // No in-progress tasks, show available tasks and ask
    const pendingTasks = mcp__task_master_ai__get_tasks({
      projectRoot: process.cwd(),
      status: 'pending',
      withSubtasks: false,
    });

    // Display available tasks
    console.log('## Available Tasks\n');
    pendingTasks.forEach((task) => {
      console.log(`**[${task.id}]** ${task.title} (${task.priority || 'medium'})`);
    });

    // Ask user which task to show
    console.log('\n**Which task would you like to view?**');
    console.log('Enter task ID or use `/task:next` for recommendation.');
    return; // Exit and wait for user input
  }

  // Use first in-progress task
  taskId = inProgressTasks[0].id;
  console.log(`ℹ️ Showing first in-progress task: [${taskId}]\n`);
}
```text

### 2. Get Task Details

```javascript
// Get full task details with subtasks
const task = mcp__task_master_ai__get_task({
  projectRoot: process.cwd(),
  id: taskId,
});
```text

### 3. Display Task Details

```bash
# Task [${task.id}]: ${task.title}

**Status:** ${task.status}
**Priority:** ${task.priority || 'medium'}
**Dependencies:** ${task.dependencies?.join(', ') || 'None'}

## Description

${task.description}

## Implementation Details

${task.details || 'No additional details provided.'}

## Subtasks (${doneCount}/${totalCount} complete)

${task.subtasks?.map((st, i) => {
  const status = st.status === 'done' ? '✅' : st.status === 'in-progress' ? '🏃' : '⏳';
  return `${i + 1}. ${status} [${task.id}.${st.id}] ${st.title} (${st.status})`;
}).join('\n') || 'No subtasks defined.'}

## Test Strategy

${task.testStrategy || 'No test strategy defined.'}

## Related Tasks

**Depends on:** ${task.dependencies?.map(d => `[${d}]`).join(', ') || 'None'}
**Blocks:** ${blockedTasks?.map(t => `[${t.id}]`).join(', ') || 'None'}

## Next Steps

${task.status === 'pending' ? `
**Start this task:**
\`\`\`
/task:next
\`\`\`
` : task.status === 'in-progress' ? `
**Continue work on:** Subtask ${task.id}.${nextSubtask.id}
**Mark complete when done:** \`/task:complete ${taskId}\`
` : `
**Status:** This task is ${task.status}
`}
```text

## Command: /task:complete <id>

Mark a task as complete with validation.

### 1. Parse Arguments

```javascript
// Extract task ID from $ARGUMENTS
let taskId = $ARGUMENTS.trim();

// If no ID provided, find first in-progress task
if (!taskId) {
  const inProgressTasks = mcp__task_master_ai__get_tasks({
    projectRoot: process.cwd(),
    status: 'in-progress',
    withSubtasks: true,
  });

  if (inProgressTasks.length === 0) {
    console.log('## ⚠️ No In-Progress Tasks\n');
    console.log('No tasks are currently in progress to complete.\n');

    // Show pending tasks
    const pendingTasks = mcp__task_master_ai__get_tasks({
      projectRoot: process.cwd(),
      status: 'pending',
      withSubtasks: false,
    });

    if (pendingTasks.length > 0) {
      console.log('**Available Tasks:**\n');
      pendingTasks.slice(0, 5).forEach((task) => {
        console.log(`- [${task.id}] ${task.title}`);
      });
      console.log('\n**Which task would you like to complete?**');
      console.log('Enter: `/task:complete <id>`');
    } else {
      console.log('🎉 **All tasks are complete!**');
    }
    return;
  }

  // Use first in-progress task
  taskId = inProgressTasks[0].id;
  console.log(`ℹ️ Completing first in-progress task: [${taskId}]\n`);
}
```text

### 2. Validate Task Completion

```javascript
// Get task details
const task = mcp__task_master_ai__get_task({
  projectRoot: process.cwd(),
  id: taskId,
});

// Check if task has subtasks
if (task.subtasks && task.subtasks.length > 0) {
  const incompleteSubtasks = task.subtasks.filter(
    (st) => st.status !== 'done' && st.status !== 'cancelled'
  );

  if (incompleteSubtasks.length > 0) {
    console.log(`## ⚠️ Incomplete Subtasks\n`);
    console.log(`Task [${taskId}] has ${incompleteSubtasks.length} incomplete subtasks:\n`);

    incompleteSubtasks.forEach((st) => {
      console.log(`- [${taskId}.${st.id}] ${st.title} (${st.status})`);
    });

    console.log('\n**Options:**');
    console.log('1. Complete remaining subtasks first');
    console.log('2. Mark subtasks as cancelled if not needed');
    console.log('3. Force complete anyway (not recommended)');
    console.log('\n**Continue anyway? (y/N)**');
    return; // Wait for confirmation
  }
}
```text

### 3. Check Implementation Evidence

```bash
# Search for implementation evidence if task description contains specific keywords
# Look for files/functions mentioned in task description

# Example searches based on task:
# - "JWT" → search for jwt, authentication files
# - "database" → search for migration files, schema changes
# - "API" → search for endpoint definitions
# - "test" → search for test files
```text

**Display evidence check:**

```bash
## 🔍 Checking Implementation Evidence

**Task:** [${taskId}] ${task.title}

**Evidence Found:**
- ✅ Implementation files: src/auth/jwt.ts, src/middleware/auth.ts
- ✅ Test coverage: tests/auth/jwt.test.ts (15 tests passing)
- ✅ Documentation: Updated in docs/api/auth.md
- ✅ Git commits: 3 commits referencing task ${taskId}

**Analysis:** Implementation appears complete ✅
```text

### 4. Mark as Complete

```javascript
// Mark task as done
mcp__task_master_ai__set_task_status({
  projectRoot: process.cwd(),
  id: taskId,
  status: 'done',
});
```text

**Display confirmation:**

```bash
## ✅ Task Complete

**[${taskId}] ${task.title}** → ✅ Done

**Unblocked Tasks:**
${unblockedTasks.map((t) => `- [${t.id}] ${t.title}`).join('\n') || 'None'}

**Progress Update:**
- Total complete: ${doneCount}/${totalCount} (${percentage}%)
- Remaining: ${remainingCount} tasks

**Next Task:**
${nextRecommended ? `
**[${nextRecommended.id}] ${nextRecommended.title}**

Start with: \`/task:next\`
` : 'No more tasks available 🎉'}
```text

## Additional Notes

### Performance Considerations

**`/task` (Status):**

- Optimized for speed (< 2 seconds)
- Minimal MCP calls
- No complex analysis
- Quick snapshot for daily standup

**`/task:show`:**

- Moderate detail level
- Single task focus
- Includes subtasks and relationships
- Good for understanding specific task

**`/task:complete`:**

- Validation checks included
- Evidence search for confidence
- Automatic unblocking detection
- Progress tracking

### When to Use Each Command

| Command | Use Case | Speed | Detail |
|---------|----------|-------|--------|
| `/task` | Daily status check, quick overview | ⚡ Fast | 📊 High-level |
| `/task:show` | Understanding specific task | ⚡ Fast | 📝 Detailed |
| `/task:complete` | Finish current work | ⚡ Fast | ✅ Validation |
| `/task:next` | Start new work with full context | 🐢 Slow | 🔍 Comprehensive |

### Relationship to /task:next

**Use `/task` when:**

- Quick status check needed
- Daily standup preparation
- Checking what's in progress
- Quick decision on what to work on

**Use `/task:next` when:**

- Starting new task (needs validation)
- Complex project state
- Want intelligent recommendation
- Need task refinement (--refine flag)

---

**For comprehensive Task Master documentation:**

See [docs/guides/agents.task-master.md](../guides/agents.task-master.md)
````
