verify-svelte-check
Run svelte-check (or `pnpm check`) after EVERY edit to any .svelte or .ts file under frontend/src. Triggers on: edit/save .svelte / .ts, refactoring Svelte 5 components, after extracting helpers, afte
SKILL.md.claude/skills/verify-svelte-check/SKILL.md
GitHubSkill: Always verify with svelte-check
When to run
Run svelte-check (or pnpm check) EVERY TIME after ANY of these:
- Edit a
.svelteor.tsfile underfrontend/src - Refactor
$state/$derived/$props/$bindabledeclarations - Add/remove/change imports
- Convert inline event handlers (
oninput,onchange,onclick) tobind:or vice versa - Extract/dead-code removal in components
- After running
svelte-autofixerand applying its suggestions - BEFORE reporting work as done to the user
- BEFORE
git commit
Inline LSP errors are often STALE
When using the edit or write tools, the editor LSP may report ERROR [N:M] Cannot find name 'X' immediately after the change blob — this is frequently a false positive based on cached state. Do not treat the inline LSP diagnostics as ground truth. Always confirm by running svelte-check from the shell.
Command
cd frontend && npx svelte-check --threshold error 2>&1 | tail -30
For full diagnostics (including warnings):
cd frontend && npx svelte-check 2>&1 | tail -30
Equivalently (npm script defined in frontend/package.json):
cd frontend && pnpm check
Note: pnpm check (defined in frontend/package.json as svelte-check --tsconfig ./tsconfig.app.json && tsc -p tsconfig.node.json) also runs a second tsc pass over the Node-side config, and reports warnings too — it isn't identical to the --threshold error form. Prefer the explicit npx svelte-check --threshold error command when you want errors-only output fast; run plain pnpm check when you want the full picture including the Node-config type check.
Reading the output
Sample output:
/home/rehundy/.../frontend/src/routes/admin/GalleryList.svelte:13:7
Error: 'categories' is declared but its value is never read. (ts)
let categories = $state<CategoryMeta[]>([]);
Each finding lists:
- File path
- Line:column
- Severity (
Error/Warning) - Rule (e.g.,
(ts)for TypeScript, slint, svelte) - The offending line
Tail of output gives a summary: svelte-check found N errors and M warnings in K files.
Triaging findings
For each diagnostic, classify it:
- Introduced by this edit — fix immediately. The work isn't done.
- Pre-existing (touched file unrelated to current edit) — note in the report but don't fix unless the user asked for a tidying pass. Fixing them mid-task muddies diffs and may break unrelated code.
- Stale LSP false positive — confirm by re-running: often goes away after the next full svelte-check pass. Never "fix" something by changing code you don't understand to silence a diagnostic you can't reproduce in svelte-check.
Report format
When reporting back to the user after edits:
Verified with: `svelte-check --threshold error`
Result: 0 errors, 0 warnings (or: N errors, M warnings — all pre-existing in unrelated files)
If findings exist, group them as:
- New (introduced by this edit) — listed with proposed fix
- Pre-existing — listed with file:line, no action taken
Failure modes to avoid
- Skipping svelte-check because the change "looks small". Even single-line edits can introduce type errors with strict TS settings.
- Trusting inline
<diagnostics>block from theedittool — frequently stale. - Fixing pre-existing errors mid-task without user consent — creates unprompted diff noise.
- Editing
.sveltefiles without re-running the check before reporting "done". - Treating warnings as ignorable.
unused-import/unused-varwarnings are real cleanup debt. Address at minimum when finishing a task.