
React Flow Implementation
Implement node-based flow charts, diagrams, and visual editors with @xyflow/react without missing styles, handles, or state wiring.
Overview
React Flow Implementation is an agent skill for the Build phase that implements @xyflow/react node-based UIs with correct styles, state, handles, and viewport behavior.
Install
npx skills add https://github.com/existential-birds/beagle --skill react-flow-implementationWhat is this skill?
- Quick-start pattern with useNodesState, useEdgesState, addEdge, and mandatory @xyflow/react CSS import
- Ordered implementation gates: styles, container sizing, handles, custom nodes, and state before shipping polish
- Covers nodes, edges, handles, custom components, state management, and viewport control
- Explicit trigger: flow charts, diagrams, visual editors, and node-based applications
- Ordered implementation gates checklist (styles-on-page gate is step 1; run gates in sequence)
Adoption & trust: 1 installs on skills.sh; 62 GitHub stars; 3/3 security scanners passed (skills.sh audits); trending (+100% hot-view momentum).
What problem does it solve?
You need a flow chart or visual editor in React but React Flow breaks silently when CSS, dimensions, or connection handlers are wrong.
Who is it for?
Indie builders creating workflow builders, diagram tools, or agent orchestration UIs on React.
Skip if: Static marketing pages with no interactive graph, or teams committed to non-React canvas libraries without @xyflow/react.
When should I use this skill?
Building flow charts, diagrams, visual editors, or node-based applications with React and @xyflow/react.
What do I get? / Deliverables
You ship a working React Flow canvas with gated checks for styles, layout, nodes, edges, and connectivity before treating the feature as done.
- Working ReactFlow component with nodes, edges, and onConnect
- Custom node/edge components when required by the spec
Recommended Skills
Journey fit
How it compares
Procedural frontend implementation skill—not a hosted diagram SaaS or generic CSS framework guide.
Common Questions / FAQ
Who is react-flow-implementation for?
Solo developers and small teams building React apps that need node-and-edge canvases with @xyflow/react.
When should I use react-flow-implementation?
During Build frontend work whenever you add flow charts, visual editors, or node-based applications and want ordered implementation gates.
Is react-flow-implementation safe to install?
It documents code patterns only; check the Security Audits panel on this page for the parent skill repo before install.
SKILL.md
READMESKILL.md - React Flow Implementation
# React Flow Implementation ## Quick Start ```tsx import { useCallback } from 'react'; import { ReactFlow, useNodesState, useEdgesState, addEdge } from '@xyflow/react'; import '@xyflow/react/dist/style.css'; const initialNodes = [ { id: '1', position: { x: 0, y: 0 }, data: { label: 'Node 1' } }, { id: '2', position: { x: 200, y: 100 }, data: { label: 'Node 2' } }, ]; const initialEdges = [{ id: 'e1-2', source: '1', target: '2' }]; export default function Flow() { const [nodes, setNodes, onNodesChange] = useNodesState(initialNodes); const [edges, setEdges, onEdgesChange] = useEdgesState(initialEdges); const onConnect = useCallback( (connection) => setEdges((eds) => addEdge(connection, eds)), [setEdges] ); return ( <div style={{ width: '100%', height: '100vh' }}> <ReactFlow nodes={nodes} edges={edges} onNodesChange={onNodesChange} onEdgesChange={onEdgesChange} onConnect={onConnect} fitView /> </div> ); } ``` ## Implementation gates Run these in order; do not skip ahead on “looks fine.” 1. **Styles on the page** — **Pass if** the bundle that renders `<ReactFlow />` imports `@xyflow/react/dist/style.css` (or equivalent CSS pipeline) so nodes/edges are visible and hit-targets match visuals. 2. **`useReactFlow` boundary** — **Pass if** every caller of `useReactFlow()` is a descendant of `<ReactFlowProvider>` that wraps the same tree as `<ReactFlow />` (or you have intentionally split stores and can name both roots). 3. **Stable `nodeTypes` / `edgeTypes`** — **Pass if** those maps are **module-scope constants** or `useMemo` with stable deps—not a new `{ ... }` literal each render in the component that renders `<ReactFlow />`. 4. **Handles match edges** — **Pass if** for nodes with multiple `Handle` `id`s, every edge that must land on a specific handle sets `sourceHandle` / `targetHandle` accordingly (or you accept default handle resolution deliberately). See [ADDITIONAL_COMPONENTS.md](ADDITIONAL_COMPONENTS.md) for MiniMap, Controls, Background, NodeToolbar, and NodeResizer patterns. ## Core Patterns ### TypeScript Types ```typescript import type { Node, Edge, NodeProps, BuiltInNode } from '@xyflow/react'; // Define custom node type with data shape type CustomNode = Node<{ value: number; label: string }, 'custom'>; // Combine with built-in nodes type MyNode = CustomNode | BuiltInNode; type MyEdge = Edge<{ weight?: number }>; // Use throughout app const [nodes, setNodes] = useNodesState<MyNode>(initialNodes); ``` ### Custom Nodes ```tsx import { memo } from 'react'; import { Handle, Position, type NodeProps } from '@xyflow/react'; // Define node type type CounterNode = Node<{ count: number }, 'counter'>; // Always wrap in memo for performance const CounterNode = memo(function CounterNode({ data, isConnectable }: NodeProps<CounterNode>) { return ( <> <Handle type="target" position={Position.Top} isConnectable={isConnectable} /> <div className="counter-node"> Count: {data.count} {/* nodrag prevents dragging when interacting with button */} <button className="nodrag" onClick={() => console.log('clicked')}> Increment </button> </div> <Handle type="source" position={Position.Bottom} isConnectable={isConnectable} /> </> ); }); // Register in nodeTypes (define OUTSIDE component to avoid re-renders) const nodeTypes = { counter: CounterNode }; // Use in ReactFlow <ReactFlow nodeTypes={nodeTypes} ... /> ``` ### Multiple Handles ```tsx // Use handle IDs when a node has multiple handles of same type <Handle type="source" position={Position.Right} id="a" /