Skip to content
Back to skills

Dnd Patterns

ASecurity

Drag and drop implementation using DND Kit for reordering tune versions.

  • 666 stars
  • 0 votes
  • 0 copies
  • 4 views
  • Added February 8, 2026
developmentjavascriptjavanodedatabase

Security analysis

A100/100

Scanned February 12, 2026

npx -y skills add majiayu000/claude-skill-registry --skill dnd-patterns --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Dnd Patterns?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Dnd Patterns
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/majiayu000-dnd-patterns/badge)](https://www.skillsdirectory.com/skills/majiayu000-dnd-patterns)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
# DND Patterns Skill

## Purpose
Drag and drop implementation using DND Kit for reordering tune versions.

## Basic Setup
```javascript
import { DndContext, closestCenter } from '@dnd-kit/core';
import { SortableContext, verticalListSortingStrategy, useSortable } from '@dnd-kit/sortable';
import { CSS } from '@dnd-kit/utilities';

function SortableItem({ id, children }) {
  const { attributes, listeners, setNodeRef, transform, transition } = useSortable({ id });

  const style = {
    transform: CSS.Transform.toString(transform),
    transition
  };

  return (
    <div ref={setNodeRef} style={style} {...attributes} {...listeners}>
      {children}
    </div>
  );
}

function SortableList({ items, onReorder }) {
  const handleDragEnd = (event) => {
    const { active, over } = event;
    if (active.id !== over.id) {
      const oldIndex = items.findIndex(i => i.id === active.id);
      const newIndex = items.findIndex(i => i.id === over.id);
      onReorder(oldIndex, newIndex);
    }
  };

  return (
    <DndContext collisionDetection={closestCenter} onDragEnd={handleDragEnd}>
      <SortableContext items={items} strategy={verticalListSortingStrategy}>
        {items.map(item => (
          <SortableItem key={item.id} id={item.id}>
            {item.content}
          </SortableItem>
        ))}
      </SortableContext>
    </DndContext>
  );
}
```

## Best Practices
✅ Use unique IDs for items
✅ Provide visual feedback during drag
✅ Persist reordering to database
❌ Don't forget collision detection
❌ Don't mutate state directly

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.