react-flow-code-review
БесплатноБез исполняемых скриптовНе проверенReviews React Flow (@xyflow/react v12/v13) code for anti-patterns, re-render traps, SSR/measurement bugs, layout coordinate errors, and API deprecations. Use…
от existential-birds★ 92 звезды на GitHubОб этом скилле
React Flow Code Review
When reviewing React Flow (@xyflow/react v12/v13) code, complete the gates below in order. Each step has an objective pass condition before moving on.
Review Gates (Sequenced)
- Locate flow code — Search the review scope for
@xyflow/react,ReactFlow,ReactFlowProvider,useReactFlow,nodeTypes,edgeTypes, and@dagrejs/dagre. Pass: a list of file paths (or explicit "none in scope"). - Provider & container boundary — For each
useReactFlow(),useNodesData(),useNodeConnections(), or store hook, trace the component tree to an enclosing<ReactFlowProvider>(or<ReactFlow />). Confirm the flow wrapper has explicit height/width and styles are imported. Pass: provider + container verified or concrete mismatch cited with file:line. - Stable types, memoization & subscriptions — Confirm
nodeTypes/edgeTypesare defined outside render or memoized, custom nodes/edges usememo()and typedNodeProps<T>/EdgeProps<T>, and components avoid subscribing to fullnodes/edgesarrays when targeted hooks suffice. Pass: stability and subscriptions verified or traps cited with file:line. - Report with evidence — For each finding you deliver, record file path and line number(s) (plus a minimal quoted snippet). Pass: no critical or high-severity issue is stated without that citation.
- Close the checklists — Verify Critical Anti-Patterns, v12 / v13, SSR & Layout Checks, and Performance Checklist; mark each area satisfied, not applicable (with reason), or open with evidence.
Critical Anti-Patterns
1. Defining nodeTypes / edgeTypes Inside Components
Recreates the object reference on every render, causing React Flow to unmount and remount every node/edge.
// BAD - recreates object every render
function Flow() {
const nodeTypes = { custom: CustomNode };
return <ReactFlow nodeTypes={nodeTypes} />;
}
// GOOD - module scope (or useMemo with stable deps)
const nodeTypes = { custom: CustomNode };
function Flow() {
return <ReactFlow nodeTypes={nodeTypes} />;
}
2. Missing memo() on Custom Nodes / Edges
Without memo(), panning/selecting or updating one node triggers unnecessary re-renders across every custom node/edge.
3. Subscribing to Full nodes / edges in Nodes, Edges, or Toolbars (useNodes() Trap)
Calling useNodes(), useEdges(), or subscribing to state.nodes inside a custom node/edge or status bar re-renders that component on every drag tick.
- Fix: Use
useNodesData(id | ids)for specific node data,useNodeConnections(...)for handle connections, or targeted store selectors (useStore(selector, shallow)in v12; split storesuseNodesStore/useEdgesStore+useShallowin v13).
4. Using useReactFlow() Outside ReactFlowProvider
Calling useReactFlow() in the same component that renders <ReactFlow> without an enclosing <ReactFlowProvider> throws a missing-provider runtime error. Wrap the parent in <ReactFlowProvider> or move the hook into a child component.
5. Full-Array Cloning vs updateNodeData & Direct Mutation
- Direct mutation (
nodes[0].position = ...; setNodes(nodes)) breaks React Flow's reference checks and fails to update. - Full-array mapping for data updates causes unnecessary churn; prefer
useReactFlow().updateNodeData(id, partialOrUpdater)(orupdateEdgeData) for data-only updates. - Inline callbacks: Wrap
onNodesChange,onEdgesChange,onConnect, andisValidConnectioninuseCallbackwith functionalsetNodes((nds) => ...)/setEdges((eds) => ...).
v12 / v13, SSR & Layout Checks
Flag these concrete bugs when present:
| Issue | What to Look For | Correct Pattern |
|---|---|---|
| Missing CSS or Tailwind v4 layer clash | No @xyflow/react/style.css (v13) or @xyflow/react/dist/style.css (v12) import; unlayered CSS overriding Tailwind utilities |
Import @xyflow/react/style.css (wrapped in @layer xyflow in v13) or @xyflow/react/dist/style.css (v12) |
| Missing container dimensions | <ReactFlow /> inside a height: auto or flex parent with no explicit height |
Explicit width & height (e.g., h-screen w-full or style={{ width: '100%', height: '100%' }}) |
| SSR / SSG missing node dimensions | Server-rendered flow relies on fitView or layout without static dimensions |
Provide static width/height or initialWidth/initialHeight on nodes for SSR/SSG |
Bare node.width for measured nodes |
Reading node.width / node.height after render instead of DOM-measured dimensions |
Use node.measured?.width ?? node.width ?? defaultWidth |
| Dynamic handles + stale measurement | Calling updateNodeInternals(id) synchronously inside onClick (before React commits), or passing args to useUpdateNodeInternals(id) |
`const updateNodeInternals = useUpdateNodeInternals() |
Установить react-flow-code-review в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл react-flow-code-review?
Reviews React Flow (@xyflow/react v12/v13) code for anti-patterns, re-render traps, SSR/measurement bugs, layout coordinate errors, and API deprecations. Use when reviewing node-based UI code or auditing @xyflow/react implementations.
Как установить скилл react-flow-code-review?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл react-flow-code-review запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic