
vue-router-skilld
ALWAYS use when writing code that imports "vue-router", "vue-router/vite", "vue-router/auto-routes", or "vue-router/experimental". Consult for debugging, best practices, or modifying vue-router, vue router, router, file-based routing, typed routes, data loaders.
- Installs
- 289
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/skilld-dev/vue-ecosystem-skills --skill vue-router-skilld- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads vue-router-skilld automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
vuejs/router vue-router@5.3.1
Prepared source: vue-router@5.3.1, ESM package ("type": "module", package.json:2,20).
Peers: vue ^3.5.34 || ^4.0.0; optional vite ^7.3.0 || ^8.0.0, pinia ^3.0.4 || ^4.0.2, @pinia/colada >=0.21.2 (package.json:173-193).
Docs: https://router.vuejs.org
Import map
| Import | Use for |
|---|---|
vue-router | createRouter, createWebHistory, createWebHashHistory, createMemoryHistory, RouterLink, RouterView, useRouter, useRoute, useLink, onBeforeRouteLeave, onBeforeRouteUpdate, isNavigationFailure, NavigationFailureType, START_LOCATION, parseQuery, stringifyQuery (dist/vue-router.d.ts:6) |
vue-router/vite | Vite plugin, file-based routing (package.json:104) |
vue-router/unplugin/{vite,webpack,rollup,esbuild,rolldown} | same plugin for other bundlers (dist/unplugin/) |
vue-router/unplugin | VueRouterAutoImports, createRoutesContext, EditableTreeNode, plugin Options (dist/unplugin/index.d.mts:62) |
vue-router/auto-routes | generated routes array + handleHotUpdate(router) (vue-router-auto-routes.d.mts:6,28) |
vue-router/auto-resolver | generated resolver for experimental_createRouter + handleHotUpdate (vue-router-auto-resolver.d.mts:15,21) |
vue-router/experimental | data loaders, reroute, miss, definePage, defineParamParser, PARAM_PARSER_INT/PARAM_PARSER_BOOL, experimental_createRouter, useIsDataLoading (dist/experimental/index.d.ts:7) |
vue-router/experimental/pinia-colada | defineColadaLoader (package.json:77) |
vue-router/volar/sfc-route-blocks, vue-router/volar/sfc-typed-router | Volar plugins: <route> blocks, per-file typed useRoute() (package.json:115-121) |
Avoid:
vue-router/auto— deprecated, will be removed (vue-router-auto.d.ts:1).vue-router/experimentalin CJS builds — ESM-only since v5.1.0 (https://github.com/vuejs/router/releases/tag/v5.1.0).
Quick start (classic routes)
import { createRouter, createWebHistory } from 'vue-router'
const router = createRouter({
history: createWebHistory(),
routes: [
{ path: '/', component: () => import('./pages/Home.vue') },
{ path: '/users/:id', component: () => import('./pages/User.vue'), props: true },
],
})
app.use(router)
In components: useRoute() / useRouter() from vue-router; <RouterLink to="..."> and <RouterView> are globally registered by app.use(router).
Quick start (file-based routing)
// vite.config.ts
import VueRouter from 'vue-router/vite'
import Vue from '@vitejs/plugin-vue'
export default defineConfig({
plugins: [VueRouter(), Vue()], // Vue plugin MUST come after VueRouter
})
import { createRouter, createWebHistory } from 'vue-router'
import { routes, handleHotUpdate } from 'vue-router/auto-routes'
const router = createRouter({ history: createWebHistory(), routes })
if (import.meta.hot) handleHotUpdate(router)
Pages live in src/pages by default. Start the dev server once to generate typed-router.d.ts, add it to tsconfig.json include with "moduleResolution": "Bundler". Details, naming conventions, and plugin options: references/file-based-routing.md.
Core rules
- Return values from navigation guards, never call
next().nextis deprecated (runtime warning since v5.0.3) and will be removed (dist/index-D7ja2BKs.d.ts:362-393, https://github.com/vuejs/router/releases/tag/v5.0.3).router.beforeEach(to => { if (to.meta.requiresAuth && !isAuthenticated) return { name: 'login' } // return nothing, true, false, or a route location }) - In data loaders, redirect with
reroute(to);new NavigationResult(to)is deprecated and logs a warning (dist/experimental/index.js:1106-1111). router.currentRouteis aShallowRef<RouteLocationNormalizedLoaded>— read it asrouter.currentRoute.value(dist/index-D7ja2BKs.d.ts:1433).router.onReady()does not exist (removed in v4); useawait router.isReady().scrollBehaviorreturns{ top, left }(v4 renamedx/ytoleft/top).- Detect failed navigations:
const failure = await router.push(...); check withisNavigationFailure(failure, NavigationFailureType.aborted). route.metamerges non-recursively from all matched records; readto.meta.requiresAuthdirectly instead of scanningto.matched. TypemetaviaRouteMetamodule augmentation.- Use
router.beforeResolve(notbeforeEach) for work that needs async components resolved. - Use
inject()inside guards to reach Pinia stores (supported since Vue 3.3). - Decouple components from the router with route
props: trueorprops: route => ({ ... }); pass query values this way to keep components testable. - Watch narrow sources (
() => route.params.id), never the wholerouteobject.
Full core API notes: references/core-api.md.
Typed routes
Enable by using the file-based routing plugin (types are generated automatically), or augment manually:
declare module 'vue-router' {
interface TypesConfig {
RouteNamedMap: RouteNamedMap
}
}
Typed push('/users/:id', { params: { id: 42 } }), typed useRoute(), per-file typing via Volar plugin vue-router/volar/sfc-typed-router. Param parsers (int, bool, custom in src/params/) give typed, validated params; definePage({ params: { query: { page: { parser: 'int', default: 1 } } } }) declares query params. Details: references/typed-routes.md.
Data loaders (experimental)
// src/pages/users/[id].vue
import { defineBasicLoader } from 'vue-router/experimental'
import { reroute } from 'vue-router/experimental'
export const useUserData = defineBasicLoader(async (to) => {
if (!to.params.id) reroute('/') // reroute throws: stops the loader immediately
return fetchUser(to.params.id)
})
Install DataLoaderPlugin before the router: app.use(DataLoaderPlugin, { router }). Non-blocking loaders: defineBasicLoader(loader, { lazy: true }); errors then land in error, not in router.onError. Details: references/data-loaders.md.
Version notes (5.0.x → 5.3.1)
- v5.0.7:
RouteNamedMapis wired through the generatedtyped-router.d.ts(https://github.com/vuejs/router/releases/tag/v5.0.7); param parser folders gainedinclude/exclude. - v5.1.0: typed
definePageparams.path,defineParamParserRaw, strict default typing,TypesConfigglobalRouteroverride, experimental export is ESM-only (https://github.com/vuejs/router/releases/tag/v5.1.0). - v5.2.0: added diagnostics for common mistakes; allows pinia 4 (https://github.com/vuejs/router/releases/tag/v5.2.0).
- v5.3.0: scroll skips when
history.scrollRestorationsays so; duplicatedefinePage()reported instead of crashing;EditableTreeNode.nameacceptsfalseto unset (https://github.com/vuejs/router/releases/tag/v5.3.0). - v5.3.1: fixes
isActivewith non-string params (https://github.com/vuejs/router/releases/tag/v5.3.1).
Migration from v3/v4, or from unplugin-vue-router: references/migration.md.
References
- core-api.md — router creation, histories, guards, failures, scroll, RouterLink/RouterView.
- file-based-routing.md — plugin setup, file naming,
definePage,<route>blocks,extendRoute, options. - typed-routes.md —
TypesConfig, generated types, param parsers,experimental_createRouter. - data-loaders.md —
defineBasicLoader,defineColadaLoader,reroute, lazy loaders, SSR notes. - migration.md — v3→v4 and v4→v5 changes, deprecations in the v5 line.
FAQ
What does the vue-router-skilld skill do?
ALWAYS use when writing code that imports "vue-router", "vue-router/vite", "vue-router/auto-routes", or "vue-router/experimental". Consult for debugging, best practices, or modifying vue-router, vue router, router, file-based routing, typed routes, data loaders.
How do I install vue-router-skilld?
Run npx skills add https://github.com/skilld-dev/vue-ecosystem-skills --skill vue-router-skilld in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/vue-router-skilld/ (personal) or .claude/skills/vue-router-skilld/ (project).
Which AI agents can use vue-router-skilld?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is vue-router-skilld safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains vue-router-skilld?
It is published by skilld-dev in skilld-dev/vue-ecosystem-skills. It has 289 recorded installs.
More from skilld-dev/vue-ecosystem-skills
quasar-skilld
skilld-dev/vue-ecosystem-skills
Build, configure, and debug apps with the Quasar framework (quasar npm package, v2.33.1). Use when writing, reviewing, or debugging code that imports "quasar" or "quasar/wrappers", configuring Quasar with Vite, Vitest, Storybook, UMD, or Quasar CLI, styling with Quasar Sass variables, or upgrading between Quasar v2 releases.
vue-i18n-skilld
skilld-dev/vue-ecosystem-skills
Use when writing or debugging code that imports vue-i18n (Vue 3 internationalization). Covers createI18n, useI18n, message syntax, i18n-t/i18n-n/i18n-d components, pluralization, datetime and number formatting, TypeScript schemas, lazy loading, bundle optimization, and v10/v11/v12 migration.
vue-skilld
skilld-dev/vue-ecosystem-skills
Build, debug, and modernize UI with Vue 3.6. Use when editing .vue files, writing components or composables, or working with code that imports "vue". Covers script setup, reactivity, Vapor Mode, SSR, and version-specific API changes from 3.4 through 3.6.0-beta.17.
vuetify-skilld
skilld-dev/vue-ecosystem-skills
Vue Material Component Framework. Use when writing, debugging, or configuring code that imports vuetify v4.x. Covers createVuetify setup, components and labs, composables, theming, icons, dates and locale, styles and SASS variables, treeshaking, and v3 to v4 migration.
pinia-skilld
skilld-dev/vue-ecosystem-skills
Use when writing, debugging, or refactoring code that imports "pinia", the Vue 3 store library. Covers pinia 4.x: option and setup stores, state, getters, actions, subscriptions, plugins, SSR hydration, testing, Options API map helpers, and v4 nostics diagnostics. Provides version-correct API usage and migration notes from v2 and v3.
pinia-colada-skilld
skilld-dev/vue-ecosystem-skills
Data fetching layer for Vue built on Pinia. Use when writing, debugging, or reviewing code that imports @pinia/colada (pinia colada), including useQuery, useMutation, useInfiniteQuery, defineQuery, query cache invalidation, optimistic updates, plugins, SSR, or migrating from older versions. Provides current 1.4.x APIs, patterns, and migration rules.
Popular frontend & design skills
setup-matt-pocock-skills
mattpocock/skills
Configure this repo for the engineering skills: set up its issue tracker, triage label vocabulary, and domain doc layout. Run once before first use of the other engineering skills.
frontend-design
anthropics/skills
Guidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.
hyperframes-animation
heygen-com/hyperframes
All animation knowledge for HyperFrames — atomic motion rules, multi-phase scene blueprints, scene transitions, broader motion-design techniques, AND the seven runtime adapters (GSAP default, plus Lottie, Three.js, Anime.js, CSS keyframes, Web Animations API, TypeGPU). Use for any motion or animation task: pick 2-4 rules and compose, or load a blueprint, or look up runtime-specific API (e.g. GSAP eases / Lottie player / Three.js mixer). Also covers auditing an existing composition's choreography (animation map) and 24 named text-animation effects. HyperFrames-native: single paused timeline, seek-safe, deterministic.
prototype
mattpocock/skills
Build a throwaway prototype to answer a design question. Use when the user wants to sanity-check whether a state model or logic feels right, or explore what a UI should look like.
hyperframes-core
heygen-com/hyperframes
The HyperFrames composition contract — build one renderable project. Use for composition structure, the data- timing attributes, class="clip", tracks, sub-compositions, variables, framework-owned media playback, deterministic-render rules, and validation. Read before writing composition HTML.
vercel-react-best-practices
vercel-labs/agent-skills
React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.