跳到正文
Skillpedia
网站与界面(前端)48k · #5576

react-flow-node-ts

它能做什么

这个工具可以帮你为 React Flow 程序创建可视化组件。它提供模板和操作说明,让你能够按照规范、正确地定义并构建新的积木块(称为“节点”)。

适用场景

  • ✓当你需要为图表创建一种新的可视化积木块时。
  • ✓当你想为已有的积木块添加特定功能时。
  • ✓为了让图表中的积木块保持统一的写法。

技能链接

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/react-flow-node-ts/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/react-flow-node-ts/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“帮我创建一个新节点,用来在图表中显示用户信息,包含姓名和邮箱两个字段。”

每周 5 个新技能,1 分钟读完。

工作原理

你可以复制现成的模板,然后替换积木块的名称以及它要显示的数据。接着按照步骤,把这个新积木块接入主程序。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Bundled upstream support

Supporting files are included at skill-relative paths. See UPSTREAM-NOTICE.md for their pinned sources, licenses, hashes, and import changes.

React Flow Node

Create React Flow node components following established patterns with proper TypeScript types and store integration.

Quick Start

Copy templates from assets/ and replace placeholders:

  • {{NodeName}} → PascalCase component name (e.g., VideoNode)
  • {{nodeType}} → kebab-case type identifier (e.g., video-node)
  • {{NodeData}} → Data interface name (e.g., VideoNodeData)

Templates

  • assets/template.tsx - Node component
  • assets/types.template.ts - TypeScript definitions

Node Component Pattern

export const MyNode = memo(function MyNode({
  id,
  data,
  selected,
  width,
  height,
}: MyNodeProps) {
  const updateNode = useAppStore((state) => state.updateNode);
  const canvasMode = useAppStore((state) => state.canvasMode);
  
  return (
    <>
      <NodeResizer isVisible={selected && canvasMode === 'editing'} />
      <div className="node-container">
        <Handle type="target" position={Position.Top} />
        {/* Node content */}
        <Handle type="source" position={Position.Bottom} />
      </div>
    </>
  );
});

Type Definition Pattern

export interface MyNodeData extends Record<string, unknown> {
  title: string;
  description?: string;
}

export type MyNode = Node<MyNodeData, 'my-node'>;

Integration Steps

  1. Add type to src/frontend/src/types/index.ts
  2. Create component in src/frontend/src/components/nodes/
  3. Export from src/frontend/src/components/nodes/index.ts
  4. Add defaults in src/frontend/src/store/app-store.ts
  5. Register in canvas nodeTypes
  6. Add to AddBlockMenu and ConnectMenu

When to Use

This skill is applicable to execute the workflow or actions described in the overview.

Limitations

  • Use this skill only when the task clearly matches the scope described above.
  • Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
  • Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
常见问题

React Flow 中的“节点”是什么?

节点是构成图表或可视化流程的单个积木块,是 React Flow 应用的基本组成部分。

“TypeScript 类型”是什么意思?

TypeScript 是一种语言,它通过明确规定代码各部分应接收或返回哪种信息,帮助避免错误。

“Store 集成”是什么?

指把新的积木块连接到应用的主状态系统中,使它能够保存和读取信息,并与其他积木块交互。

详情

作者的原始描述

Create React Flow node components following established patterns with proper TypeScript types and store integration.

repo: sickn33/agentic-awesome-skills

热度

GitHub 星标
48k
排名
#5576
许可证
MIT
更新时间
2026/10/15

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能