---
name: task-creation
description: Add create_task tool to create new tasks in ./tasks/ folder
status: done
parts:
- src/servers/task.rs
- src/types/task.rs
estimate:
  optimistic: 1 hour
  normal: 2 hours
  pessimistic: 4 hours
---

# Implementation Plan

## Task Summary

| ID | Task | Files |
|----|------|-------|
| T1 | Add slugify helper function | `src/servers/task.rs` |
| T2 | Add CreateTaskRequest type | `src/types/task.rs` |
| T3 | Implement create_task tool handler | `src/servers/task.rs` |
| T4 | Register tool in MCP server | `src/servers/task.rs` |
| T5 | Update CLAUDE.md documentation | `CLAUDE.md` |

## Tasks

- [ ] **T1**: Add a `slugify` helper function that converts task names to valid folder names (lowercase, spaces to hyphens, remove special chars, max 40 chars)
- [ ] **T2**: Add `CreateTaskRequest` struct with `name` and `description` fields in types
- [ ] **T3**: Implement `create_task` handler that:
  - Slugifies the provided name
  - Checks if `./tasks/{slug}/` already exists (error if so)
  - Creates the folder `./tasks/{slug}/`
  - Writes `task.md` with raw description
  - Sets initial status to `draft`
  - Returns success with prompt to analyze
- [ ] **T4**: Register `create_task` tool in the MCP tool list with proper schema
- [ ] **T5**: Update CLAUDE.md to document the new tool and the workflow behavior (always prompt to analyze after creation)

## Testing Considerations

- Test slugification: spaces, special chars, length > 40
- Test duplicate task detection
- Test task.md content is raw description
- Test initial status is 'draft'
- Verify folder structure is correct

---

## Estimate

**Senior Developer Profile:** 5+ years experience, familiar with the project's tech stack.

| Scenario | Time |
|----------|------|
| Optimistic | 1 hour |
| Normal | 2 hours |
| Pessimistic | 4 hours |

### Assumptions
- Existing MCP tool registration pattern can be followed
- No complex validation beyond what's specified
- Slugify logic is straightforward
- Testing done manually via MCP client
