117 lines
4.6 KiB
Markdown
117 lines
4.6 KiB
Markdown
№ **speckit.tasks.md**
|
|
### Modified Workflow
|
|
|
|
```markdown
|
|
description: Generate an actionable, dependency-ordered tasks.md for the feature based on available design artifacts.
|
|
handoffs:
|
|
- label: Analyze For Consistency
|
|
agent: speckit.analyze
|
|
prompt: Run a project analysis for consistency
|
|
send: true
|
|
- label: Implement Project
|
|
agent: speckit.implement
|
|
prompt: Start the implementation in phases
|
|
send: true
|
|
---
|
|
|
|
## User Input
|
|
|
|
```text
|
|
$ARGUMENTS
|
|
```
|
|
|
|
You **MUST** consider the user input before proceeding (if not empty).
|
|
|
|
## Outline
|
|
|
|
1. **Setup**: Run `.specify/scripts/bash/check-prerequisites.sh --json` from repo root and parse FEATURE_DIR and AVAILABLE_DOCS list. All paths must be absolute.
|
|
|
|
2. **Load design documents**: Read from FEATURE_DIR:
|
|
- **Required**: plan.md (tech stack, libraries, structure), spec.md (user stories with priorities), ux_reference.md (experience source of truth)
|
|
- **Optional**: data-model.md (entities), contracts/ (API endpoints), research.md (decisions)
|
|
|
|
3. **Execute task generation workflow**:
|
|
- **Architecture Analysis (CRITICAL)**: Scan existing codebase for patterns (DI, Auth, ORM).
|
|
- Load plan.md/spec.md.
|
|
- Generate tasks organized by user story.
|
|
- **Apply Fractal Co-location**: Ensure all unit tests are mapped to `__tests__` subdirectories relative to the code.
|
|
- Validate task completeness.
|
|
|
|
4. **Generate tasks.md**: Use `.specify/templates/tasks-template.md` as structure.
|
|
- Phase 1: Context & Setup.
|
|
- Phase 2: Foundational tasks.
|
|
- Phase 3+: User Stories (Priority order).
|
|
- Final Phase: Polish.
|
|
- **Strict Constraint**: Ensure tasks follow the Co-location and Mocking rules below.
|
|
|
|
5. **Report**: Output path to generated tasks.md and summary.
|
|
|
|
Context for task generation: $ARGUMENTS
|
|
|
|
## Task Generation Rules
|
|
|
|
**CRITICAL**: Tasks MUST be actionable, specific, architecture-aware, and context-local.
|
|
|
|
### Implementation & Testing Constraints (ANTI-LOOP & CO-LOCATION)
|
|
|
|
To prevent infinite debugging loops and context fragmentation, apply these rules:
|
|
|
|
1. **Fractal Co-location Strategy (MANDATORY)**:
|
|
- **Rule**: Unit tests MUST live next to the code they verify.
|
|
- **Forbidden**: Do NOT create unit tests in root `tests/` or `backend/tests/`. Those are for E2E/Integration only.
|
|
- **Pattern (Python)**:
|
|
- Source: `src/domain/order/processing.py`
|
|
- Test Task: `Create tests in src/domain/order/__tests__/test_processing.py`
|
|
- **Pattern (Frontend)**:
|
|
- Source: `src/lib/components/UserCard.svelte`
|
|
- Test Task: `Create tests in src/lib/components/__tests__/UserCard.test.ts`
|
|
|
|
2. **Semantic Relations**:
|
|
- Test generation tasks must explicitly instruct to add the relation header: `# @RELATION: VERIFIES -> [TargetComponent]`
|
|
|
|
3. **Strict Mocking for Unit Tests**:
|
|
- Any task creating Unit Tests MUST specify: *"Use `unittest.mock.MagicMock` for heavy dependencies (DB sessions, Auth). Do NOT instantiate real service classes."*
|
|
|
|
4. **Schema/Model Separation**:
|
|
- Explicitly separate tasks for ORM Models (SQLAlchemy) and Pydantic Schemas.
|
|
|
|
### UX Preservation (CRITICAL)
|
|
|
|
- **Source of Truth**: `ux_reference.md` is the absolute standard.
|
|
- **Verification Task**: You **MUST** add a specific task at the end of each User Story phase: `- [ ] Txxx [USx] Verify implementation matches ux_reference.md (Happy Path & Errors)`
|
|
|
|
### Checklist Format (REQUIRED)
|
|
|
|
Every task MUST strictly follow this format:
|
|
|
|
```text
|
|
- [ ] [TaskID] [P?] [Story?] Description with file path
|
|
```
|
|
|
|
**Examples**:
|
|
- ✅ `- [ ] T005 [US1] Create unit tests for OrderService in src/services/__tests__/test_order.py (Mock DB)`
|
|
- ✅ `- [ ] T006 [US1] Implement OrderService in src/services/order.py`
|
|
- ❌ `- [ ] T005 [US1] Create tests in backend/tests/test_order.py` (VIOLATION: Wrong location)
|
|
|
|
### Task Organization & Phase Structure
|
|
|
|
**Phase 1: Context & Setup**
|
|
- **Goal**: Prepare environment and understand existing patterns.
|
|
- **Mandatory Task**: `- [ ] T001 Analyze existing project structure, auth patterns, and `conftest.py` location`
|
|
|
|
**Phase 2: Foundational (Data & Core)**
|
|
- Database Models (ORM).
|
|
- Pydantic Schemas (DTOs).
|
|
- Core Service interfaces.
|
|
|
|
**Phase 3+: User Stories (Iterative)**
|
|
- **Step 1: Isolation Tests (Co-located)**:
|
|
- `- [ ] Txxx [USx] Create unit tests for [Component] in [Path]/__tests__/test_[name].py`
|
|
- *Note: Specify using MagicMock for external deps.*
|
|
- **Step 2: Implementation**: Services -> Endpoints.
|
|
- **Step 3: Integration**: Wire up real dependencies (if E2E tests requested).
|
|
- **Step 4: UX Verification**.
|
|
|
|
**Final Phase: Polish**
|
|
- Linting, formatting, final manual verify.
|