agentleFS
violacaseviolacase/Nuxt4-test/.claude/skills/new-settings-store/SKILL.md

new-settings-store

Skill0 starsChanged 8 months agoMITView on GitHub

Scaffold a Pinia store that persists to localStorage using VueUse useLocalStorage. Use when the user asks to store user preferences, UI settings, theme, layout, or any setting that should survive page reload.

The file

We split this skill into the rules it gives an agent

9 rules. About 0 are common, 2 are distinctive, and 7 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 7

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Always use useLocalStorage from @vueuse/core — never localStorage.setItem directly

    line 9
  2. Very specific:

    Always provide sensible defaults as the second argument to useLocalStorage

    line 11
  3. Very specific:

    Always include a reset() action that restores all defaults

    line 12
  4. Very specific:

    If adding to the existing stores/settings.ts, extend it — don't create a duplicate

    line 14
  5. Distinctive:

    When asked to add a setting:

    line 53
  6. Very specific:

    Add to the store and to the reset() function

    line 57
  7. Very specific:

    Add the corresponding i18n label to /locales/en.json if it's user-facing

    line 58
  8. Distinctive:

    Ask: what setting needs to be persisted?

    line 71
  9. Very specific:

    Always include the key in reset()

    line 74

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Skill: New Settings Store

Rules

  • Always use useLocalStorage from @vueuse/core — never localStorage.setItem directly
  • Keys MUST be namespaced: settings:[key] — e.g. settings:theme
  • Always provide sensible defaults as the second argument to useLocalStorage
  • Always include a reset() action that restores all defaults
  • Store is SSR-safe — useLocalStorage handles hydration automatically in Nuxt
  • If adding to the existing stores/settings.ts, extend it — don't create a duplicate

Base Settings Store

// stores/settings.ts
import { defineStore } from 'pinia'
import { useLocalStorage } from '@vueuse/core'

export const useSettingsStore = defineStore('settings', () => {
  // ─── Persisted Settings ───────────────────────────────────
  const theme = useLocalStorage<'light' | 'dark'>('settings:theme', 'light')
  const locale = useLocalStorage<string>('settings:locale', 'en')
  const layout = useLocalStorage<'compact' | 'comfortable'>('settings:layout', 'comfortable')
  const sidebarOpen = useLocalStorage<boolean>('settings:sidebarOpen', true)

  // Add new settings following the same pattern:
  // const mySetting = useLocalStorage<Type>('settings:mySetting', defaultValue)

  // ─── Actions ──────────────────────────────────────────────
  function reset() {
    theme.value = 'light'
    locale.value = 'en'
    layout.value = 'comfortable'
    sidebarOpen.value = true
  }

  return {
    theme,
    locale,
    layout,
    sidebarOpen,
    reset,
  }
})

Adding a New Setting

When asked to add a setting:

  1. Determine the type (string union, boolean, number, string)
  2. Choose a namespaced key: settings:[descriptiveName]
  3. Choose a sensible default
  4. Add to the store and to the reset() function
  5. Add the corresponding i18n label to /locales/en.json if it's user-facing

Example: Adding a font size setting

const fontSize = useLocalStorage<'sm' | 'md' | 'lg'>('settings:fontSize', 'md')

// In reset():
fontSize.value = 'md'

Steps

  1. Ask: what setting needs to be persisted?
  2. Determine if it belongs in the existing stores/settings.ts or needs its own store
  3. Generate or extend following the template above
  4. Always include the key in reset()

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.