engremran07/gsmvault/alp-store-persistence

Claude Code and agent skill by engremran07/gsmvault

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Store persistence with localStorage. Use when: persisting user preferences, theme, sidebar state, remembering UI choices across page loads.

Install

npx vskill@latest install engremran07/gsmvault/alp-store-persistence

SKILL.md

The same SKILL.md was published earlier as engremran07/gsmvault/alp-store-persistence.

Alpine Store Persistence

When to Use

  • Persisting theme preference (dark, light, contrast) across reloads
  • Remembering sidebar open/closed state
  • Saving user UI preferences without a backend round-trip

Patterns

Theme Store with localStorage
html
<script>
document.addEventListener('alpine:init', () => {
Alpine.store('theme', {
current: localStorage.getItem('theme') || 'dark',
set(value) {
this.current = value;
localStorage.setItem('theme', value);
document.documentElement.setAttribute('data-theme', value);
}
});
document.documentElement.setAttribute('data-theme', Alpine.store('theme').current);
});
</script>
Generic Persisted Store Helper
html
<script>
function persistedStore(key, defaults) {
let saved = {};
try { saved = JSON.parse(localStorage.getItem(key) || '{}'); } catch {}
const store = { ...defaults, ...saved };
store._persist = function () {
const data = {};
for (const k of Object.keys(defaults)) {
if (typeof this[k] !== 'function') data[k] = this[k];
}
localStorage.setItem(key, JSON.stringify(data));
};
return store;
}
document.addEventListener('alpine:init', () => {
Alpine.store('prefs', persistedStore('userPrefs', {
sidebarOpen: true,
compactView: false,
toggle(key) { this[key] = !this[key]; this._persist(); }
}));
});
</script>
Reading Persisted Store in a Component
html
<aside x-data x-show="$store.prefs.sidebarOpen" x-cloak
x-transition:enter="transition ease-out duration-200"
x-transition:leave="transition ease-in duration-150">
<!-- sidebar content -->
</aside>

Anti-Patterns

PatternProblemFix
localStorage.getItem() without try/catchThrows in private browsing / quota exceededAlways wrap in try/catch
Persisting every keystrokePerformance thrashDebounce or persist on specific actions only
Storing sensitive data in localStorageXSS can read itNever store tokens/passwords — use httpOnly cookies
Relying solely on localStorage for auth stateStale after logoutAuth state from server, UI prefs from localStorage

Red Flags

  • Missing fallback when localStorage is unavailable (private mode, disabled)
  • Theme flicker on load — data-theme must be set synchronously before paint
  • Storing user PII or credentials in localStorage

Quality Gate

powershell
& .\.venv\Scripts\python.exe -m ruff check . --fix
& .\.venv\Scripts\python.exe -m ruff format .
& .\.venv\Scripts\python.exe manage.py check --settings=app.settings_dev

Security

  • Security scanPassed, 95 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
5

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/engremran07/gsmvault/alp-store-persistence/badge)](https://verified-skill.com/skills/engremran07/gsmvault/alp-store-persistence)

Something wrong with this skill or its page? Tell us.