
Vue Best Practices
Implement or refactor Vue 3 apps with Composition API, script setup, TypeScript, and ordered best-practice references.
Overview
Vue-best-practices is an agent skill for the Build phase that enforces a Vue 3 Composition API and TypeScript workflow with required reference reads before implementation.
Install
npx skills add https://github.com/hyf0/vue-skills --skill vue-best-practicesWhat is this skill?
- Mandates Composition API with script setup and TypeScript unless Options API is explicit
- Ordered workflow: confirm architecture, read core references, then implement
- Core must-read refs include reactivity, SFC, and component reference guides
- Covers Vue 3, SSR, Volar, vue-tsc, Vue Router, Pinia, and Vite
- Five explicit core principles from predictable state to readable self-documenting code
- Five core principles in the workflow
- Three required must-read core reference areas before implementing
Adoption & trust: 22.6k installs on skills.sh; 2.5k GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
Your agent improvises Vue patterns and misses reactivity or SFC conventions your Vite Vue repo expects.
Who is it for?
Indie developers shipping or maintaining Vue 3 + Vite (or SSR) apps who want agent output to match official-style practices.
Skip if: Non-Vue frameworks, greenfield projects explicitly locked to Options API without reading vue-options-api-best-practices, or pure Node API tasks.
When should I use this skill?
Any Vue, .vue files, Vue Router, Pinia, Vite with Vue, SSR, Volar, or vue-tsc work; ALWAYS Composition API unless Options API is explicit.
What do I get? / Deliverables
You get architecture-confirmed Vue 3 code aligned to core references, script setup, and predictable component data flow.
- Architecture-confirmed Vue implementation plan
- Components following referenced reactivity and SFC rules
Recommended Skills
Journey fit
How it compares
Use instead of generic frontend skills when .vue, Pinia, or Vue Router must drive stack-specific decisions.
Common Questions / FAQ
Who is vue-best-practices for?
Solo builders and small teams editing Vue 3 codebases with TypeScript, Volar, and Vite who rely on agents for features and refactors.
When should I use vue-best-practices?
During Build frontend work on any Vue, .vue, Vue Router, Pinia, or Vite-with-Vue task before writing or reviewing components.
Is vue-best-practices safe to install?
Review the Security Audits panel on this Prism page; the skill is instructional Markdown with no inherent network calls.
SKILL.md
READMESKILL.md - Vue Best Practices
# Vue Best Practices Workflow Use this skill as an instruction set. Follow the workflow in order unless the user explicitly asks for a different order. ## Core Principles - **Keep state predictable:** one source of truth, derive everything else. - **Make data flow explicit:** Props down, Events up for most cases. - **Favor small, focused components:** easier to test, reuse, and maintain. - **Avoid unnecessary re-renders:** use computed properties and watchers wisely. - **Readability counts:** write clear, self-documenting code. ## 1) Confirm architecture before coding (required) - Default stack: Vue 3 + Composition API + `<script setup lang="ts">`. - If the project explicitly uses Options API, load `vue-options-api-best-practices` skill if available. - If the project explicitly uses JSX, load `vue-jsx-best-practices` skill if available. ### 1.1 Must-read core references (required) - Before implementing any Vue task, make sure to read and apply these core references: - `references/reactivity.md` - `references/sfc.md` - `references/component-data-flow.md` - `references/composables.md` - Keep these references in active working context for the entire task, not only when a specific issue appears. ### 1.2 Plan component boundaries before coding (required) Create a brief component map before implementation for any non-trivial feature. - Define each component's single responsibility in one sentence. - Keep entry/root and route-level view components as composition surfaces by default. - Move feature UI and feature logic out of entry/root/view components unless the task is intentionally a tiny single-file demo. - Define props/emits contracts for each child component in the map. - Prefer a feature folder layout (`components/<feature>/...`, `composables/use<Feature>.ts`) when adding more than one component. ## 2) Apply essential Vue foundations (required) These are essential, must-know foundations. Apply all of them in every Vue task using the core references already loaded in section `1.1`. ### Reactivity - Must-read reference from `1.1`: [reactivity](references/reactivity.md) - Keep source state minimal (`ref`/`reactive`), derive everything possible with `computed`. - Use watchers for side effects if needed. - Avoid recomputing expensive logic in templates. ### SFC structure and template safety - Must-read reference from `1.1`: [sfc](references/sfc.md) - Keep SFC sections in this order: `<script>` → `<template>` → `<style>`. - Keep SFC responsibilities focused; split large components. - Keep templates declarative; move branching/derivation to script. - Apply Vue template safety rules (`v-html`, list rendering, conditional rendering choices). ### Keep components focused Split a component when it has **more than one clear responsibility** (e.g. data orchestration + UI, or multiple independent UI sections). - Prefer **smaller components + composables** over one “mega component” - Move **UI sections** into child components (props in, events out). - Move **state/side effects** into composables (`useXxx()`). Apply objective split triggers. Split the component if **any** condition is true: - It owns both orchestration/state and substantial presentational markup for multiple sections. - It has 3+ distinct UI sections (for example: form, filters, list, footer/status). - A template block is repeated or could become reusable (item rows, cards, list entries). Entry/root and route view rule: - Keep entry/root and route view components thin: app shell/layout, provider wiring, and feature compo