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

react-flow · framara — скилл для Claude Code: графы на React Flow

Скилл для работы с React Flow (@xyflow/react): кастомные узлы и рёбра, состояние, лейаут, типизация и отладка графов.

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

Что делает react-flow

Скилл даёт агенту справочник по React Flow v12 и правила поведения при генерации кода. Внутри — маршрутная карта по ссылкам: фундаментальные основы, кастомные узлы и рёбра, интерактивность, управление состоянием, TypeScript, лейаут через dagre и elkjs, компоненты и хуки, производительность и стили, доступность, SSR и гидратация, E2E-тесты на Playwright, продвинутые паттерны вроде undo/redo и computed flows.

Отдельный блок описывает частые ошибки и что делать: пустой холст без ошибок, предупреждение про nodeTypes, рёбра не на месте, ввод внутри узла не работает, узлы отскакивают после перетаскивания. Есть шаблон быстрой триажи: агент сначала выясняет версию React Flow, TypeScript или JavaScript, подход к состоянию, ожидаемое число узлов и способ стилизации.

Скилл требует держать nodeTypes и edgeTypes вне тела компонента или в useMemo, подключать @xyflow/react/dist/style.css, задавать контейнеру ненулевые размеры и использовать классы nodrag и nowheel. Скрывать handles советует через visibility: hidden или opacity: 0, потому что display: none ломает расчёт размеров. Перед применением API стоит сверить версию в lockfile проекта: рекомендации выверены по @xyflow/react 12.12.0, а «v12+» не значит, что в каждом миноре есть все возможности.

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

  • собрать интерактивный граф на узлах и рёбрах
  • написать кастомный узел с полями ввода и кнопками
  • починить пустой холст без ошибок в консоли
  • разложить узлы автоматически через dagre или elkjs
  • убрать лишние ре-рендеры при перетаскивании

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

  • сделай кастомный узел с полем ввода и двумя handles, ввод должен быть с классом nodrag
  • рёбра рисуются не на месте — проверь handles и подскажи, что исправить
  • разложи граф через elkjs и добавь MiniMap с Controls

Как установить react-flow

1Через Skills CLI (Vercel)

npx skills add framara/react-flow-skill --skill react-flow -a claude-code
npx skills add framara/react-flow-skill --skill framara-react-flow -a claude-code

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

~/.claude/skills/framara-react-flow/SKILL.md

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

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

Другие версии react-flow

Похожие

react-flow-code-review existential-birds Проверяет код на @xyflow/react по чек-листу: антипаттерны, лишние ре-рендеры, типы. Пригодится, когда граф тормозит или ноды пересоздаются. CX Codex +1 319установок graph-viewer cognitedata Скилл помогает встроить интерактивный граф модели данных CDF в приложение на Flows: узлы, связи и обратные связи. CX Codex +1 1 900установок react vercel-labs Скилл помогает собирать React-интерфейсы из JSON-спецификаций через json-render. Нужен для каталогов компонентов и UI, который создаёт ИИ. CX Codex +1 16 300установок react-expert https://github.com/Jeffallan Скилл для разработки на React 18+, Next.js App Router и create-react-app. Генерирует компоненты, хуки, чинит рендер и переводит классовые компоненты на функциональные. CX Codex +1 5 500установок react-mcp assistant-ui Скилл для работы с @assistant-ui/react-mcp: подключает MCP-серверы, выбранные пользователем, прямо в браузере и регистрирует их инструменты в чате. CX Codex +1 4 000установок typescript-react-patterns agent-skills Скилл с 33 правилами типизации React на TypeScript: пропсы, хуки, события, refs, дженерики и контекст. Пригодится, когда агент пишет компоненты и лезет в типы. CX Codex +1 1 100установок

Рядом в теме «Фронтенд и UI»

Всё по теме «Фронтенд и UI» →

Вопросы о react-flow

Как установить react-flow в Claude?

Через npx skills add framara/react-flow-skill --skill framara-react-flow -a claude-code. Файл скилла окажется по пути ~/.claude/skills/framara-react-flow/SKILL.md.

Что делает скилл react-flow?

Подсказывает агенту, как писать и отлаживать код на React Flow: кастомные узлы и рёбра, состояние, типизация, лейаут, доступность, SSR. Плюс разбирает типичные ошибки вроде пустого холста и предупреждений про nodeTypes.

С какими версиями React Flow он работает?

Рекомендации выверены по @xyflow/react 12.12.0. Для старых проектов на reactflow или react-flow-renderer есть отдельная ссылка по миграции, но до неё скилл советует следовать API, который уже стоит в проекте.

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

SKILL.md · MIT
---
name: react-flow
description: "Expert guidance for React Flow (@xyflow/react): building interactive node-based graphs, custom nodes and edges, handles, state management, layouting, TypeScript patterns, performance optimization, accessibility, SSR, and theming. Use when writing React Flow code, creating custom nodes or edges, debugging flow issues, optimizing graph performance, integrating with Zustand, or building canvas-based UIs with React Flow."
---

# React Flow

## Overview

Use this skill to build, customize, debug, and optimize interactive node-based UIs with React Flow (@xyflow/react v12+). Covers everything from basic setup to advanced patterns like computed flows, sub-flows, and external layout integration.

## Version and source policy

Guidance reviewed against `@xyflow/react` **12.12.0** on **2026-09-28**. Check the target project's installed version and lockfile before applying an API; “v12+” does not mean every minor release has every feature. Preserve the project's state and styling choices unless the task requires changing them.

Use the [official documentation index](https://reactflow.dev/llms.txt) to find a specific guide or API page. For version-sensitive behavior, check [release notes](https://github.com/xyflow/xyflow/releases) and the installed package's declarations/source. Read only the references relevant to the task. Examples with omitted imports or `...` are integration sketches, not standalone applications.

## Agent behavior contract (follow these rules)

1. For v12 projects, import from `@xyflow/react`. If maintaining a legacy project, follow its installed API until a migration is in scope.
2. Always import the stylesheet: `import '@xyflow/react/dist/style.css'` (or `base.css` when replacing the default visual styles).
3. The `<ReactFlow>` parent container **must** resolve to nonzero width and height (explicit sizing or a sized flex/grid layout).
4. Define `nodeTypes` and `edgeTypes` objects **outside** component bodies or wrap in `useMemo` to prevent re-renders.
5. Use custom nodes for application-specific content or handles; built-in nodes remain suitable for simple labeled graphs.
6. Use the `nodrag` class on interactive elements inside custom nodes (inputs, buttons, selects).
7. Use `nowheel` class on scrollable elements inside custom nodes to prevent zoom interference.
8. When hiding handles, use `visibility: hidden` or `opacity: 0` — never `display: none` (breaks dimension calculation).
9. When using multiple handles of the same type on a node, always assign unique `id` props.
10. After adding, removing, or repositioning handles, call `useUpdateNodeInternals` after the DOM update, such as in an effect.
11. Always create new objects when updating node/edge state — mutations are not detected by React Flow.
12. Prefer controlled flows for non-trivial applications. Wire `onNodesChange` and `onEdgesChange` for editable controlled elements, and add `onConnect` only when users can create connections.

## First 60 seconds (triage template)

- Identify the goal from the request: new flow setup, custom nodes/edges, state management, layout, performance, styling, E2E testing, advanced patterns (undo/redo, copy/paste, computed flows, collaboration), or debugging.
- Inspect the project for these facts; ask only when a missing fact affects the solution:
  - React Flow version (v12+ uses `@xyflow/react`)
  - TypeScript or JavaScript
  - State management approach (local state, Zustand, Redux)
  - Number of nodes expected (affects performance strategy)
  - Styling approach (CSS, Tailwind, styled-components)
- Branch quickly:
  - migrating from legacy `reactflow` or `react-flow-renderer` -> package rename, import changes, API differences
  - blank canvas or missing nodes -> container dimensions or missing CSS import
  - edges not rendering -> missing handles, missing CSS, or `display: none` on handles
  - re-renders or sluggish performance -> nodeTypes defined inside component, missing memoization
  - connecting nodes not working -> missing `onConnect` handler or handle configuration
  - layout/positioning -> external layout library integration (dagre, elkjs)
  - type errors -> TypeScript generic patterns for Node/Edge types

## Routing map (read the right reference fast)

- Migrating from `reactflow` or `react-flow-renderer` to `@xyflow/react` v12 -> `references/migration.md`
- Installation, setup, first flow, node/edge objects -> `references/fundamentals.md`
- Custom node components, Handle, multiple handles, drag handles -> `references/custom-nodes.md`
- Custom edge components, path utilities, edge labels, markers -> `references/custom-edges.md`
- Event handlers, callbacks, connection validation, selection, keyboard -> `references/interactivity.md`
- Controlled vs uncontrolled, Zustand integration, state update patterns -> `references/state-management.md`
- Node/Edge types, generics, union types, type guards -> `references/typescript.md`
- External layout libraries (dagre, elkjs, d3), sub-flows, parent-child -> `references/layouting.md`
- Background, Controls, MiniMap, Panel, NodeToolbar, NodeResizer, hooks -> `references/components-and-hooks.md`
- Memoization, render optimization, theming, CSS variables, Tailwind -> `references/performance-and-styling.md`
- Keyboard workflows, accessible names, focus management, assistive technology -> `references/accessibility.md`
- Server rendering, initial geometry, hydration, Next.js boundaries -> `references/ssr-and-hydration.md`
- Common errors, debugging, edge display issues, Zustand warnings -> `references/troubleshooting.md`
- Playwright E2E tests, flow selectors, drag/viewport/connection testing -> `references/e2e-testing.md`
- Undo/redo, copy/paste, computed flows, dynamic handles, save/restore, collaboration -> `references/advanced-patterns.md`
- Context menu add node, drag-and-drop sidebar, detail panel, export as image -> `references/recipes.md`

## Common pitfalls -> next best move

- Blank canvas with no errors -> parent container has no height; set explicit `height: 100vh` or equivalent.
- `nodeTypes` / `edgeTypes` warning -> move object definition outside component body or wrap in `useMemo`.
- Edges render but in wrong position -> handles use `display: none`; switch to `opacity: 0`.
- Cannot interact with inputs inside nodes -> add `className="nodrag"` to interactive elements.
- Nodes snap back after drag -> `onNodesChange` not wired up or not applying changes correctly.
- Connection line appears but edge never creates -> `onConnect` handler missing or not calling `addEdge`.
- Multiple handles on same side overlap -> position them with CSS (`top` offset) and assign unique `id`s.
- State updates don't reflect in nodes -> creating mutations instead of new objects; spread operator required.
- Zustand context warning -> two versions of `@xyflow/react` installed or missing `<ReactFlowProvider>`.
- Sub-flow children mispositioned with "Parent node not found" warning -> ensure parent nodes appear before children in the `nodes` array.

## Verification checklist

- Confirm `@xyflow/react/dist/style.css` is imported (or `base.css` + custom styles).
- Confirm the parent container resolves to nonzero width and height.
- Confirm `nodeTypes` / `edgeTypes` are stable references (defined outside component or memoized).
- Confirm custom nodes that need connections use `<Handle>` components with proper `type`, `position`, and IDs.
- Confirm interactive elements inside nodes have `nodrag` class.
- Confirm controlled flows wire `onNodesChange`/`onEdgesChange` for editable elements and `onConnect` when connection creation is enabled.
- Confirm state updates create new node/edge objects (no mutations).
- Confirm TypeScript generics are applied to hooks and callbacks for type safety.
- Confirm performance-sensitive flows memoize custom node/edge components with `React.memo`.

For changed examples, type-check complete snippets and exercise the affected interaction in a real browser. Compilation alone does not verify handles, edge geometry, dragging, or viewport visibility.

## References

- `references/migration.md`
- `references/fundamentals.md`
- `references/custom-nodes.md`
- `references/custom-edges.md`
- `references/interactivity.md`
- `references/state-management.md`
- `references/typescript.md`
- `references/layouting.md`
- `references/components-and-hooks.md`
- `references/performance-and-styling.md`
- `references/troubleshooting.md`
- `references/e2e-testing.md`
- `references/advanced-patterns.md`
- `references/recipes.md`
- `references/accessibility.md`
- `references/ssr-and-hydration.md`

© framara · MIT · framara/react-flow-skill

Смотрите также

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

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