# AI Assistant Guide: Todo Feature

## Feature Context
- **Purpose**: Example todo list implementation showcasing vertical slice architecture
- **Status**: Example/Template
- **Dependencies**: @shared/api

## Feature Structure
```
todo/
├── ui/
│   ├── components/     # TodoList, TodoItem UI components
│   └── screens/        # TodoScreen main view
├── api/
│   └── handlers/       # Todo CRUD API handlers
├── logic/
│   └── services/       # TodoService business logic
├── data/
│   └── models/         # Todo type definitions
└── tests/              # Feature tests
```

## Common AI Tasks

### 1. Extend the Todo model
- Location: `data/models/Todo.ts`
- Pattern: TypeScript interface
- Update corresponding DTOs

### 2. Add new todo operations
- Service: `logic/services/TodoService.ts`
- Add method to service class
- Update API routes if needed

### 3. Create todo-related UI
- Components: `ui/components/`
- Follow React functional patterns
- Export through barrel files

### 4. Add todo API endpoints
- Handlers: `api/handlers/`
- Follow RESTful conventions
- Update route definitions

## Example Code Patterns

### Data Model Pattern
```typescript
export interface Todo {
  id: string;
  title: string;
  completed: boolean;
  createdAt: Date;
  updatedAt: Date;
}
```

### Service Pattern
```typescript
export class TodoService {
  async createTodo(input: CreateTodoDto): Promise<Todo> {
    // Validation and business logic
    return this.repository.create(input);
  }
}
```

### Component Pattern
```typescript
export const TodoItem: React.FC<TodoItemProps> = ({ todo, onToggle }) => {
  return (
    <div onClick={() => onToggle(todo.id)}>
      {todo.title} - {todo.completed ? '✓' : '○'}
    </div>
  );
};
```

## Testing
- Unit tests: `tests/unit/`
- Integration tests: `tests/integration/`
- Test service logic independently
- Test UI components with mocks