yjs-best-practices

Diagnose and fix Yjs import issues and encoding configuration in JavaScript/TypeScript projects.

Updated Apr 7, 2026
One-click install
npx skills add https://github.com/rally19/goform --skill yjs-best-practices
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: yjs-best-practices
Source: https://github.com/rally19/goform/tree/main/.qwen/skills/yjs-best-practices
Command: npx skills add https://github.com/rally19/goform --skill yjs-best-practices

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Diagnose and fix common Yjs issues in applications, including duplicate imports, subdocuments, and encoding configuration.

Core Features & Use Cases

  • Avoid importing Yjs twice by consolidating to a single Yjs instance across the app and resolving version conflicts with bundler aliases.
  • Prefer YMap over subdocuments for typical collaboration data unless a subdocument is truly needed.
  • Use YKeyValue for efficient key-value storage to minimize document growth and improve performance.
  • Enable experimental V2 encoding for Y.Maps to improve efficiency and compatibility.

Quick Start

Audit your codebase for duplicate Yjs imports and implement a single Yjs instance with consolidated usage of YMap or YKeyValue

Frequently Asked Questions about yjs-best-practices

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

FAQPage Schema
How do I fix duplicate Yjs imports causing real-time collaboration errors?

To resolve duplicate Yjs imports, consolidate your application to use a single Yjs instance and apply bundler aliasing to enforce one version across your entire project, preventing state synchronization conflicts.

When should I use YKeyValue instead of subdocuments in Yjs?

Use YKeyValue for typical collaboration data instead of subdocuments to minimize document growth and improve performance. Only utilize subdocuments when your specific use case truly requires isolated, nested document structures.

How do I enable experimental V2 encoding for Y.Map in JavaScript?

You can enable experimental V2 encoding for Y.Map in your JavaScript or TypeScript project to improve data efficiency and compatibility, applying configuration guidance to optimize how your real-time shared data is structured.

Does this Yjs best practices guidance apply to projects using multiple editors?

Yes, this guidance is applicable to projects using Yjs across multiple editors, providing configuration directions to ensure a single Yjs instance handles shared data correctly without version conflicts.

What is the best way to prevent Yjs document growth in collaborative applications?

The best way to prevent excessive Yjs document growth is to use YKeyValue for efficient key-value storage and prefer YMap over subdocuments for typical collaboration data, optimizing overall real-time performance.