About vue-router-best-practices
A Vue Router practice skill for developers building Vue applications. It organizes guidance around navigation guards, route lifecycle behavior, and production setup, with pointers to common pitfalls.
Key features
- 01Navigation guard patterns
- 02Route parameter and lifecycle guidance
- 03Cleanup of persistent event listeners
- 04Production SPA routing guidance
Use cases
- 01Debugging redirects or guard issues
- 02Handling navigation between route parameters
- 03Removing listeners after component unmount
- 04Setting up Vue Router for an SPA
Install
Copy the command and run it in a terminal.
$
npx skills add https:/ / github.com/ vuejs-ai/ skills --skill vue-router-best-practicesAfter installing, type/vue-router-best-practicesin Claude Code to confirm it loaded.
Bundled files
References and scripts installed along with SKILL.md.
reference/router-beforeenter-no-param-trigger.mdrouter-beforerouteenter-no-this.mdrouter-guard-async-await-pattern.mdrouter-navigation-guard-infinite-loop.mdrouter-navigation-guard-next-deprecated.mdrouter-param-change-no-lifecycle.mdrouter-simple-routing-cleanup.mdrouter-use-vue-router-for-production.mdDetails
From the project READMEVue Router best practices, common gotchas, and navigation patterns.
Navigation Guards
- Navigating between same route with different params → See router-beforeenter-no-param-trigger
- Accessing component instance in beforeRouteEnter guard → See router-beforerouteenter-no-this
- Navigation guard making API calls without awaiting → See router-guard-async-await-pattern
- Users trapped in infinite redirect loops → See router-navigation-guard-infinite-loop
- Navigation guard using deprecated next() function → See router-navigation-guard-next-deprecated
Route Lifecycle
- Stale data when navigating between same route → See router-param-change-no-lifecycle
- Event listeners persisting after component unmounts → See router-simple-routing-cleanup
Setup
- Building production single-page application → See router-use-vue-router-for-production
Comments
Markdown supported