About vue-router-best-practices
A Vue Router skill for developers seeking practical guidance on navigation patterns and common pitfalls. It covers navigation guards, route lifecycle behavior, and production SPA setup.
Key features
- 01Navigation guard patterns
- 02Async guard handling
- 03Redirect loop troubleshooting
- 04Route parameter lifecycle
- 05Cleanup on component unmount
- 06Production SPA setup
Use cases
- 01Handle navigation between routes with changing parameters
- 02Prevent guard-related redirect loops
- 03Clean up listeners when routes unmount
Install
Copy the command and run it in a terminal.
$
npx skills add https:/ / github.com/ hairyf/ 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