Back to Skills

vue-router-best-practices

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

2,536stars145forksUpdated 6/8/2026

Security Assessment

Safe(100/100)
Security Score100/100

About vue-router-best-practices

The vue-router-best-practices skill provides guidance for working with Vue Router 4 in Vue applications. It focuses on common routing problems such as navigation guard behavior, route parameter changes, stale route data, redirect loops, and route-component lifecycle interactions. The skill helps users recognize routing patterns that can cause bugs or confusing behavior, especially when navigating between similar routes, handling asynchronous guard logic, or relying on lifecycle hooks that may not run as expected.

Its main capabilities are organized around navigation guards, route lifecycle behavior, and production setup guidance. It references patterns for handling same-route navigation with different parameters, using beforeRouteEnter correctly when component instances are unavailable, awaiting asynchronous API calls inside guards, avoiding infinite redirect loops, and avoiding deprecated guard patterns such as next(). It also covers lifecycle-related cleanup concerns, including stale data during param changes and event listeners that persist after component unmounting.

This skill is intended for Vue developers, frontend engineers, code reviewers, and technical teams building or maintaining applications that use Vue Router 4. It is especially useful when debugging routing issues, reviewing navigation guard logic, documenting best practices, or preparing a Vue single-page application for production. Its scope is limited to the Vue Router topics explicitly listed in the provided references and does not describe unrelated Vue APIs or additional router features.

FAQ

What Vue Router version does this skill focus on?

It focuses on Vue Router 4, based on the skill description.

Can this skill help with navigation guards?

Yes. It covers several navigation guard topics, including same-route parameter navigation, beforeRouteEnter behavior, asynchronous guard patterns, infinite redirect loops, and deprecated next() usage.

Does this skill cover route lifecycle issues?

Yes. It includes guidance for stale data when navigating between the same route with different parameters and cleanup for event listeners after component unmounting.

Is this skill intended for production Vue applications?

Yes. The setup section includes guidance related to building production single-page applications with Vue Router.

Does this skill provide complete API documentation for Vue Router?

No. It is focused on best practices, common gotchas, and navigation patterns mentioned in the provided content.

All Files

9 files
reference/router-param-change-no-lifecycle.md4.9 KB
View
reference/router-navigation-guard-infinite-loop.md5.4 KB
View
reference/router-navigation-guard-next-deprecated.md4.2 KB
View
reference/router-guard-async-await-pattern.md5.8 KB
View
reference/router-simple-routing-cleanup.md5.2 KB
View
SKILL.md1.4 KB
View
reference/router-use-vue-router-for-production.md5.2 KB
View
reference/router-beforeenter-no-param-trigger.md4.8 KB
View
reference/router-beforerouteenter-no-this.md4.9 KB
View

Install vue-router-best-practices

Download and extract the skill files to your .claude/skills/ directory.

Quick Setup:

  1. Copy the skill folder to .claude/skills/
  2. Claude will automatically detect and use the skill

Repository

hyf0/vue-skills