Individual skill
yjs-nextjs
Corrects the wrong defaults a capable model has when building Yjs collaborative editing into a Next.js 16 App Router app with tRPC v11 and shadcn/ui — pinned to Yjs 13.6.31. Covers the decisions whose failure mode is silence rather than an error — plain objects in a Y.Map discarding concurrent edits, updates that vanish because a JSON boundary turned a Uint8Array into a number array, undo that reverts a colleague's paragraph, initial content seeded once per client, and carets thrown to the end of a shadcn Input on every remote keystroke. Also covers where the sync loop can actually run, since route handlers cannot upgrade, Vercel Functions have no instance affinity, and tRPC subscriptions are one-way — plus which packages have already moved to the Yjs 14 prerelease track. Use when writing, reviewing, or debugging collaborative editing, presence, offline sync, or CRDT persistence in this stack.
skills/.experimental/yjs-nextjs/SKILL.md
Source commit cf93c57cac89d6fc3e4194686000411567f5caf3
What was checked
- Matches the observed repository HEAD
- Yes
- Scanner rules are current
- Yes
- Repository scan complete
- No
- Skill scan complete
- No
- Observed behavior
- Network or broad shell
- Last checked
- Nov 5, 2026
These are observations at the recorded commit, not a guarantee of safety. Review the source before running it.
Install this skill
Choose an agent in your Stack or copy a command below. Commands fetch the pinned commit and copy only this skill directory. Existing destinations are refused. Copying a command does not install anything.
An install command is unavailable: current rules, complete repository and skill scans, an eligible behavior level and a permitted license are required.
Repository context
- Repository stars (not skill ratings)
- 221
- Repository last updated
- Aug 15, 2026
- License
- MIT
Observed agent integration: codex
- writing Derived category
- design Derived category
- testing Derived category
- engineering Derived category
- design-interface Derived category
- engineering-web Derived category
Files and excerpt
File metadata and permitted, redacted excerpts come from the recorded scan. Source links are pinned to that commit.
Browse files
AGENTS.mddoc · 7,135 bytesSKILL.mdcore · 10,611 bytesSKILL.mdcore · 10,611 bytesassets/templates/_template.mddoc · 1,484 bytesmetadata.jsonasset · 2,987 bytesreferences/_sections.mddoc · 2,442 bytesreferences/hist-scope-undo-by-origin.mddoc · 2,674 bytesreferences/hist-snapshots-require-gc-disabled.mddoc · 2,290 bytesreferences/hist-wait-for-indexeddb-sync.mddoc · 2,138 bytesreferences/host-authorize-rooms-not-updates.mddoc · 3,053 bytesreferences/host-pin-the-yjs-13-track.mddoc · 1,593 bytesreferences/host-route-handlers-cannot-upgrade.mddoc · 2,582 bytesreferences/host-trpc-is-not-the-sync-channel.mddoc · 2,937 bytesreferences/host-vercel-lacks-instance-affinity.mddoc · 2,678 bytesreferences/host-websocket-server-is-not-production.mddoc · 3,042 bytesreferences/model-nested-types-not-plain-objects.mddoc · 2,091 bytesreferences/model-seed-the-document-once.mddoc · 2,144 bytesreferences/model-yarray-has-no-move.mddoc · 2,041 bytesreferences/model-ytext-only-for-prose.mddoc · 1,866 bytesreferences/pres-awareness-is-ephemeral.mddoc · 3,136 bytesreferences/pres-relative-positions-for-cursors.mddoc · 2,309 bytesreferences/react-keep-yjs-client-only.mddoc · 2,186 bytesreferences/react-stable-doc-and-provider.mddoc · 2,317 bytesreferences/react-subscribe-via-usesyncexternalstore.mddoc · 2,958 bytesreferences/ui-do-not-drive-inputs-from-the-doc.mddoc · 2,797 bytesreferences/ui-tiptap-collaboration-wiring.mddoc · 2,888 bytesreferences/wire-base64-not-superjson.mddoc · 2,307 bytesreferences/wire-compaction-needs-a-doc-roundtrip.mddoc · 2,075 bytesreferences/wire-rehydrate-to-uint8array.mddoc · 1,660 bytesreferences/wire-send-updates-not-state.mddoc · 1,632 bytes
Read excerpt
# Yjs in Next.js 16, tRPC, and shadcn/ui
Yjs 13.6.31 in an App Router codebase — the decisions collaborative editing forces and how to settle them, written so an agent applies them while writing or reviewing code. Each rule names the wrong default it corrects; there is no rule for things the model already gets right.
Most of these failures are silent. Yjs converges, the editor keeps working, and the data loss surfaces later as "my change reverted" — so the rules below lead with the evidence of the failure, most of it measured directly against Yjs 13.6.31 rather than asserted.
## When to Apply
- Building collaborative editing, presence, or offline sync into a Next.js 16 App Router app
- Choosing shared types for a document model, or reviewing one that loses edits under concurrency
- Deciding where the sync backend runs, or wiring tRPC procedures alongside a Yjs provider
- Persisting `Y.Doc` state to a database, or compacting stored updates
- Binding a Yjs document to React — provider lifecycle, subscriptions, Strict Mode, SSR
- Wiring Tiptap or shadcn/ui form controls to a live document