uuid-primary-keys

Implement UUID primary keys in Ruby on Rails with PostgreSQL and SQLite.

5|Updated Jan 28, 2026
One-click install
npx skills add https://github.com/ThinkOodle/rails-skills --skill uuid-primary-keys
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: uuid-primary-keys
Source: https://github.com/ThinkOodle/rails-skills/tree/main/skills/uuid-primary-keys
Command: npx skills add https://github.com/ThinkOodle/rails-skills --skill uuid-primary-keys

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides expert guidance for implementing UUID primary keys in Rails applications, ensuring secure, scalable, and URL-friendly identifiers.

Core Features & Use Cases

  • UUID Generation: Supports UUIDv7 (recommended) and UUIDv4 generation.
  • Database Support: Covers PostgreSQL native UUID types and SQLite binary storage with Base36 encoding.
  • Migration Assistance: Guides through creating tables, adding foreign keys, and configuring generators for UUIDs.
  • Use Case: When building a new Rails application or refactoring an existing one to use non-sequential, externally-friendly IDs for better security and API design.

Quick Start

Use the uuid-primary-keys skill to configure Rails generators to use UUIDs as primary keys by default.

Frequently Asked Questions about uuid-primary-keys

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

FAQPage Schema
How do I configure Rails generators to use UUID primary keys by default?

To use UUID primary keys in Rails, you must configure the application generators to output `id: :uuid` instead of integers, ensuring all new migrations default to UUIDv7 or UUIDv4 automatically.

What is the difference between using UUIDv7 and UUIDv4 for Rails database migrations?

UUIDv7 is recommended over UUIDv4 for Rails database migrations because it provides time-ordered generation, improving index locality and query performance while maintaining the same non-sequential security benefits.

Does this UUID primary key approach work with both PostgreSQL and SQLite in Rails?

Yes, the UUID primary key implementation supports both PostgreSQL native UUID types and SQLite binary storage with Base36 encoding, allowing you to maintain consistent Rails migrations across different database adapters.

How do I convert existing integer primary keys to UUIDs in a Rails application?

Converting existing integer primary keys to UUIDs in Rails requires dedicated migration strategies to update column types, foreign key constraints, and fixtures, ensuring referential integrity is preserved during the transition.

What is the best way to make UUID primary keys URL-friendly in Rails APIs?

To make UUID primary keys URL-friendly in Rails APIs, you can apply Base36 encoding to binary UUID storage, shortening the identifiers while retaining non-sequential, externally-safe characteristics for API design.