К основному содержанию
скилл CX Codex

flutter-duit-bdui — скилл для Claude Code: что делает и установка

Помогает внедрять, проверять и отлаживать backend-driven UI на базе flutter_duit во Flutter-проектах с учётом версии пакета.

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add MADTeacher/mad-agents-skills --skill flutter-duit-bdui -a claude-code
Открыть на GitHub

Что делает flutter-duit-bdui

Скилл настраивает серверный интерфейс через flutter_duit, опираясь на точную версию библиотеки в pubspec.lock. Для удалённых экранов создаётся XDriver.remote с менеджером HttpTransportManager, а для тестов, офлайн-экранов и моков используется XDriver.static со StubTransportManager. Отображение строится через виджет DuitViewHost.withDriver.

Ассистент требует сохранять жизненный цикл драйвера внутри StatefulWidget и обязательно освобождать ресурсы при выходе. Кастомные виджеты регистрируются строго до первого рендера макета, иначе интерфейс сломается при разборе серверного JSON. Добавлять duit_kernel напрямую запрещено, если задача не требует его внутренних моделей.

Без проверки версии в pubspec.yaml код генерировать нельзя из-за несовместимости API между релизами. Скилл опирается на синтаксис ветки 4.x и проверяет правки через flutter analyze и flutter test.

Какие задачи решает

  • подключить backend-driven UI экраны через XDriver.remote
  • настроить локальные моки макетов с помощью XDriver.static
  • внедрить кастомные Duit-виджеты до начала рендера
  • отладить утечки памяти и вызовы dispose в контроллерах

Примеры запросов агенту

  • Сделай экран профиля через XDriver.remote и DuitViewHost для flutter_duit 4.x
  • Добавь тест статического JSON-макета с помощью XDriver.static и StubTransportManager
  • Проверь pubspec.lock и настрой жизненный цикл драйвера внутри StatefulWidget

Как установить flutter-duit-bdui

1Через Skills CLI (Vercel)

npx skills add MADTeacher/mad-agents-skills --skill flutter-duit-bdui -a claude-code

2Вручную: положить файлы

~/.claude/skills/flutter-duit-bdui/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/flutter-duit-bdui/

По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов

Вопросы о flutter-duit-bdui

Как установить flutter-duit-bdui в Claude Code?

Выполните команду npx skills add MADTeacher/mad-agents-skills --skill flutter-duit-bdui -a claude-code.

Что делает скилл flutter-duit-bdui?

Он направляет агента при интеграции BDUI-библиотеки flutter_duit, контролирует регистрацию виджетов, настройку транспорта и корректный жизненный цикл драйверов.

Почему важна версия flutter_duit?

Библиотека меняла публичный API между мажорными версиями, поэтому скилл требует сначала проверить зависимости в pubspec.lock и по умолчанию ориентируется на актуальную ветку 4.x.

Исходный текст

SKILL.md · MIT
---
name: flutter-duit-bdui
description: >-
  Integrate, fix, review, migrate, test, or debug Duit / flutter_duit
  backend-driven UI in Flutter applications. Use when a task mentions DUIT,
  flutter_duit, backend-driven UI, BDUI, server-driven UI, XDriver,
  DuitViewHost, DuitRegistry, HTTP or WebSocket transports, custom Duit
  widgets, components, capability delegates, compile-time DUIT flags, or
  rendering JSON layouts from a backend.
---

# Flutter Duit Backend-Driven UI

You are a Flutter BDUI integration engineer for Duit and `flutter_duit`.

## Principle 0

`flutter_duit` has changed its public API across major versions. Do not write
driver, transport, registry, or widget-host code from memory. First identify the
installed or target package version, then use examples and API shapes that match
that version. If the version cannot be determined, use current official docs as
the default and state the assumption.

## Workflow

1. Identify the task type: install, render a remote/static layout, add a custom
   widget, register components, configure transport, customize capabilities,
   tune compile-time flags, or debug rendering/lifecycle issues.
2. Inspect the target Flutter project before editing: `pubspec.yaml`,
   `pubspec.lock` when present, existing Duit setup, app entrypoint, state
   management, routing, and test conventions.
3. Determine the `flutter_duit` version:
   - Prefer `pubspec.lock` or the existing dependency constraint.
   - If adding the package, check current official package docs or run
     `flutter pub add flutter_duit` when dependency installation is part of the
     user request.
   - If the package major version is not 4.x, verify API names before using any
     examples from this skill.
4. Choose the smallest integration path that fits the product need:
   - Use `XDriver.remote` for backend-driven screens loaded from a server.
   - Use `XDriver.static` for local JSON, tests, previews, or offline fixtures.
   - Use custom widgets/components only when server JSON must render UI that the
     built-in collection cannot represent.
   - Use capability delegates only for framework behavior changes such as
     custom transport, logging, focus, scripting, native modules, or action
     execution.
5. Read only the routed resources needed for the scenario.
6. Implement with normal Flutter ownership rules: keep driver lifecycle in a
   `StatefulWidget` or equivalent owner, register custom widgets before
   rendering layouts, and dispose drivers/managers that own resources.
7. Validate in the target project. If validation cannot run, report the blocker
   and the residual risk instead of implying the integration is proven.

## Current 4.x API Guardrail

For `flutter_duit` 4.x, prefer the public shapes shown by current package
examples:

```dart
final driver = XDriver.remote(
  transportManager: HttpTransportManager(
    url: "/layout",
    baseUrl: "http://localhost:3000",
    defaultHeaders: {
      "Content-Type": "application/json",
    },
  ),
);
```

```dart
DuitViewHost.withDriver(
  driver: driver,
  placeholder: const CircularProgressIndicator(),
);
```

```dart
final driver = XDriver.static(
  {
    "type": "Text",
    "id": "1",
    "attributes": {
      "data": "Hello, World!",
    },
  },
  transportManager: StubTransportManager(),
);
```

Do not use older or unverified constructor shapes such as
`XDriver(...)`, `HttpTransportManager(options: ...)`, `headers`, or
`WSTransportManager` unless the installed package version and API reference
confirm them.

## Resource Routing

| Task | Read | Why |
|---|---|---|
| Driver lifecycle, remote/static/native mode, event streams, or public methods | `references/public_api.md` | Version-aware API contracts and 4.x examples |
| Custom capabilities, custom transport, logging, focus, scripting, native modules, or action execution | `references/capabilities.md` | Delegate responsibilities and implementation guardrails |
| Compile-time DUIT behavior flags or `--dart-define` usage | `references/environment_vars.md` | Supported flags, defaults, and command examples |
| Rendering failures, initialization errors, theme issues, or memory leaks | `references/troubleshooting.md` | Symptom-to-action debugging checklist |

External sources to verify when API details matter:

- `https://pub.dev/packages/flutter_duit`
- `https://pub.dev/documentation/flutter_duit/latest/`
- `https://github.com/Duit-Foundation/flutter_duit`
- `https://www.duit.pro/docs/`

## Constraints

- Do not invent server JSON schema, action payloads, event formats, or widget
  attributes. Inspect existing backend contracts, fixtures, docs, or tests.
- Do not add `duit_kernel` directly unless the task requires kernel models,
  custom extensions, or APIs not exported by `flutter_duit`.
- Do not register custom widgets after the app has already tried to render
  layouts that use them.
- Do not keep a driver as an unowned global unless the existing architecture has
  a clear lifecycle owner and cleanup path.
- Do not silently downgrade unknown widget behavior in development. Prefer
  surfacing schema issues early unless the user explicitly wants permissive
  fallback behavior.
- Do not promise WebSocket, native module, scripting, or component support from
  this skill alone; verify the exact API for the installed package version.

## Validation

Run the strongest available validation for the target project:

1. `flutter pub get` after dependency changes.
2. `dart format` on edited Dart files.
3. `flutter analyze` for Flutter projects.
4. Existing focused tests, or `flutter test` when the change touches shared UI,
   actions, parsing, or lifecycle behavior.
5. For static layout work, add or run a smoke test/widget preview that renders a
   minimal `DuitViewHost.withDriver`.
6. For remote transport work, verify base URL, route, headers, auth handling,
   loading state, error state, and driver disposal.

If any validation command is unavailable, blocked by dependency download,
platform setup, or missing project context, say which check did not run and why.

## Fallback

If the target version/API cannot be verified, stop before writing speculative
Duit code that may not compile. Ask for the intended `flutter_duit` version or
permission to inspect/install dependencies. If the user asks for a best-effort
draft anyway, mark the code as version-assumed and list the validation still
needed.

© MADTeacher · MIT · MADTeacher/mad-agents-skills

Похожие скиллы

Все скиллы по теме «Мобильная разработка» →
flutter-build-responsive-layout flutter Скилл обучает агента строить адаптивные интерфейсы Flutter под экраны телефонов и десктопов. Он задаёт правила работы с LayoutBuilder и MediaQuery. CX Codex +1 42 500установок flutter-fix-layout-issues flutter Разбирает ошибки раскладки Flutter по тексту исключения: overflow, неограниченные constraints, неверный ParentData. Подсказывает, что обернуть и во что. CX Codex +1 39 900установок flutter-expert https://github.com/Jeffallan Скилл для разработки кросс-платформных приложений на Flutter 3+ и Dart. Помогает с виджетами, управлением состоянием через Riverpod или Bloc, маршрутизацией GoRouter и оптимизацией производительности. CX Codex +1 14 300установок dart-flutter-patterns affaan-m Набор готовых паттернов для Dart и Flutter: null safety, состояние, навигация, сеть. Пригодится, когда пишете или ревьюите код на Flutter. CX Codex +1 4 700установок flutter-dev MiniMax-AI Гайд для разработки Flutter-приложений с паттернами виджетов, Riverpod, Bloc и GoRouter. Пригодится при настройке интерфейса, навигации, тестов и производительности. CX Codex +1 2 000установок flutter Mindrally Задаёт правила разработки на Flutter и Dart: чистую архитектуру по фичам, управление состоянием через Riverpod или BLoC и ограничения на вложенность виджетов. CX Codex +1 925установок

Из того же набора11

flutter-architecture Скилл для проектирования и ревью архитектуры Flutter-приложений: слои, MVVM, feature-first структура, DI и паттерны вроде Result и Command. CX Codex +1 1 700установок flutter-testing Скилл для написания, починки и отладки тестов Flutter: юнит-, виджет- и интеграционные тесты, моки, golden-проверки. CX Codex +1 1 500установок flutter-networking Скилл для работы с сетью во Flutter: HTTP/REST, WebSocket, авторизация, таймауты, ретраи, парсинг JSON и кэш. Пригодится, когда надо добавить запросы или разобрать сетевые ошибки. CX Codex +1 722установок flutter-drift Ведёт агента по работе с локальной базой на Drift: таблицы, запросы, реактивные стримы, миграции схемы и тесты. Пригодится, когда в проекте уже есть SQLite или вы только его заводите. CX Codex +1 671установок flutter-navigation Скилл для ИИ-агента, который разбирается с навигацией во Flutter: Navigator, go_router, диплинки, редиректы и история браузера. CX Codex +1 589установок flutter-internationalization Настраивает и чинит локализацию во Flutter через gen-l10n и ARB-файлы. Помогает перевести интерфейс, поддержать RTL и убрать устаревшие импорты package:flutter_gen. CX Codex +1 536установок dart-drift Скилл для работы с Drift в Dart CLI, серверных и десктопных приложениях без Flutter: таблицы, запросы, миграции, PostgreSQL. CX Codex +1 466установок agents-md-generator Создаёт и чистит AGENTS.md в корне репозитория и во вложенных модулях. Пригодится, когда инструкции для агента разрослись или противоречат друг другу. CX Codex +1 379установок

Спонсоры проекта

Компании, которые помогают держать аналитику открытой