Back to list
pluginagentmarketplace

vue-router

by pluginagentmarketplace

Vue Development Plugin

1🍴 0📅 Jan 7, 2026

SKILL.md


name: vue-router description: Master Vue Router - Navigation, Guards, Lazy Loading, Meta Fields, History Modes sasmp_version: "1.3.0" bonded_agent: 04-vue-router bond_type: PRIMARY_BOND version: "2.0.0" last_updated: "2025-01"

Vue Router Skill

Production-grade skill for mastering Vue Router and building robust navigation systems.

Purpose

Single Responsibility: Teach Vue Router configuration, navigation patterns, route guards, lazy loading, and advanced routing techniques.

Parameter Schema

interface VueRouterParams {
  topic: 'config' | 'guards' | 'lazy-loading' | 'meta' | 'navigation' | 'all';
  level: 'beginner' | 'intermediate' | 'advanced';
  context?: {
    auth_required?: boolean;
    app_type?: 'spa' | 'ssr';
  };
}

Learning Modules

Module 1: Router Setup & Configuration

Prerequisites: vue-fundamentals
Duration: 2 hours
Outcome: Configure Vue Router
TopicConceptExercise
InstallationVue Router setupBasic config
Routes arrayRoute definitionsMulti-page app
History modesHash vs HTML5Production setup
Router-viewOutlet componentLayout system
Router-linkNavigation linksNavigation menu

Module 2: Dynamic & Nested Routes

Prerequisites: Module 1
Duration: 2-3 hours
Outcome: Build complex route structures
PatternExampleExercise
Dynamic params/user/:idUser profile
Optional params/user/:id?Optional filters
Catch-all/:pathMatch(.*)*404 page
Nested routes/dashboard/settingsAdmin layout
Named viewsMultiple outletsDashboard widgets

Module 3: Navigation Guards

Prerequisites: Modules 1-2
Duration: 3-4 hours
Outcome: Secure routes with guards
Guard TypeScopeUse Case
beforeEachGlobalAuth check
beforeEnterPer-routeRole check
beforeRouteEnterComponentData prefetch
beforeRouteUpdateComponentParam change
beforeRouteLeaveComponentUnsaved changes
afterEachGlobalAnalytics

Guard Composition:

router.beforeEach(async (to, from) => {
  // Auth check
  if (to.meta.requiresAuth && !isAuthenticated()) {
    return { name: 'Login', query: { redirect: to.fullPath } }
  }

  // Role check
  if (to.meta.roles && !hasRole(to.meta.roles)) {
    return { name: 'Unauthorized' }
  }

  return true
})

Module 4: Lazy Loading & Code Splitting

Prerequisites: Module 3
Duration: 2 hours
Outcome: Optimize route loading
TechniqueImplementationBenefit
Basic lazy() => import()Smaller bundles
Named chunkswebpackChunkNameGrouped loading
Prefetchingrouter.afterEachFaster navigation
Loading statesAsync componentsBetter UX

Module 5: Advanced Patterns

Prerequisites: Modules 1-4
Duration: 3 hours
Outcome: Expert routing techniques
PatternUse CaseExercise
Route metaPage metadataSEO, auth, layout
Scroll behaviorScroll positionSaved positions
TransitionsPage animationsEnter/leave effects
Route modulesLarge appsFeature-based routes

Validation Checkpoints

Beginner Checkpoint

  • Set up router with basic routes
  • Use router-link and router-view
  • Create dynamic route with params
  • Access route params in component

Intermediate Checkpoint

  • Implement auth guard
  • Create nested route layout
  • Add lazy loading to routes
  • Use route meta for titles

Advanced Checkpoint

  • Build full auth flow with guards
  • Implement route-based code splitting
  • Create route transition animations
  • Design modular route structure

Retry Logic

const skillConfig = {
  maxAttempts: 3,
  backoffMs: [1000, 2000, 4000],
  onFailure: 'provide_simpler_route'
}

Observability

tracking:
  - event: route_configured
    data: [route_count, guards_count]
  - event: navigation_pattern_learned
    data: [pattern_name, complexity]
  - event: skill_completed
    data: [routes_built, auth_implemented]

Troubleshooting

Common Issues

IssueCauseSolution
Route not matchingWrong path orderSpecific before generic
Guard infinite loopGuard → same routeCheck target route
Lazy load failsWrong import pathVerify file exists
Params undefinedMissing props: trueEnable props

Debug Steps

  1. Check Vue Devtools router tab
  2. Verify route order (specific first)
  3. Console.log in guards
  4. Check router.getRoutes()

Unit Test Template

import { describe, it, expect, beforeEach } from 'vitest'
import { createRouter, createWebHistory } from 'vue-router'
import { routes } from './routes'

describe('Router', () => {
  let router: Router

  beforeEach(() => {
    router = createRouter({
      history: createWebHistory(),
      routes
    })
  })

  it('redirects to login when not authenticated', async () => {
    await router.push('/dashboard')
    expect(router.currentRoute.value.name).toBe('Login')
  })

  it('allows access to public routes', async () => {
    await router.push('/about')
    expect(router.currentRoute.value.name).toBe('About')
  })
})

Usage

Skill("vue-router")
  • vue-fundamentals - Prerequisite
  • vue-pinia - Auth state for guards
  • vue-nuxt - File-based routing alternative

Resources

Score

Total Score

60/100

Based on repository quality metrics

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

+10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

Reviews

💬

Reviews coming soon