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.
In this repository10 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- design-componentSkill
- new-componentSkill
- new-composableSkill
- new-gql-operationSkill
- new-migrationSkill
- new-quill-fieldSkill
- new-resolverSkill
- new-server-routeSkill
- new-storeSkill
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
- Very specific: line 9
Always use useLocalStorage from @vueuse/core — never localStorage.setItem directly
- Very specific: line 11
Always provide sensible defaults as the second argument to useLocalStorage
- Very specific: line 12
Always include a reset() action that restores all defaults
- Very specific: line 14
If adding to the existing stores/settings.ts, extend it — don't create a duplicate
- Distinctive: line 53
When asked to add a setting:
- Very specific: line 57
Add to the store and to the reset() function
- Very specific: line 58
Add the corresponding i18n label to /locales/en.json if it's user-facing
- Distinctive: line 71
Ask: what setting needs to be persisted?
- Very specific: line 74
Always include the key in reset()
≈ “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.
Files
Skill: New Settings Store
Rules
- Always use
useLocalStoragefrom@vueuse/core— neverlocalStorage.setItemdirectly - 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 —
useLocalStoragehandles 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:
- Determine the type (string union, boolean, number, string)
- Choose a namespaced key:
settings:[descriptiveName] - Choose a sensible default
- Add to the store and to the
reset()function - Add the corresponding i18n label to
/locales/en.jsonif 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
- Ask: what setting needs to be persisted?
- Determine if it belongs in the existing
stores/settings.tsor needs its own store - Generate or extend following the template above
- Always include the key in
reset()
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
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.

