svelteflow-fundamentals
БесплатноБез исполняемых скриптовНе проверенUse when building node-based UIs, flow diagrams, workflow editors, or interactive graphs with Svelte Flow. Covers setup, nodes, edges, controls, and…
от TheBushidoCollective★ 202 звезды на GitHubОб этом скилле
Svelte Flow Fundamentals
Build customizable node-based editors and interactive diagrams with Svelte Flow. This skill covers core concepts, setup, and common patterns for creating flow-based interfaces in Svelte applications.
Installation
# npm
npm install @xyflow/svelte
# pnpm
pnpm add @xyflow/svelte
# yarn
yarn add @xyflow/svelte
Basic Setup
<script lang="ts">
import {
SvelteFlow,
Controls,
Background,
MiniMap,
type Node,
type Edge,
} from '@xyflow/svelte';
import { writable } from 'svelte/store';
import '@xyflow/svelte/dist/style.css';
const nodes = writable<Node[]>([
{
id: '1',
type: 'input',
data: { label: 'Start' },
position: { x: 250, y: 0 },
},
{
id: '2',
data: { label: 'Process' },
position: { x: 250, y: 100 },
},
{
id: '3',
type: 'output',
data: { label: 'End' },
position: { x: 250, y: 200 },
},
]);
const edges = writable<Edge[]>([
{ id: 'e1-2', source: '1', target: '2' },
{ id: 'e2-3', source: '2', target: '3' },
]);
</script>
<div style="height: 100vh; width: 100vw;">
<SvelteFlow {nodes} {edges} fitView>
<Controls />
<Background />
<MiniMap />
</SvelteFlow>
</div>
Using Stores for State
<script lang="ts">
import { SvelteFlow, type Node, type Edge } from '@xyflow/svelte';
import { writable, derived } from 'svelte/store';
// Writable stores for reactive state
const nodes = writable<Node[]>([
{ id: '1', data: { label: 'Node 1' }, position: { x: 0, y: 0 } },
{ id: '2', data: { label: 'Node 2' }, position: { x: 200, y: 100 } },
]);
const edges = writable<Edge[]>([
{ id: 'e1-2', source: '1', target: '2' },
]);
// Derived store for computed values
const nodeCount = derived(nodes, ($nodes) => $nodes.length);
const edgeCount = derived(edges, ($edges) => $edges.length);
// Add a new node
function addNode() {
const id = `node-${Date.now()}`;
nodes.update((n) => [
...n,
{
id,
data: { label: `Node ${$nodeCount + 1}` },
position: { x: Math.random() * 300, y: Math.random() * 300 },
},
]);
}
// Update node data
function updateNodeLabel(id: string, label: string) {
nodes.update((n) =>
n.map((node) =>
node.id === id ? { ...node, data: { ...node.data, label } } : node
)
);
}
// Delete a node
function deleteNode(id: string) {
nodes.update((n) => n.filter((node) => node.id !== id));
// Also remove connected edges
edges.update((e) => e.filter((edge) => edge.source !== id && edge.target !== id));
}
</script>
<div>
<p>Nodes: {$nodeCount} | Edges: {$edgeCount}</p>
<button on:click={addNode}>Add Node</button>
</div>
<SvelteFlow {nodes} {edges} fitView />
Node Types
Built-in Node Types
<script lang="ts">
import { SvelteFlow, type Node } from '@xyflow/svelte';
import { writable } from 'svelte/store';
const nodes = writable<Node[]>([
// Input node - only has source handles
{
id: '1',
type: 'input',
data: { label: 'Input Node' },
position: { x: 0, y: 0 },
},
// Default node - has both source and target handles
{
id: '2',
type: 'default',
data: { label: 'Default Node' },
position: { x: 0, y: 100 },
},
// Output node - only has target handles
{
id: '3',
type: 'output',
data: { label: 'Output Node' },
position: { x: 0, y: 200 },
},
]);
</script>
Node Configuration
import { Position, type Node } from '@xyflow/svelte';
const node: Node = {
id: 'unique-id',
type: 'default',
position: { x: 100, y: 100 },
data: { label: 'My Node', customProp: 'value' },
// Optional properties
style: 'background-color: #f0f0f0;',
class: 'custom-node',
sourcePosition: Position.Right,
targetPosition: Position.Left,
draggable: true,
selectable: true,
connectable: true,
deletable: true,
hidden: false,
selected: false,
dragging: false,
zIndex: 0,
extent: 'parent',
parentId: 'parent-node-id',
expandParent: true,
};
Edge Types and Configuration
<script lang="ts">
import { SvelteFlow, MarkerType, type Edge } from '@xyflow/svelte';
import { writable } from 'svelte/store';
const edges = writable<Edge[]>([
// Default edge (bezier curve)
{
id: 'e1',
source: '1',
target: '2',
type: 'default',
},
// Straight line
{
id: 'e2',
source: '2',
target: '3',
type: 'straight',
},
// Step edge (right angles)
{
id: 'e3',
source: '3',
target: '4',
type: 'step',
},
// Smoothstep edge (rounded corners)
{
id: 'e4',
source: '4',
target: '5',
type: 'smoothstep',
},
// Styled edge with arrow
{
id: 'e5',
source: '5',
target: '
Установить svelteflow-fundamentals в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
BashReadFAQ
Что делает скилл svelteflow-fundamentals?
Use when building node-based UIs, flow diagrams, workflow editors, or interactive graphs with Svelte Flow. Covers setup, nodes, edges, controls, and interactivity.
Как установить скилл svelteflow-fundamentals?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл svelteflow-fundamentals запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic