--- name: aico-backend-implement description: | Execute backend task implementation with TDD. Read task file, execute steps, verify each, update status. Use this skill when: - User asks to "implement task/plan", "start implementation", "execute plan", or "start coding" - Have task file (story-* or standalone-*) ready to execute - User asks to "use TDD", "write test first", or "test-driven" - User asks to "write tests", "add tests", "create tests" - Fixing bugs (write failing test first) TDD Iron Law: NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST TDD Cycle: RED (failing test) → Verify fails → GREEN (minimal code) → Verify passes → REFACTOR Prerequisites: - Task file in docs/reference/backend/tasks/ (story-* or standalone-*) - Read constraints.md and design spec before coding Flow: Read Task → Read Constraints → Execute Steps → Verify → Test → Update Status --- # Implement ## Language Configuration Before generating any content, check `aico.json` in project root for `language` field to determine the output language. If not set, default to English. ## Process 0. **Read task file** (MANDATORY): - Look for task file in `docs/reference/backend/tasks/` - Accept either: - **Story-based**: `story-{story-name}.md` with task number - **Standalone**: `standalone-{task-name}.md` with task number - User must specify task number (e.g., "implement story-user-api Task 1" or "implement standalone-fix-auth Task 1") - Both formats contain multiple tasks, just different naming - If NOT exists or task number not specified → STOP and ask user which task to implement 1. **Read constraints FIRST** (before any code): - `docs/reference/backend/design-system.md` - Colors, typography, spacing - `docs/reference/backend/constraints.md` - Tech stack, patterns - If task references design: `docs/reference/backend/designs/{name}.md` 2. **Execute implementation steps**: - Read "Implementation Steps" section from task - Execute each step in order - Run verification command after each step - If fail → fix before proceeding - If pass → continue to next step 3. **After all steps**: - Run unit tests - Run build check 4. **Update task status**: - Update the specific task section in the file - Mark acceptance criteria checkboxes: `- [ ]` → `- [x]` - Change Status from `pending` to `completed` - Update "Progress" section at bottom of file - Both story-based and standalone files use the same format 5. **Notify completion**: - Show task file path and task number - Show completion status - **Check related Story** (story-based only): - Read `> **Story**:` field from file header - If Story exists, check story file at `docs/reference/pm/stories/` - Update Story's Related Tasks section: mark this task as `- [x]` - Count total vs completed tasks - If all tasks completed, show: "✅ All tasks completed! Story {story-name} is ready for acceptance." - If partial completion, show: "⏳ Progress: X/Y tasks completed" ## Task File Format See [Task File Template](../task-breakdown/references/task-file-template.md) for complete structure. Both story-based and standalone tasks use the same file structure - the only difference is the filename: - **Story-based**: `story-{story-name}.md` (from PM story breakdown) - **Standalone**: `standalone-{task-name}.md` (from plan/ad-hoc requirements) **Usage Examples:** - `implement story-user-api Task 1` - `implement standalone-fix-auth Task 1` ## Execution Flow ``` Read Task File ↓ Read Constraints (design-system.md, constraints.md, designs/) ↓ Execute Step 1 → Verify → Pass? → Continue ↓ Fail → Fix → Retry ↓ Execute Step 2 → Verify → Pass? → Continue ↓ ... ↓ Run Unit Tests ↓ Run Build Check ↓ Update Task File (mark AC completed, update status) ↓ Show Completion Summary ``` ## Step Execution Rules ### Rule 1: Follow Constraints Exactly ```tsx // ❌ Wrong: Ignore design system