WesleySmits/agent-skills / .agent/skills/vue-component-architect
scaffolding-vue-components
VerifiedScaffolds Vue/Nuxt components with Composition API, CSS modules, Vitest tests, and Storybook stories. Use when the user asks to create a Vue component, generate component boilerplate, or mentions Vue 3 architecture.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 5.6 KB |
| examples/advanced-patterns.md | markdown | 3.9 KB |
| examples/component-templates.md | markdown | 3.6 KB |
| examples/storybook.md | markdown | 3.5 KB |
| examples/testing.md | markdown | 3.2 KB |
examples/component-templates.md
View on GitHub# Vue Component Templates
## Standard Composition API Component
```vue
<script setup lang="ts">
interface Props {
/** Primary content via slot or prop */
label?: string;
/** Visual variant */
variant?: "primary" | "secondary";
/** Disabled state */
disabled?: boolean;
}
const props = withDefaults(defineProps<Props>(), {
variant: "primary",
disabled: false,
});
const emit = defineEmits<{
click: [event: MouseEvent];
}>();
const handleClick = (event: MouseEvent) => {
if (!props.disabled) {
emit("click", event);
}
};
</script>
<template>
<button
:class="[$style.root, $style[variant]]"
:disabled="disabled"
:data-disabled="disabled"
@click="handleClick"
>
<slot>{{ label }}</slot>
</button>
</template>
<style module>
.root {
display: inline-flex;
align-items: center;
padding: var(--spacing-md, 1rem);
border: none;
border-radius: var(--radius-md, 0.5rem);
font-family: var(--font-family-base, sans-serif);
cursor: pointer;
transition: all var(--transition-fast, 150ms) ease;
}
.primary {
background-color: var(--color-primary, #3b82f6);
color: var(--color-primary-foreground, #ffffff);
}
.primary:hover:not([data-disabled="true"]) {
background-color: var(--color-primary-hover, #2563eb);
}
.secondary {
background-color: var(--color-secondary, #e5e7eb);
color: var(--color-secondary-foreground, #1f2937);
}
.secondary:hover:not([data-disabled="true"]) {
background-color: var(--color-secondary-hover, #d1d5db);
}
[data-disabled="true"] {
opacity: 0.5;
cursor: not-allowed;
}
</style>
```
## Component with Composables
```vue
<script setup lang="ts">
import { useComponentLogic } from "./useComponentLogic";
interface Props {
initialValue?: string;
}
const props = withDefaults(defineProps<Props>(), {
initialValue: "",
});
const emit = defineEmits<{
change: [value: string];
}>();
const { value, updateValue } = useComponentLogic(props.initialValue, (v) =>
emit("change", v),
);
</script>
<template>
<div :class="$style.root">
<input
v-model="value"
type="text"
:class="$style.input"
@input="updateValue(($event.target as HTMLInputElement).value)"
/>
</div>
</template>
<style module>
.root {
display: flex;
}
.input {
padding: var(--spacing-sm, 0.5rem);
border: 1px solid var(--color-border, #e5e7eb);
border-radius: var(--radius-sm, 0.25rem);
}
</style>
```
### Composable File (useComponentLogic.ts)
```typescript
import { ref, type Ref } from "vue";
export function useComponentLogic(
initialValue: string,
onChange?: (value: string) => void,
): {
value: Ref<string>;
updateValue: (newValue: string) => void;
} {
const value = ref(initialValue);
const updateValue = (newValue: string) => {
value.value = newValue;
onChange?.(newValue);
};
return { value, updateValue };
}
```
## Component with Pinia Store
```vue
<script setup lang="ts">
import { storeToRefs } from "pinia";
import { useUserStore } from "@/stores/user";
const userStore = useUserStore();
const { user, isLoading } = storeToRefs(userStore);
const handleLogout = async () => {
await userStore.logout();
};
</script>
<template>
<div :class="$style.root">
<template v-if="isLoading">
<span>Loading...</span>
</template>
<template v-else-if="user">
<span>{{ user.name }}</span>
<button @click="handleLogout">Logout</button>
</template>
</div>
</template>
<style module>
.root {
display: flex;
gap: var(--spacing-sm, 0.5rem);
}
</style>
```
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the work | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixes | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation code | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |