What problem does it solve?
This skill addresses the critical problem of unreliable client-side data persistence, preventing user data loss (notes, progress) due to browser limitations, errors like QuotaExceededError, or private browsing modes. It ensures a resilient and user-friendly experience even when storage fails.
Core Features & Use Cases
- Robust Error Handling: Implement
try/catch for all localStorage operations, gracefully handling QuotaExceededError, SecurityError, and DOMException.
- Quota Management: Strategically manage browser storage limits (5-10MB) and enforce per-note size limits (50KB), with proactive warnings and data cleanup.
- Schema Versioning & Migration: Design flexible JSON schemas for stored data, including versioning and migration strategies to ensure data integrity across updates.
- Use Case: Automatically save user notes and learning progress for 227 educational modules, providing clear feedback on save status and offering fallback options if storage is full or blocked.
Quick Start
Use the localStorage-patterns skill to refactor the CNotesView component, adding robust error handling and auto-save with a 1-second debounce.