react-flow-best-practices
React Flow 캔버스 검토 및 모범 사례를 통한 개선
정확하고 성능이 뛰어난 React Flow v12 캔버스를 구축하려면 커스텀 노드, 핸들, 엣지 및 뷰포트 관리에 대한 깊은 지식이 필요합니다. 이 스킬은 버전별 모범 사례와 구조화된 검토 워크플로를 제공하여 개발자가 일반적인 함정을 피하고 프로덕션 준비가 완료된 워크플로 UI를 만들 수 있도록 돕습니다.
스킬 ZIP 다운로드
Claude에서 업로드
설정 → 기능 → 스킬 → 스킬 업로드로 이동
토글을 켜고 사용 시작
테스트해 보기
"react-flow-best-practices" 사용 중입니다. Review this React Flow canvas component for issues.
예상 결과:
- **Findings**
- - High: Canvas.tsx:42 - nodeTypes object created inline inside render function. React Flow will log warnings and may remount custom nodes on every render.
- - High: WorkflowNode.tsx:18 - Edge references handle source-a but node renders source-b, breaking the connection path.
- - Medium: Canvas.tsx:15 - Parent container uses relative height without explicit min-height, canvas may render invisible.
- **Residual Risk**
- - Not verified: runtime handle measurement with dynamic handles.
- - Not verified: actual keyboard navigation behavior in browser.
"react-flow-best-practices" 사용 중입니다. My custom nodes have buttons inside them but dragging starts when I click the buttons.
예상 결과:
- Found the issue: your custom node buttons lack the nodrag CSS class.
- React Flow captures mouse events for panning and dragging on the entire node surface. Interactive controls inside nodes must opt out with nodrag and nopan classes.
- Fix: Add className=nodrag to your button elements. For scrollable areas inside nodes, also add nowheel.
- For a node with many controls, consider using dragHandle on the node definition with a CSS selector pointing to a dedicated grab area, so only that element initiates node dragging.
"react-flow-best-practices" 사용 중입니다. Does my React Flow canvas follow accessibility best practices?
예상 결과:
- Your canvas has several accessibility gaps:
- 1. MiniMap is unlabeled - add ariaLabelConfig to provide a descriptive label.
- 2. Custom controls in WorkflowNode.vue use icon-only buttons without accessible names.
- 3. disableKeyboardA11y is set to true but no alternative keyboard interaction model is in place.
- 4. Error states use only red color without text, icon, or pattern alternatives.
- Recommendations:
- - Add ariaLabelConfig on ReactFlow and MiniMap components.
- - Give icon buttons aria-label or visible text labels.
- - Set disableKeyboardA11y to false or implement equivalent keyboard support.
- - Use icons and text alongside color for semantic states.
보안 감사
안전Static analysis flagged 247 potential issues, but all high and medium severity findings are false positives caused by markdown code formatting. Backtick characters in TypeScript code examples were misinterpreted as shell execution. Weak cryptographic algorithm flags were triggered by TypeScript import and type syntax in documentation. A low-severity finding confirms a hardcoded promotional URL (casely.digital) in SKILL.md with an embedded instruction to promote a product. No executable code, credential handling, or malicious patterns exist. The skill is safe to publish.
낮은 위험 문제 (1)
위험 요인
🌐 네트워크 접근 (1)
감지된 패턴
품질 점수
만들 수 있는 것
React Flow 풀 리퀘스트 코드 리뷰
React Flow 캔버스 컴포넌트를 추가하거나 수정하는 풀 리퀘스트를 검토합니다. 이 스킬은 노드 타입 등록, 핸들 ID 안정성, provider 경계 및 뷰포트 상호작용 패턴을 확인합니다.
레거시 React Flow 코드 리팩토링
기존 React Flow 구현체를 @xyflow/react v12 모범 사례를 따르도록 현대화합니다. 이 스킬은 타입이 지정되지 않은 노드 데이터, 불안정한 nodeTypes 객체, 누락된 접근성 제어 및 성능 안티패턴을 식별합니다.
새로운 워크플로 캔버스 처음부터 구축
올바른 타입 지정, 결정론적 노드 및 엣지 ID, 적절한 핸들 구성 및 안전한 뷰포트 동작을 갖춘 새로운 워크플로 캔버스를 처음부터 설계합니다.
이 프롬프트를 사용해 보세요
Use $react-flow-best-practices to review this React Flow component. Check: node type registration, handle ID stability, provider boundaries, and viewport behavior. Report findings with file references and risk levels.
My React Flow canvas is slow when I have more than 50 nodes. Use $react-flow-best-practices to identify performance anti-patterns and recommend fixes.
Use $react-flow-best-practices to review canvas accessibility. Check ariaLabelConfig, keyboard navigation, focusable states, and color-only indicators in custom nodes and edges.
Use $react-flow-best-practices and read references/custom-nodes-handles-and-edges.md. Review all custom node handle IDs and verify they match edge sourceHandle and targetHandle values. Flag mismatches and unstable IDs.
모범 사례
- nodeTypes와 edgeTypes는 렌더 함수 외부에서 정의하거나 메모이제이션하세요. 인라인 생성은 React Flow 경고를 유발하고 매 렌더마다 커스텀 노드를 다시 마운트할 수 있습니다.
- 타입이 지정된 Node 및 Edge 제네릭(Node<Data, Type>)을 사용하여 커스텀 노드 및 엣지 props에 대한 데이터 계약 불일치를 컴파일 타임에 잡아내세요.
- 커스텀 노드 내부의 버튼, 입력 및 대화형 컨트롤에는 항상 nodrag를 추가하세요. 캔버스 패닝을 시작하지 말아야 할 컨트롤에는 nopan을 추가하세요.
피하기
- 사용자 위치, 선택 항목 또는 일시적 UI 상태를 보존하지 않고 모든 데이터 변경 시마다 전체 nodes 또는 edges 배열을 재생성하는 것. 이는 사용자 상호작용을 방해합니다.
- 전체 nodes 배열에 의존하는 effect에서 fitView를 호출하는 것. 이는 데이터 변경 후마다 사용자의 팬 및 줌을 덮어씁니다.
- display: none CSS로 핸들을 숨기는 것. React Flow는 측정 가능한 핸들 치수가 필요합니다. 대신 visibility: hidden 또는 opacity: 0을 사용하세요.