Към всички skills

uuid

aiskillstore · Инструменти

UUID generation skill - Universally Unique Identifiers v4 and v7 for entity IDs. For ng-events construction site progress tracking system.

Оригинален текст · няма потвърден превод на български

Първо прочетете инструкцията.

Файлът се зарежда от посочения източник само по ваше действие. Можете да го прочетете тук, да го копирате или да го запазите като .md.

Оригинален SKILL.md
GitHub хранилище
Звезди на репото
428
Лиценз
Не е посочен. Проверете в репозитория.
Последна проверка на записа
Няма посочена дата

Добавете в своя инструмент.

Командата отваря избора на skills от репозитория. Прочетете файла и условията на автора преди изпълнение.

npx skills add aiskillstore/marketplace

Страницата копира текст. Не инсталира и не изпълнява нищо на устройството ви.

Откъс от SKILL.md

Началото на файла на автора, без превод.

UUID - Universally Unique Identifiers

Trigger patterns: "UUID", "unique ID", "identifier", "v4", "v7", "uuidv4", "uuidv7"

Overview

UUID library for generating RFC9562-compliant unique identifiers in JavaScript/TypeScript applications.

Package: uuid@13.0.0
Standard: RFC9562 (formerly RFC4122)

Core Functions

1. v4() - Random UUID (Most Common)

Generates a version 4 UUID using cryptographically secure random values.

import { v4 as uuidv4 } from 'uuid';

// Generate random UUID
const taskId = uuidv4();
// '9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d'

// Use in entity creation
interface Task {
  id: string;
  title: string;
  createdAt: Date;
}

function createTask(title: string): Task {
  return {
    id: uuidv4(),
    title,
    createdAt: new Date()
  };
}

When to use:

  • Entity IDs (tasks, users, blueprints)
  • Session IDs
  • Request tracking IDs
  • File upload IDs
  • Any unique identifier needs

2. v7() - Timestamp-based UUID (Sortable)

Generates a version 7 UUID with Unix epoch timestamp for natural chronological sorting.

import { v7 as uuidv7 } from 'uuid';

// Generate timestamp-based UUID
const orderId = uuidv7();
// '019a26ab-9a66-71a9-a89e-63c35fce4a5a'

// Multiple UUIDs are naturally sortable
const ids = Array.from({ length: 5 }, () => uuidv7());
// All IDs will be in chronological order

// Use for database primary keys
interface Order {
  id: string; // v7 UUID - sortable by creation time
  customerId: string;
  createdAt: Date;
}

When to use:

  • Database primary keys requiring chronological sorting
  • Event IDs in time-series data
  • Log entry IDs
  • Audit trail records
  • Any scenario where temporal ordering matters

Advantages:

  • Natural sort order by creation time
  • Better database index performance
  • Reduced fragmentation in B-tree indexes
  • Compatible with UUID v4 in storage/APIs

Real-World Examples

Task Repository with UUID

Целият SKILL.md в GitHub