Index of every page on this site: llms.txt
All skills
fubits1 avatar

/validate-file

@a024d57
by Iljafubits1/svelte-skills11 stars
2
Run it yourself

Validate edited files, lint .svelte/.ts/.js, test stories, lint markdown. Auto-invoke after ANY file edit before declaring done. User-invocable as /frontend:validate-file [files].

Use this Skill: https://skilld.dev/gh/fubits1/svelte-skills/validate-file

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencesstory-loop.md

≈821 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Per-file validation loop for component + story pairs

For component + story pairs, follow this exact sequence:

  1. Test first: pnpm test:story <Pattern> (<Pattern> is a Vitest file filter, e.g. part of the story file name): see the failure before changing anything
    • New story with a play: write it, temporarily change the expected value in its assertion, confirm the story fails, then restore it
    • New story without a play: its test passes even when a component inside the story throws while rendering (the error shows under "Unhandled Errors" and the run exits 1), and under a decorator that returns a bare component it can stay green with the wrapper missing (svelte-5:storybook-vitest, references/storybook-decorator.md, "Decorator return form"); add a play if the component is interactive (svelte-5:storybook-vitest); a failing first run for a non-interactive story without a play is not covered here
  2. Read the error: understand the root cause. pnpm test:story passes --silent, which hides console output and msw warnings; svelte-5:storybook-vitest shows how to see them
  3. Fix the component or story: context guards, prop guards and the like
  4. LINT BEFORE TESTING: pnpm lint:file <component> <story> must exit 0 before you run the tests again. Install every tool the scripts call (SETUP.md) and read the type-check caveats: a type check can report ✓ without checking a file. Lint catches type errors that would crash at runtime, so testing unlinted code wastes time. Fix ALL errors, not just yours
  5. Run the Svelte autofixer (mcp__plugin_svelte_svelte__svelte-autofixer) on every edited .svelte, .svelte.ts and .svelte.js file. It catches leftover Svelte 4 patterns and other migration issues, such as a <slot /> where a snippet and {@render children()} belong, or a store where a rune belongs. Skip it for a .svelte file not yet migrated (pure Svelte 4: export let, $:, <slot />, no runes)
  6. Test AFTER lint: pnpm test:story <Pattern>, once steps 4 and 5 are clean
  7. Check it in the browser: open the story in Storybook through Playwright MCP (svelte-5:storybook): navigate to the story (how to build a story's URL is not covered here), wait for the render, take a screenshot, check the console for 0 errors. A story whose test passes can still render empty or broken
  8. Review component props: list the props a story must exercise (selection callbacks, bindable values, autocomplete or select inputs) in the component AND its CHILD components, and add a story variant for each one not covered yet
  9. Lint the story again if variants were added
  10. Test again if story changed, and repeat step 7

Do NOT move to the next file until all steps pass.

Examples

# edited a component
pnpm lint:file src/lib/components/MyComponent.svelte

# edited a story + its wrapper
pnpm lint:file src/lib/components/stories/MyComponent.stories.svelte src/lib/components/stories/MyComponentWrapper.svelte
pnpm test:story MyComponent

# edited markdown docs
pnpm exec markdownlint docs/STORYBOOK.md docs/STORYBOOK-DECORATOR.md

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts4mo3 checks · Risk SAFE
  • Gen Agent Trust Hub4mo

    The skill provides a structured validation workflow for software development, using standard linting and testing tools like pnpm, npx, and eslint. No security risks or malicious patterns were detected.

  • Socket4mo

    No alerts

  • Snyk4mo

    Risk: LOW · No issues

Signed by skilld at a024d57. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub last month.

Activeupdated last month
argument-hint
[files]
user-invocable
true

README badge

README badge for fubits1/svelte-skills/validate-file