Skip to content
Skillpedia
Websites & UI (frontend)75k · #3084

web-storage

What it does

This skill checks how a web page uses browser storage and makes that code safe from errors. It is for developers whose apps save data in the browser.

When to use it

  • ✓When code reads or writes localStorage without error handling.
  • ✓When an app saves objects to storage without checking them when it reads them back.
  • ✓When sensitive data such as login tokens is kept in the browser's local storage.

Skill link

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/web-storage/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/web-storage/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute →

Example of what to ask your AI

“My app crashes in private browsing when it saves settings. Can you make the storage code safe?”

5 new skills a week. 1 minute to read.

How it works

The agent wraps storage reads and writes in error handling and checks serialized data when loading it. It also flags sensitive data that should not be kept in browser storage.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

Use Web Storage API safely

localStorage and sessionStorage have a 5–10 MB quota per origin, and any write can throw a QuotaExceededError. Private browsing modes in some browsers disable storage entirely and throw on all writes. Applications that don't handle these errors crash silently, leaving users unable to use the app.

Quick Reference

  • Always wrap localStorage access in try/catch — storage can be full or disabled
  • Serialize objects with JSON.stringify and validate on read with JSON.parse
  • Never store sensitive data (tokens, passwords) in localStorage — use httpOnly cookies
  • Use sessionStorage for tab-scoped data that shouldn't persist

Check

Find all localStorage and sessionStorage accesses in this file. Check for missing try/catch, unhandled JSON parsing, and any storage of sensitive data.

Fix

Add try/catch error handling to all Web Storage operations and ensure all object values are properly serialized and deserialized.

Explain

Explain the Web Storage API, its limitations, when to use localStorage vs sessionStorage, and what data should never be stored there.

Code Review

Review scripts, client components, and browser execution paths related to Use Web Storage API safely. Flag exact imports, event handlers, runtime side effects, or blocking operations that violate the rule, and state how the change should be verified in the browser.


For full implementation details, code examples, and framework-specific guidance, see references/rule.md.

Rule page: https://frontendchecklist.io/rules/javascript/web-storage

FAQ

Why does storage cause crashes?

Storage has a size limit, and some private browsing modes turn it off, so writes can throw errors the app must handle.

When is sessionStorage a better choice?

The skill suggests sessionStorage for data that should last only for one browser tab.

What should never go in localStorage?

Tokens and passwords. The skill says to use httpOnly cookies for those instead.

Details

Original description by the author

Use when reviewing scripts, client components, bundles, or runtime behavior related to Use Web Storage API safely. Inspect both source code and the browser execution path so fixes target the real bottleneck or bug.

repo: thedaviddias/Front-End-Checklist

Popularity

GitHub stars
75k
Ranking position
#3084
License
MIT
Updated
10/31/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills