vue-router-best-practices
Improve Vue Router Navigation
Vue Router mistakes can cause stale data, redirect loops, and unreliable navigation. This skill provides focused Vue Router 4 patterns for implementation and review.
Install with my Agent
Copy this request to your Agent. It includes the canonical Skill page and manifest.
Review the Skillstore skill "vue-router-best-practices" from https://skillstore.io/skills/antfu-vue-router-best-practices.md and its manifest at https://skillstore.io/api/skills/antfu-vue-router-best-practices/manifest. Verify the artifact. You may proceed after verification, subject to the environment's own policy.Your Agent should still show its plan and request any confirmation required by the security policy.
Agent-readable resources
Use these links when an AI agent, crawler, or script needs clean context instead of reading the full page.
Test it
Using "vue-router-best-practices". Why does beforeEnter not run when only the user ID changes?
Expected outcome:
The route record remains active, so beforeEnter does not run. Watch the ID or use an in-component route update guard.
Using "vue-router-best-practices". My authentication guard redirects forever.
Expected outcome:
Exclude the login route from the authentication redirect and return one final result from each guard path.
Using "vue-router-best-practices". Review my hash-based router cleanup.
Expected outcome:
- Register the hashchange listener when the component mounts.
- Remove the same listener when the component unmounts.
- Use Vue Router when the application needs guards, nested routes, or history support.
Security Audit
SafeAll 15 static findings are false positives from documented Vue Router examples. Fixed local imports, JavaScript template literals, route checks, and framework warnings do not create execution or reconnaissance risks. No prompt injection or malicious intent was found.
Risk Factors
โก Contains scripts (6)
โ๏ธ External commands (2)
Share & cite this report
Share the versioned assessment report, neutral badge, embed card, and citations. Skillstore reports evidence without deciding whether this Skill is safe.
Copy report link
https://skillstore.io/skills/antfu-vue-router-best-practices/audits/5?utm_source=security_passport&utm_medium=share&utm_campaign=versioned_reportMarkdown badge
[](https://skillstore.io/skills/antfu-vue-router-best-practices?utm_source=security_passport_badge)HTML badge
<a href="https://skillstore.io/skills/antfu-vue-router-best-practices?utm_source=security_passport_badge"><img src="https://skillstore.io/badges/skills/antfu-vue-router-best-practices/security.svg" alt="Skillstore security assessment" loading="lazy"></a>Embed card
<iframe src="https://skillstore.io/embed/skills/antfu-vue-router-best-practices.html" title="Skillstore Security Assessment" sandbox="allow-popups allow-popups-to-escape-sandbox" loading="lazy" referrerpolicy="no-referrer" width="420" height="180"></iframe>Academic citations (APA ยท BibTeX ยท CFF)
APA citation
github.com/vuejs-ai. (2026). vue-router-best-practices security audit report (audit version 5) [Author version 1.0.0]. Skillstore. https://skillstore.io/skills/antfu-vue-router-best-practices/audits/5BibTeX citation
@techreport{github-com-vuejs-ai-antfu-vue-router-best-practices-2026,
author = {github.com/vuejs-ai},
title = {vue-router-best-practices security audit report (audit version 5)},
institution = {Skillstore},
year = {2026},
number = {5},
url = {https://skillstore.io/skills/antfu-vue-router-best-practices/audits/5},
note = {Author version 1.0.0}
}CITATION.cff
cff-version: 1.2.0
message: "If you use this Skill, cite its author and this versioned security audit report."
title: "vue-router-best-practices security audit report (audit version 5)"
version: "1.0.0"
type: report
authors:
- name: "github.com/vuejs-ai"
date-released: "2026-07-23"
url: "https://skillstore.io/skills/antfu-vue-router-best-practices/audits/5"
identifiers:
- type: other
value: "skillstore:antfu-vue-router-best-practices:audit:5"
description: "Skillstore immutable audit report identifier"
Compare variants
2 installable variantsEach author remains a separate installable skill. The recommended variant is ranked by Skillstore evidence.
Why this variant is first
antfu-vue-router-best-practices
2026-08-21
vuejs-ai-vue-router-best-practices
2026-08-21
Skillstore Score
Why this score Evidence Confidence: HighWhat You Can Build
Review Navigation Guards
Find missing returns, unhandled promises, deprecated callbacks, and redirect loops in Vue Router guards.
Fix Stale Route Data
Choose watchers or update guards when reused route components display data for an earlier parameter.
Plan Production Routing
Create a maintainable router structure with lazy loading, nested routes, metadata, and fallback handling.
Try These Prompts
Explain why this Vue Router behavior occurs and recommend the simplest Vue Router 4 pattern: [describe behavior].
Review this navigation guard for missing returns, deprecated next usage, asynchronous errors, and redirect loops: [paste guard].
Review this route component for stale parameter data and lifecycle mistakes. Suggest a watcher, update guard, or route-level approach: [paste component].
Audit this Vue Router configuration for guard order, authorization flow, redirects, lazy loading, nested routes, cleanup, and error handling: [paste files].
Best Practices
- Return navigation outcomes from guards and await every asynchronous authorization decision.
- React directly to route parameter changes when Vue reuses a component instance.
- Keep redirects centralized and exclude their destination routes from repeated guard checks.
Avoid
- Do not rely only on mounted hooks for data tied to changing route parameters.
- Do not call next multiple times or mix next callbacks with return-based guard outcomes.
- Do not create hashchange listeners without removing them during component cleanup.
Frequently Asked Questions
Which Vue Router version does this skill cover?
Can it fix redirect loops?
Does beforeEnter run when route parameters change?
Does it support asynchronous guards?
Can it test my router automatically?
Does it cover simple hash routing?
Developer Details
Author
github.com/vuejs-aiLicense
MIT
Author version
v1.0.0
Skillstore revision
r2
Ref
89edfdc710d0846129dcee6a929477b04f08052c
Maintenance freshness
7/24/2026
Usage
15 downloads ยท 148 views
File structure
๐ LICENSE.md
๐ reference/
๐ router-beforeenter-no-param-trigger.md
๐ router-beforerouteenter-no-this.md
๐ router-guard-async-await-pattern.md
๐ router-navigation-guard-infinite-loop.md
๐ router-navigation-guard-next-deprecated.md
๐ router-param-change-no-lifecycle.md
๐ router-simple-routing-cleanup.md
๐ router-use-vue-router-for-production.md
๐ SKILL.md
๐ SYNC.md