Skip to content
Back to skills

Svelte Store

ASecurity

Create and consume Svelte stores for shared cross-component state

  • 3 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 3, 2026
ai-agentsgoreact

Security analysis

A100/100

Scanned September 3, 2026

npx -y skills add black141312/ada --skill svelte-store --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Svelte Store?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Svelte Store
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/black141312-svelte-store/badge)](https://www.skillsdirectory.com/skills/black141312-svelte-store)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: svelte-store
description: Create and consume Svelte stores for shared cross-component state
category: frameworks
---

# Svelte Store

Use when state must be shared across components or live outside the component tree — reach for a store instead of prop-drilling.

1. Create a module (e.g. `src/lib/stores.js`) and export a `writable(initial)` for mutable state or `readable` for external/read-only sources.
2. For derived state, use `derived(source, ($source) => ...)` so it recomputes automatically.
3. In components, subscribe with the `$store` auto-subscription in markup and script — Svelte handles unsubscribe.
4. Update state via `store.set(value)` or `store.update(prev => next)`; for `$store = x` shorthand, ensure you're in a component.
5. For encapsulated logic, wrap the store in a factory returning `{ subscribe, ...customMethods }` (the custom-store pattern).
6. Verify reactivity across components and that no manual subscription leaks (prefer `$` over `.subscribe` in components).

## Rules
- Use the `$` prefix in components to auto-subscribe and auto-unsubscribe; only call `.subscribe()` manually outside components, and always clean it up.
- `readable` needs a stop/cleanup function returned from its start callback for timers/listeners.
- Don't put non-serializable or per-request state in a module-level store in SSR contexts — it's shared across requests.
- Keep store mutation logic in the store module (custom stores), not scattered across components.
- `derived` is read-only; never try to `set` a derived store.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.