api-design
This skill should be used when the user needs to "design the API", do "endpoint design", pin down a "request/response shape", choose a "pagination" strategy…
This skill should be used when the user needs a "unique ID generator", "distributed IDs", a "Snowflake ID", asks "UUID vs auto-increment", wants a "time-sortable ID", a "monotonic sequence", a "ticket server", or "ID generation at scale". It gives a menu of ID schemes
$ npx -y skills add proyecto26/system-design-skills --skill sequencer --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/sequencerContext preview
The summary Claude sees to decide when to auto-load this skill.
This skill should be used when the user needs a "unique ID generator", "distributed IDs", a "Snowflake ID", asks "UUID vs auto-increment", wants a "time-sortable ID", a "monotonic sequence", a "ticket server", or "ID generation at scale". It gives a menu of ID schemes
name: sequencer description: This skill should be used when the user needs a "unique ID generator", "distributed IDs", a "Snowflake ID", asks "UUID vs auto-increment", wants a "time-sortable ID", a "monotonic sequence", a "ticket server", or "ID generation at scale". It gives a menu of ID schemes (UUID/ULID, Snowflake-style, DB ticket/range) with their causality, ordering, and clock-skew trade-offs. Use it whenever a design needs collision-free identifiers across many nodes, even if the user doesn't say "sequencer".
Hand out identifiers that are unique across every node without a central bottleneck — and decide whether those IDs must also be *sortable* or *monotonic*. Getting this wrong shows up late and hard: collisions corrupt data, a single allocator caps write throughput, and IDs that leak a creation time or a sequential count expose business secrets and enable enumeration attacks.
A system writes new records across multiple nodes and each needs a primary key (orders, messages, uploads, events). Reach for this when a single auto-increment column would serialize all writes, when IDs must be generated before a DB round trip (client-side, offline), or when records must be roughly time-ordered without a separate sort field.
A single relational node still comfortably serves the write load (→ `back-of-the-envelope`) — then a plain `BIGINT AUTO_INCREMENT`/`SERIAL` is the cheapest correct answer; do not build a distributed ID service for it (YAGNI). If a natural unique key already exists (email, ISBN, content hash), use it. Don't demand global monotonicity unless an invariant truly needs it — it is the most expensive property here and usually only *per-entity* ordering is required.
DB round trip per ID is acceptable.)
monotonic*? Per-entity or global? This is the single biggest fork.
`back-of-the-envelope`). Sets the bits needed for a sequence counter.
(no coordination ever) vs short URL-safe string?
(enumeration / competitor signal)?
single node owns the writes and you want zero new infrastructure.
zero collision risk. Use when you only need uniqueness and never sort by ID.
timestamp prefix, so IDs sort by creation time. Use when you want UUIDv4's zero-coordination *and* time-ordering (the modern default for new keys).
a node ID, and a per-ms counter into a sortable 64-bit int. Use at high write rates where a compact, k-sorted integer key matters.
*blocks* of IDs (e.g. 1000 at a time); each node serves from its block in memory. Use when you want simple monotonic-ish integers without per-ID coordination.
| Option | What it solves | What it worsens | Change it when | |---|---|---|---| | Auto-increment / sequence | Trivial, monotonic, compact int | Serializes writes; single node caps throughput; leaks count | Writes outgrow one node, or you need client-side IDs → ticket/Snowflake | | UUIDv4 (random) | Generate anywhere, no coordination, no leakage | 128-bit; random order kills index locality (page splits); not sortable | You need time-ordering → ULID/UUIDv7 | | ULID / UUIDv7 | Zero coordination + time-sortable + index-friendly | Still 128-bit; only ms-sortable (not strict); leaks creation time | You need a 64-bit key or strict order → Snowflake / sequence | | Snowflake-style (64-bit) | Compact, k-sorted, ~4M IDs/node/sec | Needs node-ID assignment + clock-skew handling; epoch/bit budget caps lifespan | Clock sync is unreliable, or you can't assign node IDs → ULID | | DB ticket / range | Monotonic-ish ints, low coordination, simple | Allocator table is a SPOF; gaps on restart; only loosely ordered across nodes | Allocator becomes a bottleneck or SPOF → Snowflake/ULID |
The whole point of distributed ID schemes is to avoid a single allocator, so the failure modes cluster around *coordination shortcuts*.
one row/node. A spike or its failure stalls all inserts. *Mitigate:* hand out larger ranges, replicate the allocator, or move to Snowflake/ULID (no central hop). Larger ranges trade away monotonicity and waste IDs on restart.
backward (NTP correction, VM pause), it can re-emit a timestamp it already used and collide within its node+sequence space. *Mitigate:* refuse to emit while `now < last_timestamp` (block or error), use a monotonic clock source, and alarm on skew. Never silently trust wall-clock time.
one node overflows the counter. *Mitigate:* spin-wait to the next ms, or size the bit budget to peak rate up front.
autoscaling reuse) and silently mint duplicates. *Mitigate:* lease node IDs from a coordinator (→ `consistency-coordination`) instead of static config.
all new writes to one shard. *Mitigate:* hash the key or prefix-shard
Design scalable systems the way strong engineers actually do — by reasoning, not by memorizing diagrams.
Repo: proyecto26/system-design-skills
This skill should be used when the user needs to "design the API", do "endpoint design", pin down a "request/response shape", choose a "pagination" strategy…
This skill should be used when a system design needs a diagram — "draw the architecture", "diagram this system", "show the components", "make an…
This skill should be used when the user needs to "estimate QPS", "back-of-the-envelope" (BOTEC) numbers, "how much storage / bandwidth", "how many servers",…
This skill should be used when the user wants a "blob store" or "object storage", names "S3" or an S3-compatible store, needs to "store images / video /…
This skill should be used when the user asks about a "caching strategy", "cache invalidation", "what to cache", "read-through vs write-through vs write-back",…
This skill should be used when the user asks about the "CAP theorem", "PACELC", a "consistency model", "eventual vs strong consistency", "read-your-writes",…