Loading...
Loading...
Establishes or reviews the directory layout, component conventions, composable design, Pinia store structure, and Vue Router configuration for a Vue 3 TypeScript application. Invoked when the user asks to structure a Vue app, set up the project layout, or review Vue architecture.
npx skill4agent add soulcodex/agentic vue-application-structuresrc/
features/
auth/
AuthLoginForm.vue
useAuth.ts ← composable
auth.store.ts ← Pinia store
auth.types.ts
auth.api.ts ← HTTP calls
components/ ← shared/generic UI components
BaseButton.vue
TheNavbar.vue
composables/ ← shared composables used across features
useBreakpoint.ts
router/
index.ts
guards.ts
stores/ ← global stores (not feature-specific)
ui.store.ts
lib/ ← utilities, formatters, constants
assets/
App.vue
main.ts<script setup lang="ts">defineComponentdefinePropsdefineEmitscomputedimportexport<script setup lang="ts">
interface Props {
userId: string
readonly?: boolean
}
const props = withDefaults(defineProps<Props>(), { readonly: false })
const emit = defineEmits<{ saved: [userId: string] }>()
</script>useuseAuthuseCartuseDebounce// composables/useDebounce.ts
export function useDebounce<T>(value: Ref<T>, delay: number): Readonly<Ref<T>> {
const debounced = ref<T>(value.value) as Ref<T>
watchEffect(() => {
const timer = setTimeout(() => { debounced.value = value.value }, delay)
return () => clearTimeout(timer)
})
return readonly(debounced)
}// features/auth/auth.store.ts
export const useAuthStore = defineStore('auth', () => {
const user = ref<User | null>(null)
const isAuthenticated = computed(() => user.value !== null)
async function login(credentials: Credentials) {
user.value = await authApi.login(credentials)
}
return { user, isAuthenticated, login }
})vue-routerunplugin-vue-routerRouteNamedMapdefineRoutecomponent: () => import('./views/HomePage.vue')router/guards.ts// router/index.ts
{ path: '/dashboard', component: () => import('@/features/dashboard/DashboardPage.vue'),
meta: { requiresAuth: true } }| Rule | Example |
|---|---|
| PascalCase filenames | |
| |
| |
| Feature prefix for feature components | |
| No abbreviations in names | |
pnpm tsc --noEmit<script setup lang="ts">pnpm tsc --noEmit