vue-best-practices
Vue 3 development with Composition API, <script setup>, and TypeScript as the standard approach.
- Enforces a structured workflow: confirm architecture, apply core foundations (reactivity, SFC structure, component focus, data flow, composables), then add optional features only when needed
- Requires reading and applying four core references before implementation: reactivity, SFC structure, component data flow, and composables
- Provides explicit component-splitting rules based on responsibility boundaries, with special guidance for entry/root and route-level view components as thin composition surfaces
- Covers optional features (slots, transitions, async components, directives, state management) with dedicated references loaded only when requirements call for them
- Includes a performance optimization pass as a post-functionality step, never before core behavior is verified
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-practicesskill if available. - If the project explicitly uses JSX, load
vue-jsx-best-practicesskill if available.
1.1 Must-read core references (required)
More from hyf0/vue-skills
vue-debug-guides
Vue 3 debugging and error handling for runtime errors, warnings, async failures, and SSR/hydration issues. Use when diagnosing or fixing Vue issues.
13.1Kvue-pinia-best-practices
Pinia stores, state management patterns, store setup, and reactivity with stores.
1.9Kvue-router-best-practices
Vue Router 4 patterns, navigation guards, route params, and route-component lifecycle interactions.
1.8Kcreate-adaptable-composable
Create a library-grade Vue composable that accepts maybe-reactive inputs (MaybeRef / MaybeRefOrGetter) so callers can pass a plain value, ref, or getter. Normalize inputs with toValue()/toRef() inside reactive effects (watch/watchEffect) to keep behavior predictable and reactive. Use this skill when user asks for creating adaptable or reusable composables.
1.7Kvue-testing-best-practices
Use for Vue.js testing. Covers Vitest, Vue Test Utils, component testing, mocking, testing patterns, and Playwright for E2E testing.
1.5Kvue-options-api-best-practices
Vue 3 Options API style (data(), methods, this context). Each reference shows Options API solution only.
1.5K