workflow-builder
Prerequisite: This skill requires a schema0 template project. Before using, ensure
CLAUDE.mdexists in the project root and read it for project rules and conventions.
React Flow Skill (Progressive Disclosure)
Use this skill for production React Flow work. Keep SKILL.md for invariants only. Load reference files only as needed.
Critical Setup Rules
- Install and import: use
@xyflow/react(notreactflow). - Use named imports only:
import { ReactFlow, ... } from '@xyflow/react'(no defaultReactFlowimport). - Import styles from
@xyflow/react/dist/style.css(or@xyflow/react/dist/base.cssfor custom theming). - Use immutable node/edge updates only. Do not mutate node or edge objects in place.
Non-Negotiable Rules
ReactFlowis a named export, not a default export.- Read measured dimensions from
node.measured?.width/node.measured?.height. node.width/node.heightare for fixed dimensions, not measured dimensions.- Use
parentId(notparentNode). - Use
onReconnect,reconnectEdge, andedgesReconnectable(notonEdgeUpdate,updateEdge,edgesUpdatable). - Use
positionAbsoluteX/positionAbsoluteYin custom node props (notxPos/yPos). - Use
nodeLookupin internal store selectors (notnodeInternals). - Use
screenToFlowPosition(notproject) for screen-to-canvas coordinates. - Call
getNodesBounds(nodes, { nodeOrigin })with an options object. - Model custom nodes as a typed union (
type AppNode = ...) for TypeScript safety.
Required Architecture Mandates (Production SaaS)
- Use a dedicated Zustand store for production state (
nodes,edges, and flow actions). AvoiduseNodesState/useEdgesStateexcept for prototypes. - Wrap the editor with
ReactFlowProviderwhenever hooks are used outside the<ReactFlow />subtree. - Define
nodeTypes,edgeTypes, anddefaultEdgeOptionsoutside React components to avoid re-render loops. - Memoize all custom node and edge components.
- Keep event handlers passed to
<ReactFlow />stable (useCallbackor equivalent stable references). - Centralize serialization (
toObject, restore, viewport restore) in store/actions or dedicated modules.
Performance Landmines
- Do not use
useNodes()/useEdges()inside custom nodes; they trigger broad re-renders. - Prefer
useNodesData,useHandleConnections, oruseStoreselectors for targeted subscriptions. - Avoid broad Zustand subscriptions in render; select only needed slices.
- For large graphs, batch state updates and keep node/edge registries stable.
- Run layout only after nodes are measured when the algorithm depends on dimensions.
Security and Data Integrity Invariants
- Treat serialized flow JSON from clients as untrusted input; validate node/edge schemas server-side before persistence.
- Do not assume client-provided IDs are safe or unique across tenants; normalize or regenerate IDs in backend workflows.
- Enforce authorization on flow read/write endpoints independently of front-end visibility controls.
Reference Loading Guide
- Import and setup reference:
references/migration/imports-and-setup.md - Production store/editor shell structure:
references/architecture/production-zustand-store-and-shell.md - Custom nodes/edges and core workflows:
references/examples/custom-nodes-edges-and-core-workflows.md - API props and built-in components:
references/api/reactflow-component-and-components.md - Hooks:
references/hooks/reactflow-hooks.md - Types and utilities:
references/types/reactflow-types-and-utilities.md - Editor interaction patterns (undo/redo, copy/paste, context menus):
references/patterns/editor-interactions.md - Layout/grouping/validation:
references/patterns/layout-grouping-and-validation.md - Persistence/theming/testing/collaboration:
references/patterns/persistence-theming-testing-and-collab.md
More from schema0/ai-agent-plugins
manage-secrets
Add and manage application secrets and environment variables. Use when adding API keys, credentials, or updating env.ts.
2schema-gen
Generates database table schema with Drizzle ORM (project)
2rls-setup
Set up database tables with Row-Level Security policies, configure authenticated connections, and implement secure user-scoped data access patterns (Do not apply this skill unless specifically asked by user) (project)
2api-router
Generates ORPC routers with drizzle-zod schemas from db package, bulk operations, and protected procedures (project)
2handle-views
Generates route components - List Route and Detail Route (project)
2ai-integration
Generate AI-powered features using AI SDK with oRPC. Use when building chat apps, AI endpoints, or integrating LLMs.
2