# Orchestrator

> FULLY AUTONOMOUS Flutter development pipeline orchestrator. Smart routing: PM analyzes -> creates targeted tasks -> Orchestrator executes only needed agents. Supports Asana task URLs. Includes QE verification via Maestro E2E tests. 7-phase flow: PM -> TodoWrite -> Execute -> Review -> Tests -> QE E2E -> Close.

- Skill: `aleksandr-chaika/orchestrator` (Agent Skill)
- Install (CLI): `npx skillmds@latest add aleksandr-chaika/orchestrator`
- Raw SKILL.md: https://api.skillmd.com/api/skills/aleksandr-chaika/orchestrator/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: DevOps & Infra
- Author: aleksandr-chaika (https://skillmd.com/u/aleksandr-chaika)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/aleksandr-chaika/orchestrator

---


# Flutter Autonomous Development Orchestrator

## CRITICAL: MANDATORY EXECUTION RULES

**Orchestrator MUST execute ALL phases from PM plan. Skipping phases is FORBIDDEN.**

1. **DO NOT ASK** for confirmation to proceed
2. **DO NOT ASK** for permission to create/edit files
3. **EXECUTE** the pipeline automatically --- ALL STAGES are MANDATORY
4. **ONLY STOP** if blocked by missing critical information
5. **NEVER SKIP** review, tests, or QE verification

---

## CORE FLOW

```
USER REQUEST -> PHASE 1: PM -> PHASE 2: TodoWrite -> PHASE 3: Execute ->
-> PHASE 4: Review -> PHASE 5: Tests -> PHASE 6: QE E2E -> PHASE 7: Close & Registry
```

---

## PIPELINE STATUS TRACKING

**BEFORE each agent call**, update `.tasks/.pipeline-status` file via Bash:

```bash
mkdir -p .tasks
cat > .tasks/.pipeline-status << 'PSTATUS'
REQUEST=краткое описание запроса
PHASE=текущая фаза (PM|Execute|Review|Tests|QE|Close)
CURRENT_TASK=TASK-XXX
CURRENT_DESC=краткое описание задачи
CURRENT_AGENT=имя агента
PSTATUS
```

This file is read by Telegram notification hooks to provide context in messages.

**Update this file EVERY TIME before invoking a new agent.**

---

## PHASE 1: PM ANALYSIS (ALWAYS FIRST)

Update pipeline status:
```bash
cat > .tasks/.pipeline-status << 'PSTATUS'
REQUEST=[user request summary]
PHASE=PM
CURRENT_TASK=
CURRENT_DESC=Анализ и декомпозиция задачи
CURRENT_AGENT=flutter-pm
PSTATUS
```

Invoke PM agent:
```
Task(subagent_type="flutter-pm", prompt="[user request + context]")
```

PM accepts:
- **Plain text** requirements
- **Asana task URLs** (PM uses Asana MCP to read them)
- **Multiple tasks** (PM groups them into execution plan)

PM returns:
- Registry lookup result (similar past tasks)
- Task type (bug/feature/fix/refactor)
- Numbered tasks with execution order
- Required reviews and tests
- **Maestro test cases** (for Flutter UI tasks)

### If PM found similar past task:
Show to user: "Found similar task TASK-XXX. It was resolved by [resolution]."

---

## PHASE 2: BUILD TODOWRITE FROM PM PLAN

Create TodoWrite checklist based on PM's plan (NOT a fixed template).

### Example for FEATURE:
```
TodoWrite([
  { content: "PM Analysis", status: "completed" },
  { content: "Dev: flutter-dev -> TASK-050 (domain)", status: "pending" },
  { content: "Dev: flutter-dev -> TASK-051 (data)", status: "pending" },
  { content: "Dev: flutter-dev -> TASK-052 (presentation)", status: "pending" },
  { content: "Review: flutter-reviewer -> all changes", status: "pending" },
  { content: "Tests: flutter-tester -> full coverage", status: "pending" },
  { content: "QE: maestro-tester -> E2E verify", status: "pending" },
  { content: "Close: registry + report", status: "pending" }
])
```

Only include stages that PM specified.

---

## PHASE 3: EXECUTE TASKS

For each task in PM's execution order:

1. TodoWrite: mark task `in_progress`
2. **Update pipeline status** (`.tasks/.pipeline-status`) with current TASK-ID, description, agent
3. Read task file from `.tasks/flutter/`
4. **Invoke agent via Task tool:**

```
Task(subagent_type="flutter-dev", prompt="Read and implement: .tasks/flutter/TASK-050-domain.md\n\n[task file content]")
```

5. **Collect agent result** --- save status (SUCCESS/FAILURE), files changed, errors encountered
6. Verify agent output (files exist, no errors)
7. TodoWrite: mark task `completed`

---

## PHASE 4: REVIEW (after dev tasks)

Update pipeline status, then invoke:

```
Task(subagent_type="flutter-reviewer", prompt="Review all Flutter changes for [task description]. Fix issues found.\n\nFiles changed:\n[file list]")
```

Reviewer FIXES issues, not just reports them.
Max 3 review-fix cycles.
**Collect**: issues found count, issues fixed count.

---

## PHASE 5: TESTS --- MANDATORY

```
TESTS MANDATORY FOR ALL TASK TYPES. SKIPPING FORBIDDEN.
```

| Task Type | Test Scope |
|-----------|-----------|
| `feature` | Full: unit + BLoC + widget + flow tests |
| `bug` | Regression test reproducing and verifying the fix |
| `fix` | Unit test covering the changed behavior |
| `refactor` | Tests verifying no behavior change |

Update pipeline status, then invoke:

```
Task(subagent_type="flutter-tester", prompt="Write tests for [task description]. Include flow tests for CRUD.\n\nTest scenarios from PM:\n[test scenarios]\n\nSource files:\n[file list]")
```

If tests fail -> fix and re-run (max 3 cycles).
**Collect**: test count, pass/fail, coverage %.

---

## PHASE 6: QE E2E VERIFICATION --- MANDATORY

```
QE MANDATORY FOR ALL FLUTTER UI TASKS. SKIPPING FORBIDDEN.
```

After unit/widget tests pass, verify user journeys via Maestro E2E tests.

Update pipeline status, then invoke:

```
Task(subagent_type="maestro-tester", prompt="QE E2E verification.\n\nMaestro test cases from PM:\n[paste test cases]\n\nVerify all test cases pass on emulator.")
```

### If QE tests fail:
1. UI bug -> send back to flutter-dev for fix
2. Test issue -> maestro-tester self-fixes (up to 2 retries)
3. Still failing -> report in final summary as PARTIAL

### Skip QE if:
- PM explicitly marks task as "no UI changes"
- Task is pure domain/data refactor with no presentation changes

---

## PHASE 7: CLOSE & UPDATE REGISTRY

1. Verify all PM tasks completed
2. Update `.tasks/REGISTRY.md`: status `open` -> `done`, fill Resolution column
3. Update pipeline status: `PHASE=Close`
4. **Output final summary in Russian** (MANDATORY FORMAT below)

### MANDATORY FINAL OUTPUT FORMAT (Russian)

```markdown
## Задача выполнена

### Запрос
[оригинальный запрос пользователя]

### Источник
[Asana URL / прямой запрос]

### Тип
[bug | feature | fix | refactor]

---

### Реестр задач
- Созданные задачи: TASK-050, TASK-051, TASK-052
- Похожие задачи в истории: [TASK-XXX / не найдено]
- **Статус реестра: ОБНОВЛЁН** (все задачи закрыты)

---

### Выполненная работа

| # | Задача | Агент | Статус | Что сделано |
|---|--------|-------|--------|-------------|
| 1 | TASK-050 | flutter-dev | ВЫПОЛНЕНО | Создан домен: entities, use cases |
| 2 | TASK-051 | flutter-dev | ВЫПОЛНЕНО | Создан data layer: repo, API |
| 3 | TASK-052 | flutter-dev | ВЫПОЛНЕНО | Создан UI: BLoC, экраны, виджеты |

---

### Код-ревью

| Ревьюер | Статус | Найдено проблем | Исправлено |
|---------|--------|----------------|------------|
| flutter-reviewer | ВЫПОЛНЕНО | 3 | 3 |

---

### Тестирование

| Тестер | Статус | Кол-во тестов | Покрытие | Результат |
|--------|--------|--------------|----------|-----------|
| flutter-tester | ВЫПОЛНЕНО | 18 | 85% | ВСЕ ПРОЙДЕНЫ |

---

### QE E2E (Maestro)

| Статус | Всего TC | Пройдено | Провалено |
|--------|----------|----------|-----------|
| ВЫПОЛНЕНО | 5 | 5 | 0 |

---

### Ошибки и проблемы

- [Список ошибок, которые возникли в процессе работы]
- [Как каждая ошибка была решена]
- [Если ошибок не было: "Ошибок не обнаружено"]

---

### Изменённые файлы

| Файл | Действие | Описание |
|------|----------|----------|
| lib/features/auth/domain/ | создан | Entities, use cases |
| lib/features/auth/data/ | создан | Repository, API models |
| lib/features/auth/presentation/ | создан | BLoC, экраны |
| test/features/auth/ | создан | 18 тестов |

---

### Итог
- Все задачи: ВЫПОЛНЕНЫ / ЧАСТИЧНО / С ОШИБКАМИ
- Реестр: ОБНОВЛЁН
- Тесты: ПРОЙДЕНЫ
- QE E2E: ПРОЙДЕНЫ / Н/Д
```

**IMPORTANT**: Fill in ACTUAL data from each agent's results, not placeholders.
All text MUST be in Russian. Use data collected during phases 3-6.

---

## SMART ROUTING EXAMPLES

**Bug**: PM -> flutter-dev (fix) -> flutter-reviewer -> flutter-tester -> maestro-tester -> registry
**Feature**: PM -> flutter-dev (domain) -> flutter-dev (data) -> flutter-dev (UI) -> flutter-reviewer -> flutter-tester -> maestro-tester -> registry
**Fix**: PM -> flutter-dev (fix) -> flutter-reviewer -> flutter-tester -> maestro-tester -> registry
**Refactor (no UI)**: PM -> flutter-dev -> flutter-reviewer -> flutter-tester -> registry (no QE)

---

## Autonomy Rules

### DO Automatically:
- Start with PM (registry lookup + task classification)
- Parse Asana URLs via PM
- Build TodoWrite from PM's plan
- Execute only agents PM specified
- **Update `.tasks/.pipeline-status` before EVERY agent call**
- Run reviews after dev work
- Run tests ALWAYS
- Run QE E2E when Flutter UI tasks exist
- Update registry after completion
- **Output final summary in Russian**

### ONLY Ask If:
- PM flagged ambiguity
- Critical security decision
- Conflicting requirements
- Asana task has no description

### NEVER Skip:
- PM analysis phase
- Registry lookup
- Pipeline status updates
- Code review after development
- Tests after development
- QE E2E after Flutter UI development
- Registry update after completion
- **Russian final summary output**

---

## Error Handling

### Build Errors
```bash
flutter clean && flutter pub get
flutter pub run build_runner build --delete-conflicting-outputs
```

### Test Errors
1. Read error message carefully
2. Check if mock is missing
3. Verify test setup
4. Fix and re-run

### Unresolvable Issues
If stuck after 3 iterations:
```markdown
## Заблокировано: [Проблема]

**Попытки исправления:**
1. Попытка 1 --- результат
2. Попытка 2 --- результат
3. Попытка 3 --- результат

**Требуется решение пользователя:**
- Вопрос или решение
```

## Quality Gates

| Этап | Проверка | Критерий |
|------|----------|----------|
| DEVELOP | Build | `flutter build` succeeds |
| REVIEW | Critical | Zero [CRITICAL] issues |
| TEST | Pass | All tests pass |
| TEST | Coverage | >80% on new code |
| QE E2E | Pass | All Maestro flows pass |
| QE E2E | Screenshots | Screenshots captured at key points |

