migrate-vue2
Skill4 starsChanged 10 days agoMITView on GitHub
Migrate a Vue 2 app to Vue 3 with the official @vue/compat migration build, step by step - move to Vue 2.7 and replace Vue 3-incompatible libraries first, switch the build to Vue 3 plus @vue/compat in MODE 2, fix compat warnings feature by feature (filters, v-model, $listeners, events API, async components, transitions), migrate Vuex to Pinia or Vuex 4 and Vue Router 3 to the current router, then remove the compat build. Use when asked to migrate or upgrade Vue 2, or when legacy/vue2-nuxt2 applies to a Vue 2 app (not Nuxt 2).
In this repository32 other files it gives its agents.
- llms.txtllms.txt
- cve-checkSkill
- dependency-vetSkill
- git-commitSkill
- incident-supply-chainSkill
- migrate-angularjsSkill
- migrate-class-to-hooksSkill
- migrate-cordovaSkill
- migrate-cra-to-viteSkill
- migrate-dotnet-frameworkSkill
- migrate-ingress-nginxSkill
- migrate-strutsSkill
- migrate-xamarinSkill
- secrets-scanSkill
- security-auditSkill
- threat-model-liteSkill
- upgrade-angularSkill
- upgrade-djangoSkill
- upgrade-dotnetSkill
- upgrade-expressSkill
- upgrade-jquerySkill
- upgrade-laravelSkill
- upgrade-nestjsSkill
- upgrade-nextjsSkill
- upgrade-nodeSkill
- upgrade-nuxtSkill
- upgrade-phpSkill
- upgrade-pythonSkill
- upgrade-railsSkill
- upgrade-react-nativeSkill
- upgrade-spring-bootSkill
- upgrade-supabaseSkill
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 4 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Very specific: line 20
Read vue, vue-template-compiler, vue-router, vuex, @vue/test-utils, the build tool (Vue CLI, webpack, Vite) and every Vue plugin and UI …
- Very specific: line 36
update vue-router to v4+ API (createRouter, createWebHistory) and Vuex to 4 (createStore) or Pinia.
- Very specific: line 46
Remove the compat build: when no warnings remain: drop the alias and @vue/compat, set MODE: 3 or remove compatConfig, and run everything …
- Distinctive: line 65
Never remove the compat build while warnings remain.
- Distinctive: line 66
Never upgrade a UI library major and Vue in the same step without telling the user.
- Distinctive: line 67
Never ship the full template compiler build to production after the migration.
- Distinctive: line 68
Never auto-commit, push or deploy.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Migrate Vue 2 → Vue 3
When to use
- The app runs Vue 2 (EOL 31 Dec 2023) and the user wants to move to Vue 3.
- For Nuxt 2 apps, use the Nuxt path in
legacy/vue2-nuxt2instead (Nuxt Bridge or a rebuild); this skill covers Vue apps built with Vite, Vue CLI or webpack.
Before you start
- Read
vue,vue-template-compiler,vue-router,vuex,@vue/test-utils, the build tool (Vue CLI, webpack, Vite) and every Vue plugin and UI library from the lockfile. - For each library, find a Vue 3 version or a replacement (for example Vuetify 2 → 3, BootstrapVue → a Vue 3 alternative,
vue-i18n8 → 9+). Libraries without a Vue 3 path are the main blockers; list them for the user. - Working tree clean; new branch (
chore/vue-3); a test suite and E2E smoke tests for main flows (add them first if missing). - Ask the user:
- whether to migrate the build tool (Vue CLI → Vite) in the same project, as a separate step before or after;
- Vuex → Pinia now, or Vuex 4 first;
- whether network installs are approved (
core/supply-chaincooldown applies).
Steps
- Baseline: install, lint, unit tests, E2E and a production build. Record failures.
- Move to Vue 2.7 (
vue@2.7), remove@vue/composition-apiif present, and fix deprecation warnings. 2.7 lets you start writing<script setup>and Composition API code that also works in Vue 3. - Remove patterns the compat build can't cover well while still on Vue 2: filters → methods or computed; event bus (
$on/$off/$once) → a tiny emitter (mitt) or Pinia;$children→ refs;.nativemodifiers → explicitemits; functional components with templates → plain components. - Switch to Vue 3 + compat build:
- install
vue@^3.5and@vue/compat@^3.5(same version) and@vue/compiler-sfc(removevue-template-compiler); - alias
vueto@vue/compatin the bundler and set the compiler'scompatConfig: { MODE: 2 }(Vite:resolve.aliasplus@vitejs/plugin-vuetemplate.compilerOptions.compatConfig; Vue CLI:chainWebpackalias andvue-loaderoptions); - update
vue-routerto v4+ API (createRouter,createWebHistory) and Vuex to 4 (createStore) or Pinia; - replace
new Vue({...})withcreateApp(App).use(router).use(store).mount('#app').
- install
- Run the app and fix compat warnings feature by feature. Each warning names a compat flag (for example
COMPONENT_V_MODEL,INSTANCE_LISTENERS,RENDER_FUNCTION,ATTR_FALSE_VALUE,TRANSITION_CLASSES). Fix the code, then disable that flag per component (compatConfig: { COMPONENT_V_MODEL: false }) or globally (configureCompat). Typical fixes:v-modelon components:value/input→modelValue/update:modelValue(ordefineModel);$listenersmerged into$attrs;inheritAttrsbehavior withclass/style;v-if/v-forprecedence changed;keyon<template v-for>;- async components →
defineAsyncComponent; - transition class renames (
v-enter→v-enter-from); - global API (
Vue.use,Vue.component,Vue.prototype) → app instance (app.use,app.component,app.config.globalProperties).
- Update tests:
@vue/test-utilsv2 (mountoptions changed:props,global.plugins,global.stubs). - Remove the compat build when no warnings remain: drop the alias and
@vue/compat, setMODE: 3or removecompatConfig, and run everything again. Then switch tofrontend/vue. - Show the diff and results at each step and wait for approval; commit only when asked (
git-commitskill).
Verify
npm ci
npm ls vue @vue/compat vue-router vuex pinia # one Vue version; @vue/compat gone at the end
npx vue-tsc --noEmit # TypeScript projects
npm run lint
npm test
npm run build
npm audit --audit-level=moderateThen run the E2E suite and click through the main flows with the browser console open: no compat warnings, no Vue warnings, forms and v-model bindings work, router navigation and guards behave as before.
Safety
- Never remove the compat build while warnings remain; never globally disable compat flags you haven't fixed.
- Never upgrade a UI library major and Vue in the same step without telling the user; keep each step reviewable.
- Never ship the full template compiler build to production after the migration.
- Never auto-commit, push or deploy; don't hand-edit the lockfile.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

