fec-browser-storage

Implement client-side storage strategies across localStorage, sessionStorage, IndexedDB, and cookies.

21|3|Updated Mar 17, 2026
One-click install
npx skills add https://github.com/bovinphang/frontend-craft --skill fec-browser-storage
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: fec-browser-storage
Source: https://github.com/bovinphang/frontend-craft/tree/main/localized/zh-CN/skills/fec-browser-storage
Command: npx skills add https://github.com/bovinphang/frontend-craft --skill fec-browser-storage

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

根据数据大小、安全要求和生命周期选择合适的客户端存储方案。

Core Features & Use Cases

  • 提供 localStorage、sessionStorage、IndexedDB、Cookie 等客户端存储方案的比较与选型指南,帮助在不同场景中选择最合适的存储机制。
  • 封装本地存储操作:统一 key 前缀、JSON 序列化/反序列化、异常处理、过期清理和容量兜底,确保数据安全与可维护性。
  • 典型用例包括用户偏好、跨标签数据、离线缓存和认证态数据的安全存储策略,以及跨浏览器兼容性和隐私保护。
  • 详细参考见 references/storage-patterns.md。

Quick Start

在实际场景中选择并实现合适的客户端存储策略,以便统一 key 命名、数据过期与清理。

Frequently Asked Questions about fec-browser-storage

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

FAQPage Schema
How do I choose the right client-side storage solution between localStorage, IndexedDB, and cookies?

The best way to implement client-side storage is enforcing uniform key prefixes, JSON serialization, expiration cleanup, and capacity fallbacks. This ensures data security and maintainability across localStorage, sessionStorage, IndexedDB, and cookies.

When should I use IndexedDB instead of localStorage for web storage?

Use IndexedDB instead of localStorage when handling large offline caches or complex data structures. IndexedDB provides asynchronous, high-capacity storage, while localStorage suits smaller user preferences requiring synchronous access and simple JSON serialization.

How do I prevent data leakage when storing authentication tokens in browser storage?

Prevent data leakage in browser storage by applying security considerations tailored to authentication state. Use cookies with appropriate flags for sensitive tokens and enforce strict cleanup rules to avoid persistent exposure across sessions.

What are the limitations of relying on localStorage for cross-browser compatibility?

Limitations of localStorage include synchronous blocking, strict capacity limits, and lack of cross-tab isolation. For robust cross-browser compatibility and larger offline data, transition to IndexedDB and implement capacity fallbacks to handle quota exceeded errors.