Svelte Store Validator skill for Claude and Codex
Builds a writable Svelte store that refuses invalid data: every set and update runs your field rules, errors come back in the style you choose, and the…
Install it once and Claude or Codex runs it for you. When your request matches, your AI loads the skill, asks for anything it is missing, and works through the template itself. Prefer to fill it in by hand? See the full prompt template.
Download the skill (.zip) · View SKILL.md
When it is used
Use when a Svelte writable store must reject bad data on every set or update, with field rules enforced inside the store rather than in each component. Do not use for form-level validation in a component, or schema validation with an external library such as Zod. Related topics: coding, svelte.
What it will ask you for
- Store name (free text, e.g. "profileStore")
- Data shape as a JSON example (longer free text)
- Validation rules (longer free text)
- Error handling (choose one: Throw, Return a result object, Log and keep the last valid value)
- Include TypeScript types (choose one: Yes, No)
- Export style (choose one: default, named)
- Number of test cases to generate (number from 0 to 10)
How it works
- Write one validator function per field from the rules and a validate function that collects every failure with a readable message.
- Wrap a writable so subscribe passes through unchanged and set and update run validate before storing; no path can store an invalid value.
- Implement the chosen error handling in one place (throw, result object, or log and keep) so callers see one consistent contract.
- Infer and export the value type from the JSON example when TypeScript is requested, matching the export style.
- Append the requested test cases as comments, half passing and half failing, each failing case naming the field and rule it breaks.
What you get
One fenced code block with the complete store, its types and export in the chosen style, and the test cases as trailing comments; nothing outside the block.
What it watches out for
- Validating only in set and forgetting update, which lets a callback write an invalid value straight through.
- Stopping at the first failing field, so users fix one error and hit the next on the following submit.
- Throwing inside a store subscriber callback, which surfaces as an unhandled error far from the write that caused it.
How to install
Claude.ai and the Claude desktop app
- Download the skill .zip.
- Open Settings, then Capabilities, and find Skills.
- Choose Upload skill and select the .zip.
- Ask Claude for help with the task. It loads the skill when your request matches.
Claude Code
- Download the skill .zip.
- Unzip it into ~/.claude/skills/ (or .claude/skills/ inside a project).
- Start a new session. Claude Code loads the skill when your request matches.
Codex
- Download the skill .zip.
- Unzip it into ~/.agents/skills/ (or .agents/skills/ inside a project).
- Codex picks it up on its own. Type $ and the skill name to use it, or just ask for the task.
Cursor
- Download the Cursor rule (.mdc).
- Save it in .cursor/rules/ inside your project.
- Cursor's agent applies the rule when your request matches its description.
AGENTS.md (Codex, Cursor, and other coding agents)
- Copy the AGENTS.md section.
- Paste it into AGENTS.md at the root of your repository, creating the file if needed.
- Coding agents that read AGENTS.md follow it when your request fits.