Install any skill in seconds. Free to start, no credit card required.
Get Started Free →UUID generation skill - Universally Unique Identifiers v4 and v7 for entity IDs. For ng-events construction site progress tracking system.
.claude/skills/aiskillstore-uuid/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-10 | ✗→✓ | ▲ Improved | 92% | 0% |
| case-05 | ✗→✓ | ▲ Improved | 111% | 0% |
| case-09 | ✗→✓ | ▲ Improved | 161% | 0% |
| case-14 | ✗→✓ | ▲ Improved | 108% | 0% |
| case-18 | ✗→✓ | ▲ Improved | 371% | 0% |
Trigger patterns: "UUID", "unique ID", "identifier", "v4", "v7", "uuidv4", "uuidv7"
UUID library for generating RFC9562-compliant unique identifiers in JavaScript/TypeScript applications.
Package: uuid@13.0.0 Standard: RFC9562 (formerly RFC4122)
Generates a version 4 UUID using cryptographically secure random values.
typescriptimport { 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:
Generates a version 7 UUID with Unix epoch timestamp for natural chronological sorting.
typescriptimport { 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:
Advantages:
typescriptimport { Injectable, inject } from '@angular/core'; import { Firestore, collection, doc, setDoc, getDoc } from '@angular/fire/firestore'; import { v4 as uuidv4 } from 'uuid'; export interface Task { id: string; blueprintId: string; title: string; description: string; status: 'pending' | 'in-progress' | 'completed'; createdAt: Date; updatedAt: Date; } @Injectable({ providedIn: 'root' }) export class TaskRepository { private firestore = inject(Firestore); private tasksCollection = collection(this.firestore, 'tasks'); /** * Create task with UUID v4 */ async create(task: Omit<Task, 'id' | 'createdAt' | 'updatedAt'>): Promise<Task> { const id = uuidv4(); // Generate unique ID const now = new Date(); const newTask: Task = { ...task, id, createdAt: now, updatedAt: now }; const docRef = doc(this.tasksCollection, id); await setDoc(docRef, newTask); return newTask; } /** * Get task by UUID */ async findById(id: string): Promise<Task | null> { const docRef = doc(this.tasksCollection, id); const snapshot = await getDoc(docRef); if (!snapshot.exists()) { return null; } return { id: snapshot.id, ...snapshot.data() } as Task; } }
typescriptimport { Injectable, inject } from '@angular/core'; import { Firestore, collection, doc, setDoc } from '@angular/fire/firestore'; import { v7 as uuidv7 } from 'uuid'; export interface AuditLog { id: string; // v7 UUID for chronological sorting userId: string; action: string; resource: string; resourceId: string; timestamp: Date; metadata?: Record<string, any>; } @Injectable({ providedIn: 'root' }) export class AuditLogRepository { private firestore = inject(Firestore); private logsCollection = collection(this.firestore, 'auditLogs'); /** * Create audit log with v7 UUID (sortable by time) */ async log( userId: string, action: string, resource: string, resourceId: string, metadata?: Record<string, any> ): Promise<AuditLog> { const id = uuidv7(); // Timestamp-based UUID const log: AuditLog = { id, userId, action, resource, resourceId, timestamp: new Date(), metadata }; const docRef = doc(this.logsCollection, id); await setDoc(docRef, log); return log; } }
typescriptimport { Injectable } from '@angular/core'; import { v4 as uuidv4 } from 'uuid'; export interface Session { id: string; userId: string; token: string; createdAt: Date; expiresAt: Date; } @Injectable({ providedIn: 'root' }) export class SessionService { private sessions = new Map<string, Session>(); /** * Create new session with UUID */ createSession(userId: string, expiresInMs: number = 3600000): Session { const sessionId = uuidv4(); const now = new Date(); const session: Session = { id: sessionId, userId, token: this.generateToken(), createdAt: now, expiresAt: new Date(now.getTime() + expiresInMs) }; this.sessions.set(sessionId, session); return session; } /** * Get session by ID */ getSession(sessionId: string): Session | null { return this.sessions.get(sessionId) || null; } private generateToken(): string { return uuidv4(); // Use UUID as token } }
typescriptimport { Injectable, signal } from '@angular/core'; import { v4 as uuidv4 } from 'uuid'; export interface FileUpload { id: string; fileName: string; fileSize: number; uploadedBy: string; uploadedAt: Date; status: 'pending' | 'uploading' | 'completed' | 'failed'; progress: number; url?: string; } @Injectable({ providedIn: 'root' }) export class FileUploadService { private uploads = signal<Map<string, FileUpload>>(new Map()); /** * Start file upload with UUID tracking */ startUpload(file: File, userId: string): string { const uploadId = uuidv4(); const upload: FileUpload = { id: uploadId, fileName: file.name, fileSize: file.size, uploadedBy: userId, uploadedAt: new Date(), status: 'pending', progress: 0 }; this.uploads.update(map => { map.set(uploadId, upload); return new Map(map); }); return uploadId; } /** * Update upload progress */ updateProgress(uploadId: string, progress: number): void { this.uploads.update(map => { const upload = map.get(uploadId); if (upload) { upload.progress = progress; upload.status = progress === 100 ? 'completed' : 'uploading'; map.set(uploadId, upload); } return new Map(map); }); } /** * Get upload by ID */ getUpload(uploadId: string): FileUpload | undefined { return this.uploads().get(uploadId); } }
✅ DO: Choose based on use case
typescript// General entity IDs - use v4 const taskId = uuidv4(); const userId = uuidv4(); // Time-series or sortable IDs - use v7 const logId = uuidv7(); const eventId = uuidv7();
✅ DO: Define UUID brand types for safety
typescripttype UUID = string & { readonly __brand: unique symbol }; interface Task { id: UUID; title: string; } function createTaskId(): UUID { return uuidv4() as UUID; }
✅ DO: Validate UUID format
typescriptimport { validate as uuidValidate, version as uuidVersion } from 'uuid'; function isValidUUID(id: string): boolean { return uuidValidate(id); } function isV4UUID(id: string): boolean { return uuidValidate(id) && uuidVersion(id) === 4; } function isV7UUID(id: string): boolean { return uuidValidate(id) && uuidVersion(id) === 7; }
✅ DO: Store as string in Firestore
typescript// Firestore automatically indexes string IDs await setDoc(doc(collection, taskId), { /* data */ });
❌ DON'T: Convert to binary in Firestore
typescript// Unnecessary complexity in Firestore const binaryId = Buffer.from(taskId.replace(/-/g, ''), 'hex');
bash# Generate v4 UUID $ npx uuid ddeb27fb-d9a0-4624-be4d-4615062daed4 # Generate v7 UUID $ npx uuid v7 019a26ab-9a66-71a9-a89e-63c35fce4a5a # Generate multiple UUIDs $ npx uuid && npx uuid && npx uuid
❌ Using Sequential IDs in Distributed Systems:
typescriptlet counter = 0; const id = `task-${++counter}`; // Race conditions, not globally unique
✅ Use UUID:
typescriptconst id = uuidv4(); // Globally unique, no coordination needed
❌ Parsing UUID Parts Manually:
typescriptconst timestamp = parseInt(uuid.substring(0, 8), 16); // Fragile
✅ Use Library Functions:
typescriptimport { parse, version } from 'uuid'; const ver = version(uuid); // Proper parsing
❌ Generating UUIDs Client-Side for Security-Critical Operations:
typescriptconst sessionToken = uuidv4(); // Predictable if not properly seeded
✅ Generate Security Tokens Server-Side:
typescript// Firebase Auth handles token generation securely const token = await auth.currentUser.getIdToken();
Version: 1.0 Created: 2025-12-25 Maintainer: ng-events(GigHub) Development Team
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-11 | pass→pass | 11,642 | 6,903 | -41% | 1 | 1 | 0% | 2,168 | 4,515 | +108% | 0 | 0 | — |
case-10 | fail→pass | 11,890 | 8,211 | -31% | 1 | 1 | 0% | 2,286 | 4,388 | +92% | 0 | 0 | — |
case-01 | pass→pass | 15,557 | 10,779 | -31% | 1 | 1 | 0% | 2,593 | 4,989 | +92% | 0 | 0 | — |
case-02 | fail→fail | 17,304 | 12,684 | -27% | 1 | 1 | 0% | 2,626 | 5,104 | +94% | 0 | 0 | — |
case-03 | pass→pass | 14,701 | 8,083 | -45% | 1 | 1 | 0% | 2,446 | 4,469 | +83% | 0 | 0 | — |
case-04 | pass→pass | 8,544 | 6,446 | -25% | 1 | 1 | 0% | 1,405 | 4,302 | +206% | 0 | 0 | — |
case-05 | fail→pass | 9,509 | 2,888 | -70% | 1 | 1 | 0% | 1,654 | 3,496 | +111% | 0 | 0 | — |
case-06 | fail→fail | 11,608 | 7,878 | -32% | 1 | 1 | 0% | 1,897 | 4,448 | +134% | 0 | 0 | — |
case-07 | pass→pass | 3,955 | 4,258 | +8% | 1 | 1 | 0% | 630 | 3,831 | +508% | 0 | 0 | — |
case-08 | pass→pass | 12,614 | 11,519 | -9% | 1 | 1 | 0% | 2,138 | 4,868 | +128% | 0 | 0 | — |
case-09 | fail→pass | 9,619 | 8,675 | -10% | 1 | 1 | 0% | 1,771 | 4,624 | +161% | 0 | 0 | — |
case-12 | pass→pass | 15,384 | 9,330 | -39% | 1 | 1 | 0% | 2,301 | 4,707 | +105% | 0 | 0 | — |
case-13 | pass→pass | 5,461 | 3,191 | -42% | 1 | 1 | 0% | 921 | 3,641 | +295% | 0 | 0 | — |
case-14 | fail→pass | 12,670 | 9,743 | -23% | 1 | 1 | 0% | 2,071 | 4,309 | +108% | 0 | 0 | — |
case-15 | pass→pass | 14,244 | 9,281 | -35% | 1 | 1 | 0% | 2,415 | 4,798 | +99% | 0 | 0 | — |
case-16 | pass→pass | 6,217 | 1,437 | -77% | 1 | 1 | 0% | 832 | 3,281 | +294% | 0 | 0 | — |
case-17 | fail→fail | 14,581 | 12,443 | -15% | 1 | 1 | 0% | 2,354 | 5,092 | +116% | 0 | 0 | — |
case-18 | fail→pass | 5,005 | 8,329 | +66% | 1 | 1 | 0% | 835 | 3,934 | +371% | 0 | 0 | — |
case-19 | pass→pass | 12,562 | 6,369 | -49% | 1 | 1 | 0% | 1,983 | 4,194 | +111% | 0 | 0 | — |
case-20 | pass→pass | 6,157 | 4,877 | -21% | 1 | 1 | 0% | 1,023 | 3,899 | +281% | 0 | 0 | — |
case-21 | fail→pass | 14,863 | 6,061 | -59% | 1 | 1 | 0% | 2,507 | 4,148 | +65% | 0 | 0 | — |
case-22 | pass→pass | 11,502 | 12,289 | +7% | 1 | 1 | 0% | 2,125 | 5,249 | +147% | 0 | 0 | — |
case-23 | pass→pass | 14,108 | 16,982 | +20% | 1 | 1 | 0% | 2,424 | 4,950 | +104% | 0 | 0 | — |
case-24 | pass→pass | 13,796 | 13,186 | -4% | 1 | 1 | 0% | 2,341 | 5,419 | +131% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 24 cases were attempted. The headline lift of +25 percentage points is the difference between those two pass rates over the 24 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.