About vue-router-best-practices
A reference skill for Vue Router navigation and route lifecycle practices. It helps Vue developers recognize common routing pitfalls and choose documented patterns.
Key features
- 01Navigation guard patterns
- 02Route parameter change behavior
- 03Lifecycle and listener cleanup
- 04Production SPA setup guidance
Use cases
- 01Debugging guards that fail to await API calls
- 02Preventing redirect loops
- 03Refreshing data after route parameter changes
Install
Copy the command and run it in a terminal.
$
npx skills add https:/ / github.com/ antfu/ 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.
LICENSE.mdSYNC.mdreference/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