본문으로 건너뛰기
Skillpedia
웹사이트 및 UI (프런트엔드)75k · #3084

web-storage

하는 일

이 스킬은 웹페이지가 브라우저 저장 공간을 어떻게 쓰는지 확인하고, 그 코드를 오류에 안전하게 만듭니다. 앱이 브라우저에 데이터를 저장하는 개발자를 위한 스킬입니다.

사용하는 경우

  • ✓오류 처리 없이 localStorage를 읽거나 쓰는 코드가 있을 때.
  • ✓객체를 저장한 뒤 다시 읽을 때 검사하지 않는 앱이 있을 때.
  • ✓로그인 토큰 같은 민감한 데이터가 브라우저의 localStorage에 보관되어 있을 때.

스킬 링크

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

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

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.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“개인 정보 보호 모드에서 설정을 저장하면 앱이 충돌합니다. 저장 코드를 안전하게 만들어 주실 수 있나요?”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

에이전트는 저장 공간의 읽기와 쓰기를 오류 처리로 감싸고, 읽어 들일 때 직렬화된 데이터를 검사합니다. 또한 브라우저 저장소에 보관하면 안 되는 민감한 데이터를 표시합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 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

자주 묻는 질문

저장 공간 때문에 왜 충돌이 나나요?

저장 공간에는 크기 제한이 있고, 일부 개인 정보 보호 모드에서는 꺼져 있어서 앱이 처리해야 할 오류가 발생할 수 있습니다.

sessionStorage가 더 나은 경우는 언제인가요?

스킬은 한 브라우저 탭에서만 유지되어야 하는 데이터에 sessionStorage를 제안합니다.

localStorage에 넣으면 안 되는 것은 무엇인가요?

토큰과 비밀번호입니다. 스킬은 이런 데이터에는 대신 httpOnly 쿠키를 사용하라고 말합니다.

상세 정보

작성자의 원본 설명

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

인기도

GitHub 스타
75k
순위
#3084
라이선스
MIT
업데이트
2026. 10. 31.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬