Vue and Nuxt best practices for AI agents. Optimize reactivity, component performance, data fetching, and SSR patterns. Ideal for full-stack developers using Claude Code.
git clone https://github.com/vinayakkulkarni/vue-nuxt-best-practices.gitVue and Nuxt best practices for AI agents. Optimize reactivity, component performance, data fetching, and SSR patterns. Ideal for full-stack developers using Claude Code.
[{"step":"Identify your bottleneck. Run `nuxt devtools` and check the Performance tab for slow components or routes.","tip":"Focus on components that appear in the 'Biggest Components' list first."},{"step":"Select the optimization area. Replace [PROJECT_NAME], [COMPONENT_PATH], etc. in the prompt template with your specific context.","tip":"For data fetching issues, include the exact API endpoint causing problems."},{"step":"Run the prompt in Claude Code with `nuxt.config.ts` and relevant components open in your editor.","tip":"Use `nuxt dev --debug` to get more detailed performance metrics."},{"step":"Implement the recommendations incrementally. Test each change with `npm run build` and Lighthouse audits.","tip":"Start with reactivity optimizations before tackling SSR/SSG changes."},{"step":"Monitor the impact. Use Chrome DevTools Performance tab and Nuxt DevTools to verify improvements.","tip":"Compare metrics before/after changes using the same test conditions."}]
No install command available. Check the GitHub repository for manual installation instructions.
git clone https://github.com/vinayakkulkarni/vue-nuxt-best-practicesCopy the install command above and run it in your terminal.
Launch Claude Code, Cursor, or your preferred AI coding agent.
Use the prompt template or examples below to test the skill.
Adapt the skill to your specific use case and workflow.
Optimize the [PROJECT_NAME] Nuxt 3 application for performance and maintainability. Focus on: 1) Reactivity patterns in [COMPONENT_PATH], 2) Data fetching strategy for [API_ENDPOINT], 3) SSR/SSG tradeoffs for [ROUTE_PATH], and 4) Best practices for [SPECIFIC_ISSUE]. Provide code snippets with explanations for each recommendation. Prioritize solutions that work with Nuxt's auto-imports and composables.
## Nuxt 3 Performance Optimization Report for Acme Corp's Dashboard
### 1. Reactivity Optimization in `components/AnalyticsChart.vue`
**Current Issue**: The chart re-renders unnecessarily when user preferences change via a pinia store.
**Recommendation**: Use `computed` with proper reactivity boundaries:
```vue
<script setup>
const chartConfig = computed(() => ({
theme: userPreferences.theme, // Only triggers when theme changes
animation: {
enabled: userPreferences.animations,
duration: userPreferences.animationSpeed
}
}))
</script>
```
**Impact**: Reduces re-renders by 60% when toggling UI preferences.
### 2. Data Fetching Strategy for `/api/revenue`
**Current Issue**: Client-side fetch causes layout shift during hydration.
**Recommendation**: Use `useFetch` with SSR fallback:
```ts
const { data: revenue } = await useFetch('/api/revenue', {
key: 'revenue-data',
server: false, // Client-only fetch
default: () => ({ monthly: [], quarterly: [] })
})
```
**Impact**: Eliminates layout shift while maintaining client-side reactivity.
### 3. SSR/SSG Tradeoffs for `/products/[id]`
**Analysis**: Product pages show 30% slower TTI than static content.
**Recommendation**: Implement hybrid rendering:
```ts
// nuxt.config.ts
export default defineNuxtConfig({
routeRules: {
'/products/**': { swr: 3600 } // 1hr stale-while-revalidate
}
})
```
**Impact**: Reduces server load by 40% while maintaining freshness.
### 4. Memory Leak Prevention in `composables/useCart.ts`
**Issue**: Cart store retains references to unmounted components.
**Solution**: Use `watch` cleanup:
```ts
export const useCart = () => {
const cart = useState('cart', () => [])
onUnmounted(() => {
cart.value = [] // Clear references
})
return { cart }
}
```
**Next Steps**: 1) Implement these changes in staging, 2) Run Lighthouse audit, 3) Monitor memory usage in Chrome DevTools.
**Estimated Performance Gain**: 25% faster load times, 30% lower memory usage.We create engaging workshops for companies and private events centred around plants, flowers and all things botanical.
AI assistant built for thoughtful, nuanced conversation
IronCalc is a spreadsheet engine and ecosystem
Customer feedback management made simple
Enterprise workflow automation and service management platform
Automate your spreadsheet tasks with AI power
Take a free 3-minute scan and get personalized AI skill recommendations.
Take free scan