sdxc-uuid

Validates, asserts, and generates UUIDs behind a branded UUID type in TypeScript.

5|Updated Feb 2, 2026
One-click install
npx skills add https://github.com/sergiodxa/monorepo --skill sdxc-uuid-sergiodxa
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: sdxc-uuid
Source: https://github.com/sergiodxa/monorepo/tree/main/.agents/skills/sdxc-uuid
Command: npx skills add https://github.com/sergiodxa/monorepo --skill sdxc-uuid-sergiodxa

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Identifiers arrive at request boundaries as plain strings, forcing every downstream layer to re-validate them because the type carries no proof of the check. This Skill documents the @sdxc/uuid package, which validates once and returns a branded UUID type so checked identifiers cannot be confused with raw strings. ## Core Features & Use Cases - Type-narrowing validation: isUUID narrows a string to UUID for branching, while assertUUID throws on invalid input for boundary checks. - Typed generation: generateUUID wraps crypto.randomUUID() and returns a typed UUID without a cast. - Distinct error classes: InvalidUUIDTypeError, InvalidUUIDLengthError, and InvalidUUIDFormatError distinguish wrong types, truncated values, and malformed shapes. - Use Case: A Remix route receives an account ID as a path segment; call assertUUID at the boundary, then type every function below as accepting UUID so no layer re-validates. ## Quick Start Add @sdxc/uuid as a workspace dependency and use isUUID or assertUUID to validate an incoming string identifier at the request boundary.

Frequently Asked Questions about sdxc-uuid

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I validate a UUID string in TypeScript?▼

Use isUUID from @sdxc/uuid to check a string and narrow its type to UUID in the true branch. For boundaries where invalid input should stop the request, call assertUUID, which throws a typed error instead of returning a boolean.

How to generate a typed UUID without casting?▼

Call generateUUID from @sdxc/uuid, which wraps crypto.randomUUID() and returns the branded UUID type directly. This avoids writing an unsafe cast from string to your identifier type.

Does @sdxc/uuid work on Cloudflare Workers and Bun?▼

Yes, the package has no dependencies and runs on any runtime that provides crypto.randomUUID(), which includes Cloudflare Workers, Bun, and modern Node.js. No platform-specific setup is required.

Why does UUID validation reject uppercase or braced identifiers?▼

Only lowercase 8-4-4-4-12 hexadecimal passes the format check, so uppercase and brace-wrapped forms fail. This ensures stored and compared identifiers have exactly one spelling, preventing mismatches from equivalent representations.

What is the difference between isUUID and assertUUID?▼

isUUID returns a boolean and narrows the type, suiting values a person can get wrong like form fields. assertUUID throws InvalidUUIDTypeError, InvalidUUIDLengthError, or InvalidUUIDFormatError, suiting boundaries where invalid input should halt processing.