--- name: diff description: Use when implementing or debugging code that uses @suaveplan/diff: Zero-dependency RFC 6902 JSON Patch engine with structural diffing, patch application/inversion, linear history manager, sync manager, and rich path utilities. --- # @suaveplan/diff Zero-dependency RFC 6902 JSON Patch engine for computing, applying, and inverting structural differences between JSON documents. The `diff(a, b)` function produces a minimal patch using index-based or LCS array strategies; `applyPatch` applies it; `revertPatch` undoes it; and `invertPatch` creates an inverse patch. A `HistoryManager` provides undo/redo with configurable depth and branch truncation on new edits. A `SyncManager` handles optimistic concurrency: apply local changes speculatively, then reconcile when the server responds. RFC 6901 JSON Pointer parsing and formatting is exposed as a standalone `path` module. Use this package for collaborative editing, undo/redo stacks, change-event streams, and any system where you need to track or transmit the delta between two object states rather than the full state itself. ## When to use this skill - Implementing or debugging code that imports `@suaveplan/diff`. - The task touches: see package README. - You need API guidance for this package's exports. ## Quick reference ```ts import { /* see API Reference below */ } from "@suaveplan/diff"; ``` ## Dependencies Workspace dependencies: _none_ ## Where to read more This skill is intentionally short. The package's own documentation is the authoritative source — read these in order: 1. **`packages/foundation/diff/README.md`** — overview, install, quick-start, module index 2. **`packages/foundation/diff/src/**/*.md`** — co-located docs per implementation file (Purpose, Features, Basic + Advanced examples, full API reference, Implementation notes — all packages ship ≥200 words per module) 3. **`packages/foundation/diff/package.json`** `exports` map — every subpath you can import from When the user asks an API question, read the relevant co-located `.md` first; do not answer from training-data memory. ## See also - The marketplace root: `../../../README.md` --- _This SKILL.md is auto-generated by `suaveplan-skills/scripts/generate-skills.ts` from the package's README. Do not edit by hand — re-run the generator after the README changes._