react-flow-best-practices

react-flow-best-practices is a skill for Codex from JohnWayneeee/ai-agent-skills. It costs 73 tokens per session (998 once invoked), scanned A, original, MIT.

A set of practices for building and reviewing React Flow, also called @xyflow/react, workflow canvases in React.

In plain words
What is it for?
Use it for custom nodes, edges, handles, toolbars, resizers, minimaps, backgrounds, panels, canvas state, and workflow-builder reviews.
Why use it?
It helps avoid unstable node and handle identifiers, incorrect data types, inaccessible controls, viewport problems, and performance issues as diagrams grow.

Skill for Codex

Written for Codex: agents/openai.yaml present.

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/johnwayneeee/ai-agent-skills/react-flow-best-practices
Any agent
npx skills add JohnWayneeee/ai-agent-skills --skill react-flow-best-practices
Clone the repo
git clone --depth 1 https://github.com/JohnWayneeee/ai-agent-skills

Made for: Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for react-flow-best-practices

README.md
[![agentmods](https://agentmods.dev/badge/skills/johnwayneeee/ai-agent-skills/react-flow-best-practices.svg)](https://agentmods.dev/skills/johnwayneeee/ai-agent-skills/react-flow-best-practices)
Your own site
<a href="https://agentmods.dev/skills/johnwayneeee/ai-agent-skills/react-flow-best-practices"><img src="https://agentmods.dev/badge/skills/johnwayneeee/ai-agent-skills/react-flow-best-practices.svg" alt="Measured on agentmods" height="20"></a>
Per session 73 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 998 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00073 $0.00998
Opus 5 $0.00036 $0.00499
Sonnet 5 $0.00015 $0.00200
Haiku 4.5 $0.00007 $0.00100

Measured 6d ago against content hash 2188e3302553, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

react-flow-best-practices scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/react-flow-best-practices/SKILL.md · 71 lines

How it starts

The opening of the file, as written. The whole thing — 71 lines — stays where its author put it; the contents beside it link to each section on GitHub.

React Flow Best Practices

Purpose

Use this skill to review and improve React Flow implementations with the current @xyflow/react v12 patterns. Optimize for correctness first: stable node and handle IDs, typed node data, predictable viewport behavior, accessible controls, and performance that does not collapse as the workflow grows.

First Steps

  1. Inspect the React Flow package and usage:
    • package.json for @xyflow/react.
    • Global CSS for @xyflow/react/dist/style.css.
    • Canvas and node widget directories.
  2. If API behavior is version-sensitive or uncertain, fetch current docs with Context7 for React Flow / @xyflow/react before recommending changes.
  3. Choose the smallest reference file needed:
    • Canvas/state/viewport: read references/canvas-state-and-viewport.md.
    • Custom nodes, handles, toolbars, resizers, edges: read references/custom-nodes-handles-and-edges.md.
    • Review output checklist: read references/review-checklist.md.

Review Workflow

  1. Map the flow architecture before judging details.
    • Identify where domain data becomes Node[] and Edge[].
    • Identify the ReactFlow wrapper, provider boundary, custom nodeTypes, custom edgeTypes, and global CSS import.
    • Confirm whether the canvas is static/narrative, editable, or partially interactive. This changes which issues matter.
  2. Check identity contracts.
    • Node id, node type, handle id, sourceHandle, and targetHandle must line up exactly.
    • Edge ids should be deterministic from source/target/semantic relationship.
    • Changing these IDs is a migration-level change because saved flows, viewport focus, and edges can break.
  3. Check state ownership.
    • Use controlled nodes and edges when the app needs domain-driven status, selection, persistence, or custom updates.
    • Preserve user moves/resizes unless the product intentionally rebuilds layout from domain state.
    • Keep frequent transient canvas state out of app-global stores unless another feature truly needs it.
  4. Check custom components.
    • nodeTypes and edgeTypes must be defined outside render or memoized.
    • Custom nodes should use typed NodeProps<Node<Data, "type">> when practical.
    • Interactive controls inside nodes or edge labels need nodrag, nopan, and often nowheel.
  5. Check viewport and accessibility.
    • Do not let auto-fit or status-driven focus override a user's manual pan/zoom after interaction.
    • Keep keyboard behavior deliberate: selection, multi-selection, pan activation, delete key, focusability.
    • Provide ariaLabelConfig, useful labels for custom controls, and visible selected/focused states.
  6. Report findings with concrete risk.
    • Explain whether the issue can break edges, cause re-renders, trap interactions, override user viewport, or reduce accessibility.
    • Prefer small, local fixes that preserve existing visual language and architectural boundaries.

Read the full file on GitHub · 71 lines

Files

What ships with it

4 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 71 lines · 73 tokens per session scan A 2188e3302553

Subscribe to this mod's changes

react-flow-best-practices is a skill published in the GitHub repository JohnWayneeee/ai-agent-skills (1 stars, last pushed 3mo ago), licensed MIT. It adds 73 tokens to every session and 998 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.