# Vue Router Best Practices

Vue Router 4 patterns, navigation guards, route params, and route-component lifecycle...

- Repository: https://github.com/vuejs-ai/skills (3229 stars)
- Category: Engineering
- License: MIT
- Last updated: 2026-10-23
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add vuejs-ai/skills --skill vue-router-best-practices -g -a claude-code -y`
Codex: `npx skills add vuejs-ai/skills --skill vue-router-best-practices -g -a codex -y`
Cursor: `npx skills add vuejs-ai/skills --skill vue-router-best-practices -g -a cursor -y`
Gemini CLI: `npx skills add vuejs-ai/skills --skill vue-router-best-practices -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add vuejs-ai/skills`

## Description

Vue Router 4 patterns, navigation guards, route params, and route-component lifecycle interactions.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

Vue Router best practices, common gotchas, and navigation patterns.

### Navigation Guards
- Navigating between same route with different params → See [router-beforeenter-no-param-trigger](reference/router-beforeenter-no-param-trigger.md)
- Accessing component instance in beforeRouteEnter guard → See [router-beforerouteenter-no-this](reference/router-beforerouteenter-no-this.md)
- Navigation guard making API calls without awaiting → See [router-guard-async-await-pattern](reference/router-guard-async-await-pattern.md)
- Users trapped in infinite redirect loops → See [router-navigation-guard-infinite-loop](reference/router-navigation-guard-infinite-loop.md)
- Navigation guard using deprecated next() function → See [router-navigation-guard-next-deprecated](reference/router-navigation-guard-next-deprecated.md)

### Route Lifecycle
- Stale data when navigating between same route → See [router-param-change-no-lifecycle](reference/router-param-change-no-lifecycle.md)
- Event listeners persisting after component unmounts → See [router-simple-routing-cleanup](reference/router-simple-routing-cleanup.md)

### Setup
- Building production single-page application → See [router-use-vue-router-for-production](reference/router-use-vue-router-for-production.md)

