Agent skill
vue
Vue.js framework, components, state management, and routing patterns
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/vue-baphled-dotopencode
SKILL.md
Skill: vue
What I do
I help you build web applications using the Vue.js framework. I focus on component design, state management with Pinia, and routing with Vue Router. I ensure that you follow the latest best practices, including the use of the Composition API and <script setup> syntax.
When to use me
- When you're creating a new Vue component or refactoring an existing one.
- When you're designing the state management for a complex application.
- When you're setting up navigation and guards with Vue Router.
- When you're choosing between different reactivity primitives like
ref()andreactive().
Core principles
- Composition over inheritance, use the Composition API to share logic across components rather than relying on mixins.
- Predictable state, use Pinia for centralising application state and ensuring that changes are trackable and consistent.
- Reactive data flow, understand how Vue's reactivity system works to avoid common pitfalls like lost reactivity.
- Single-file components, keep your template, script, and styles together for better maintainability and developer experience.
Patterns & examples
Composition API with script setup
The preferred way to write Vue components.
<script setup>
import { ref, computed } from 'vue'
const count = ref(0)
const doubleCount = computed(() => count.value * 2)
function increment() {
count.value++
}
</script>
<template>
<button @click="increment">Count is: {{ count }}</button>
</template>
State management with Pinia
Define a store for shared application state.
import { defineStore } from 'pinia'
export const useUserStore = defineStore('user', {
state: () => ({ name: 'Alice', isLoggedIn: false }),
actions: {
login(name) {
this.name = name
this.isLoggedIn = true
}
}
})
Component communication
Use props for data down and emits for events up.
- Pattern, Pass data to child components via props and notify parent components of changes via the
emitfunction.
Navigation guards in Vue Router
Protect routes based on authentication or other conditions.
router.beforeEach((to, from) => {
const auth = useAuthStore()
if (to.meta.requiresAuth && !auth.isLoggedIn) {
return { name: 'login' }
}
})
Anti-patterns to avoid
- ❌ Options API in new projects, continuing to use the Options API instead of the more flexible Composition API.
- ❌ Mutating props directly, trying to change a prop value within a child component instead of emitting an event.
- ❌ Over-using reactive(), using
reactive()for simple values whereref()would be more appropriate and clearer. - ❌ Direct DOM manipulation, using
document.querySelectorinstead of Vue's template refs or data binding.
KB Reference
~/vaults/baphled/3. Resources/Knowledge Base/AI Development System/Skills/UI-Frameworks/Vue.md
Related skills
javascript, for core language expertise.ui-design, for designing web interfaces.ux-design, for creating intuitive user flows.clean-code, for maintaining a high-quality codebase.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?