xyflow
БесплатноБез исполняемых скриптовНе проверенxyflow is the library family behind React Flow (@xyflow/react) and Svelte Flow (@xyflow/svelte) for building node-based editors: draggable nodes, connectable…
от TerminalSkills★ 221 звезда на GitHubОб этом скилле
xyflow — node-based editors for React and Svelte
Overview
xyflow is the monorepo that publishes two libraries with the same ideas: React Flow as @xyflow/react and Svelte Flow as @xyflow/svelte. Both render an interactive canvas where nodes (with a position and data) are joined by edges (with a source and target), and both bring zoom, pan, selection, dragging and connecting out of the box, plus Background, Controls and MiniMap helpers.
The package name matters. Version 12 of React Flow is published as @xyflow/react and exports ReactFlow as a named export. The older unscoped reactflow package is the legacy v11 line, whose API differs (default export, reactflow/dist/style.css); do not mix examples between them. This skill documents @xyflow/react first and @xyflow/svelte in a short section.
The library draws the graph and handles interaction. It does not execute a workflow, lay nodes out automatically, or save anything; those parts belong to your code (or to a layout library such as dagre or elkjs).
Instructions
Installation
npm install @xyflow/react
For Svelte 5:
npm install @xyflow/svelte
The stylesheet is mandatory; without it nodes and edges render unstyled:
import '@xyflow/react/dist/style.css';
<ReactFlow /> fills its parent. The parent must have an explicit height, otherwise the canvas is 0 pixels tall and nothing shows.
A controlled flow
useNodesState and useEdgesState give you state plus the change handlers the component needs for dragging, selecting and deleting. addEdge turns a finished connection into an edge.
import { useCallback } from 'react';
import {
ReactFlow, Background, Controls, MiniMap, BackgroundVariant,
useNodesState, useEdgesState, addEdge,
type Node, type Edge, type OnConnect,
} from '@xyflow/react';
import '@xyflow/react/dist/style.css';
const initialNodes: Node[] = [
{ id: 'webhook', position: { x: 0, y: 0 }, data: { label: 'Webhook' }, type: 'input' },
{ id: 'summarize', position: { x: 0, y: 120 }, data: { label: 'Summarize ticket' } },
];
const initialEdges: Edge[] = [{ id: 'webhook-summarize', source: 'webhook', target: 'summarize' }];
export default function Flow() {
const [nodes, , onNodesChange] = useNodesState(initialNodes);
const [edges, setEdges, onEdgesChange] = useEdgesState(initialEdges);
const onConnect: OnConnect = useCallback((c) => setEdges((eds) => addEdge(c, eds)), [setEdges]);
return (
<div style={{ width: '100vw', height: '100vh' }}>
<ReactFlow
nodes={nodes}
edges={edges}
onNodesChange={onNodesChange}
onEdgesChange={onEdgesChange}
onConnect={onConnect}
fitView
>
<Background variant={BackgroundVariant.Dots} gap={16} />
<Controls />
<MiniMap />
</ReactFlow>
</div>
);
}
Built-in node types are default, input and output. Node ids and edge ids must be unique strings. Pass colorMode="system" (or "dark"/"light") for theming.
Custom nodes and handles
A custom node is a React component registered under a type. A Handle is a connection point: type="source" starts a connection, type="target" receives one. Define the nodeTypes object outside the component (or memoise it); creating it inside the render function makes React Flow log a warning that you created a new nodeTypes object.
import { Handle, Position, type Node, type NodeProps, type NodeTypes } from '@xyflow/react';
type StepData = { label: string; kind: 'trigger' | 'llm' | 'action' };
type StepNode = Node<StepData, 'step'>;
function StepNodeView({ data, selected }: NodeProps<StepNode>) {
return (
<div className={selected ? 'step step-selected' : 'step'}>
{data.kind !== 'trigger' && <Handle type="target" position={Position.Top} />}
<strong>{data.label}</strong>
<Handle type="source" position={Position.Bottom} />
</div>
);
}
export const nodeTypes: NodeTypes = { step: StepNodeView };
Use it with <ReactFlow nodeTypes={nodeTypes} ... /> and nodes shaped { id, type: 'step', position, data: { label, kind } }. Give a node several handles by adding an id to each Handle, then reference it from an edge with sourceHandle or targetHandle. Add the CSS class nodrag to inputs and buttons inside a node so that typing or clicking does not drag the node.
Hooks need a provider
Hooks such as useReactFlow, useNodes and useNodeId only work below a <ReactFlowProvider>, or inside the <ReactFlow> tree itself. If a toolbar outside the canvas needs them, wrap both:
import { ReactFlowProvider, useReactFlow } from '@xyflow/react';
function SaveButton() {
const { toObject, fitView, screenToFlowPosition, updateNodeData } = useReactFlow();
return <button onClick={() => localStorage.setItem('flow', JSON.stringify(toObject()))}>Save</button>;
}
export default function App() {
return (
Установить xyflow в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл xyflow?
xyflow is the library family behind React Flow (@xyflow/react) and Svelte Flow (@xyflow/svelte) for building node-based editors: draggable nodes, connectable edges, zoom and pan. Use when a user asks to "build a workflow editor", "add a node graph or flowchart to the app", "make a drag-and-drop pipeline builder", "create custom nodes with handles", or "save and restore a React Flow diagram". Covers v12 setup, controlled state, custom nodes, handles, providers and persistence.
Как установить скилл xyflow?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл xyflow запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
ci-review
The scan that the plugin's GitHub Action runs.
от Anthropicazure-static-web-apps
Helps create, configure, and deploy Azure Static Web Apps using the SWA CLI. Use when deploying static sites to Azure, setting up SWA local development…
от GitHubai-ready
Make any repo AI-ready — analyzes your codebase and generates AGENTS.md, copilot-instructions.md, CI workflows, issue templates, and more. Mines your PR…
от GitHubaws-cdk-python-setup
Setup and initialization guide for developing AWS CDK (Cloud Development Kit) applications in Python. This skill enables users to configure environment…
от GitHub