Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
hyf0 avatar

Vue Router Best Practices

  • 2.7k installs
  • 2.8k repo stars
  • Updated May 30, 2026
  • hyf0/vue-skills

This is a copy of vue-router-best-practices by antfu - installs and ranking accrue to the original listing.

vue-router-best-practices is a Vue Router 4 reference skill that supplies navigation guard patterns, route param rules, and lifecycle guidance for developers who want to prevent common SPA routing bugs.

About

vue-router-best-practices is a Vue Router 4 skill at version 1.0.0 from hyf0/vue-skills that documents navigation patterns, guard pitfalls, and route-component lifecycle interactions. It links to focused reference notes such as router-beforeenter-no-param-trigger for same-route param changes, router-beforerouteenter-no-this for beforeRouteEnter instance access, and router-guard-async-await-pattern for awaited API calls in guards. Developers reach for this skill when navigation guards fail silently, params do not retrigger hooks, or async guards race navigation. The MIT-licensed skill targets vuejs-ai curated patterns rather than generic Vue docs. Use it during SPA routing implementation and code review.

  • Covers 8 core navigation guard pitfalls with direct reference links
  • Explains route param change behavior and component lifecycle interactions
  • Details production SPA setup requirements for Vue Router
  • Prevents infinite redirect loops and stale data issues
  • Hard-gate: always apply these patterns before committing router configuration

Vue Router Best Practices by the numbers

  • 2,675 all-time installs (skills.sh)
  • +41 installs in the week ending Aug 5, 2026 (Skillselion tracking)
  • Security screen: LOW risk (skills.sh audit)
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/hyf0/vue-skills --skill vue-router-best-practices

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs2.7k
repo stars2.8k
Security audit3 / 3 scanners passed
Last updatedMay 30, 2026
Repositoryhyf0/vue-skills

How do you fix Vue Router 4 navigation guard pitfalls?

Get concise, correct Vue Router 4 patterns, navigation guard rules, and lifecycle gotchas that prevent common routing bugs.

Who is it for?

Frontend developers building Vue 3 SPAs with Vue Router 4 who hit guard, param, or lifecycle edge cases.

Skip if: React Router projects, server-rendered routing without Vue Router, or teams needing only basic route table setup.

When should I use this skill?

The user asks about Vue Router 4 navigation guards, beforeRouteEnter, same-route param changes, or async guard patterns.

What you get

Correct Vue Router 4 guard implementations, param navigation patterns, and lifecycle-safe route component code.

  • Corrected navigation guard code
  • Route param handling patterns

By the numbers

  • Skill version 1.0.0 with MIT license
  • Targets Vue Router 4 patterns from vuejs-ai reference notes

Files

SKILL.mdMarkdownGitHub ↗

Vue 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

Related skills

How it compares

Use vue-router-best-practices over official Vue docs when you need guard-specific gotcha references for production SPA edge cases.

FAQ

Why do Vue Router guards miss same-route param changes?

vue-router-best-practices points to router-beforeenter-no-param-trigger, explaining that navigating between the same route with different params may not retrigger beforeEnter. The skill documents the correct pattern to handle param-only navigation updates.

How do you use async API calls in Vue Router guards?

vue-router-best-practices references router-guard-async-await-pattern for awaiting API calls inside navigation guards. Without awaiting, guards can resolve navigation before data loads, causing race conditions and blank route views.

Is Vue Router Best Practices safe to install?

skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.

Frontend Developmentfrontendintegrations

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.