Agent skill

Mpx Mode Migration

by didi in didi/mpx

审计存量 Mpx 项目迁移到“mode 只负责目标筛选、srcMode 只负责源码方言”的新版编译语义。只要用户提到升级 Mpx 后检查条件编译、排查 .ali/.swan 等条件文件、mode/src-mode 区块、@mode/@mode、modeRules/srcModeRules 或外部模板迁移,就应使用本 Skill;不用于与该语义变更无关的普通 Mpx 升级。

Apache-2.0Auto-check passedDevelopment

Install Mpx Mode Migration

skills CLI
$ npx skills add didi/mpx --skill mpx-mode-migration -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install didi/mpx mpx-mode-migration --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/didi/mpx.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/mpx-mode-migration .claude/skills/mpx-mode-migration && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
mpx-mode-migration
GitHub stars
3.9k
Token cost
~731 tokens
SKILL.md length
175 words
Files
6 (incl. scripts, references)
Skills in repo
7
Repo updated
First seen
Licence
Apache-2.0

At a glance

审计存量 Mpx 项目迁移到“mode 只负责目标筛选、srcMode 只负责源码方言”的新版编译语义。只要用户提到升级 Mpx 后检查条件编译、排查 .ali/.swan 等条件文件、mode/src-mode 区块、@mode/@mode、modeRules/srcModeRules 或外部模板迁移,就应使用本 Skill;不用于与该语义变更无关的普通 Mpx 升级。

  • Works in 5 steps: 确定项目和目标 → 运行确定性扫描 → 按规则逐项核实 → …
  • Development work in your project
  • SKILL.md covers 目标, 工作流, 报告格式 and 扫描器限制
  • Runs JavaScript scripts from its folder; calls node

What it does

Mpx Mode Migration is an agent skill from didi/mpx. 审计存量 Mpx 项目迁移到“mode 只负责目标筛选、srcMode 只负责源码方言”的新版编译语义。只要用户提到升级 Mpx 后检查条件编译、排查 .ali/.swan 等条件文件、mode/src-mode 区块、@mode/@mode、modeRules/srcModeRules 或外部模板迁移,就应使用本 Skill;不用于与该语义变更无关的普通 Mpx 升级。

Its SKILL.md is about 730 tokens, which your agent loads only when the skill is triggered. The skill folder holds 8 other files, including scripts and reference files (for example `evals/evals.json`, `references/migration-rules.md` and `scripts/resolve-platform.js`). Compatibility notes: 需要 Node.js 14+;扫描脚本只读取目标项目,不会自动修改业务文件。

It sits in Development. It works with webpack and WeChat. The repository describes itself as: Mpx,一款具有优秀开发体验和深度性能优化的增强型跨端小程序框架. The licence is Apache-2.0.

When your agent uses it

  • Development work in your project

Example prompts

  • “mode 只负责目标筛选、srcMode 只负责源码方言”
  • “/mpx-mode-migration”

Requirements

  • Node.js
  • Compatibility (from SKILL.md): 需要 Node.js 14+;扫描脚本只读取目标项目,不会自动修改业务文件。

Workflow steps

5 steps, taken from the step headings in SKILL.md.

  1. 确定项目和目标
  2. 运行确定性扫描
  3. 按规则逐项核实
  4. 给出最小迁移建议
  5. 验证

What it can do on your machine

Read from SKILL.md and the folder at commit e2a7612. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 3 files in scripts/ (JavaScript), which the agent can run.

    Shell commands in SKILL.md call:

    • node

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

  • Compatibility

    需要 Node.js 14+;扫描脚本只读取目标项目,不会自动修改业务文件。

    From compatibility in the SKILL.md frontmatter.

Context cost

Mpx Mode Migration loads about 731 tokens when it runs, and up to ~2.8k if it reads all its reference files. Until then it costs about 52 tokens; SKILL.md has 175 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~52
When it runs · the whole SKILL.md, loaded when a task matches
~731
With references · SKILL.md plus every file in references/, read only if the agent opens them
~2.8k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from didi/mpx at commit e2a7612, republished under its Apache-2.0 licence (© didi). 175 words, ~731 tokens.

Download SKILL.mdSave it as .claude/skills/mpx-mode-migration/SKILL.md (or your agent's skills folder). This skill also uses 5 other files; get the full folder from GitHub.
name
mpx-mode-migration
description
审计存量 Mpx 项目迁移到“mode 只负责目标筛选、srcMode 只负责源码方言”的新版编译语义。只要用户提到升级 Mpx 后检查条件编译、排查 .ali/.swan 等条件文件、mode/src-mode 区块、@mode/@_mode、modeRules/srcModeRules 或外部模板迁移,就应使用本 Skill;不用于与该语义变更无关的普通 Mpx 升级。
compatibility
需要 Node.js 14+;扫描脚本只读取目标项目,不会自动修改业务文件。

Mpx mode/srcMode 升级迁移审计

目标

找出存量项目中依赖旧版隐式源码方言语义的位置,并把每一处候选项核实为:

  • 必须修改:升级后会冲突或明确依赖旧语义;
  • 需要确认:编译路径改变,需结合源码或目标产物判断;
  • 兼容清理:旧写法仍兼容,但建议迁移到新名称或新语法;
  • 无需修改:命中扫描规则,但实际不依赖旧语义。

默认只输出审计报告。用户明确要求实施迁移时,才修改目标项目。

工作流

1. 确定项目和目标
  1. 将用户指定目录作为项目根目录;未指定时使用当前工作目录。
  2. 读取目标项目的 AGENTS.md、构建配置、package.json 和相关迁移约束。
  3. 确认项目 srcMode、实际构建 targets,以及是否使用 Web/RN。不要只根据文件名猜测构建目标。
2. 运行确定性扫描

使用本 Skill 自带脚本:

bash
node <skill-root>/scripts/scan-project.js <project-root> --json

需要便于人工阅读时去掉 --json:

bash
node <skill-root>/scripts/scan-project.js <project-root>

扫描器不会解析或执行 webpack 配置,也不会自动判断某个 include 是否覆盖具体资源。因此,扫描结果只是高召回候选集,必须继续执行下一步核实。

3. 按规则逐项核实

读取 迁移规则与判定矩阵,然后对每条候选项:

  1. 打开完整文件或 SFC 区块,不要只看命中行。
  2. 判断内容采用项目 srcMode 语法,还是目标平台原生语法。
  3. 检查资源是否已经被有效的 srcModeRules.<target> 覆盖;不要仅凭配置中出现了该 key 就判定已覆盖。
  4. 模板包含 <import> / <include> 时,继续解析相对路径并检查被引用资源;它们不继承引用方 srcMode。
  5. 显式 @mode 命中后会进入正常平台转换。逐项确认节点、属性名及属性值采用项目 srcMode 语法,还是目标平台原生语法,并以目标项目实际安装的 @mpxjs/webpack-plugin/lib/platform 实现核对是否命中转换规则。使用本 Skill 的 scripts/resolve-platform.js <project-root> 定位规则目录,不要直接解析包内 package.json 或依赖当前工作目录。读取 lib/platform/index.js 确定 type + srcMode 对应的规则集,再检查具体规则的 test 与目标 mode 处理器;两者同时存在才算实际命中。项目 srcMode 语法通常无需迁移;目标平台原生语法未实际命中规则时可安全直通并归入“无需修改”。只有规则会重命名、改值、删除或诊断该语法时,才优先建议改成项目 srcMode 的等价写法;没有等价写法时改用完整原生区块/资源。报告中记录插件安装版本、命中的规则文件及行号。
  6. RN 候选项涉及组件、事件或样式能力时,结合仓库的 mpx2rn Skill 核对支持范围,不要用 RN 原生能力替代 Mpx2RN 能力事实。
4. 给出最小迁移建议

按以下优先级选择方案:

  1. 优先把内容改成项目 srcMode 语法,让框架正常转换。
  2. 完整目标平台原生 SFC 区块增加 src-mode="<target>"。
  3. 完整目标平台原生文件或独立模板通过 srcModeRules.<target> 精确覆盖。
  4. 旧 modeRules 可兼容,但建议改名为 srcModeRules;两者不能同时配置。
  5. @_mode 与 @mode 行为一致,替换属于兼容清理,不是阻塞升级的必改项。

不要为了消除报告而给整个 src/ 配置宽泛的 srcModeRules。规则过宽会让本应转换的 Mpx 源码被当成目标平台原生源码。

对 @mode 不要仅凭“目标平台原生写法”要求迁移,也不要根据其他版本的源码或记忆推断规则。以目标项目安装版本的 lib/platform 为准;没有实际命中时允许安全直通,不拦截也不建议改写。

5. 验证

若用户要求实际修改:

  1. 先为确认需要迁移的路径补核心回归用例。
  2. 分目标平台执行相关编译,重点检查模板事件/指令、JSON 转换和运行时选项转换。
  3. RN 页面或组件同时按 mpx2rn Skill 的编译校验流程验证。
  4. 执行目标项目要求的 ESLint 与 Jest。
  5. 对比迁移前预期和迁移后产物,不以“能编译”代替行为验证。

报告格式

使用以下结构,并给每条结论附可点击的文件与行号:

markdown
# Mpx mode/srcMode 迁移审计

## 摘要
- 必须修改:N
- 需要确认:N
- 兼容清理:N
- 无需修改:N

## 必须修改
### [规则码] path/to/file:line
- 旧语义依赖:
- 升级后行为:
- 迁移建议:
- 验证方式:

## 需要确认
...

## 兼容清理
...

## 无需修改
...

## 验证清单
...

如果没有必改项,明确写出“未发现确定需要修改的位置”,同时保留仍需确认的候选项和未执行的构建目标。

扫描器限制

  • 正则扫描无法可靠理解通过变量、函数或多文件合并生成的 webpack 配置。
  • srcModeRules 的 include/exclude 最终覆盖范围需要按 webpack rule 语义人工核实。
  • 目标平台原生语法可能与项目 srcMode 语法同名,不能只凭一个属性名自动判定。
  • 动态生成的模板、loader 虚拟模块和构建期代码生成结果不在静态扫描范围内。

© didi, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 5 other files (scripts, references) in .agents/skills/mpx-mode-migration of didi/mpx.

  • SKILL.md
  • evals/evals.json
  • references/migration-rules.md
  • scripts/resolve-platform.js
  • scripts/scan-project.js
  • scripts/test-scan-project.js

Open the folder on GitHubat commit e2a7612

Compare with similar skills

Mpx Mode Migration next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Mpx Mode Migration compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Mpx Mode Migration this skilldidi/mpx3.9k—~731Automated safety check: PassApache-2.0
Releasing Php Packageyansongda/pay5.4k—~1.6kAutomated safety check: PassMIT
React Joyridecadence-workflow/cadence-web435—~3.9kAutomated safety check: PassMIT
Runtime DebugOpenHikmah/openhikmah-web181—~618Automated safety check: PassGPL-3.0
ReleaseOvenMediaLabs/OvenPlayer592—~1.3kAutomated safety check: PassMIT
WxJava Upgrade Guidebinarywang/WxJava33k—~129Automated safety check: PassApache-2.0

Similar skills

  • A skill your agent uses when preparing to publish a new version of a PHP Composer package and need to write or update CHANGELOG, upgrade guides, and documentation before tagging and releasing

    5.4k GitHub stars~1.6k tokensUpdated 9 days ago
    DevelopmentAuto-check passed
  • React Joyride

    cadence-workflow/cadence-web

    Guide for implementing, configuring, and debugging React Joyride v3 guided tours.

    435 GitHub stars~3.9k tokensUpdated today
    DevelopmentAuto-check passed
  • Runtime Debug

    OpenHikmah/openhikmah-web

    Debug and verification workflow for runtime-bundle and module-resolution regressions.

    181 GitHub stars~618 tokensUpdated today
    DevelopmentAuto-check passed
  • Release

    OvenMediaLabs/OvenPlayer

    Release ovenplayer to npm — confirm the version, verify the committed dist/ bundle is current, write the release notes, and open a draft GitHub Release for the user to publish.

    592 GitHub stars~1.3k tokensUpdated 24 days ago
    DevelopmentAuto-check passed
  • WxJava Upgrade Guide

    binarywang/WxJava

    Plans a WxJava version upgrade, checking the BOM, module dependencies, JDK version and configuration, with phased steps and clear rollback conditions.

    33k GitHub stars~129 tokensUpdated 11 days ago
    DevelopmentAuto-check passed
  • Markstream Vue2

    Simon-He95/markstream-vue

    Integrate markstream-vue2 into a Vue 2.6 or 2.7 app. An agent skill from Simon-He95/markstream-vue.

    3k GitHub starsUsed in 1 repo~733 tokens
    DevelopmentAuto-check passed

More from didi/mpx

  • Mpx2rn

    didi/mpx

    Mpx 跨端输出 RN(简称 Mpx2RN 或 Mpx2DRN)的开发适配指南,覆盖模板、脚本、样式、JSON 配置四大维度。当用户进行 Mpx2RN 相关任务时强制调用,包括但不限于:技术方案设计、页面 / 组件的开发迭代、旧项目跨端适配改造、编译和运行时报错排查、Code Review 等。当用户问题不涉及 Mpx2RN 时不应调用,如 Mpx 小程序开发问题,RN…

    3.9k GitHub stars~3.7k tokensUpdated 8 days ago
    Auto-check passed
  • Mpx 跨端输出 RN(简称 Mpx2RN 或 Mpx2DRN)的开发适配指南,覆盖模板、脚本、样式、JSON 配置四大维度。当用户进行 Mpx2RN 相关任务时强制调用,包括但不限于:技术方案设计、页面 / 组件的开发迭代、旧项目跨端适配改造、编译和运行时报错排查、Code Review 等。当用户问题不涉及 Mpx2RN 时不应调用,如 Mpx 小程序开发问题,RN…

    3.9k GitHub stars~1k tokensUpdated 8 days ago
    Auto-check passed
  • Review Loop

    didi/mpx

    当用户要求评审循环、自评审工作流、planner/reviewer/coder/code-reviewer 协作、先方案后编码、多轮 Agent 评审,或要求稳定的子 Agent 工作流依次产出方案、等待用户确认、实现代码、评审差异并保留修订记录时,使用此 Skill。此 Skill 必须使用真实子 Agent,不得退化为单 Agent 角色扮演。

    3.9k GitHub stars~828 tokensUpdated 8 days ago
    Auto-check passed
  • 通过查看当前最新版本与上一版本间的git提交记录与代码变更,生成版本变更日志,当用户询问“创建/生成变更日志”、“创建/生成changelog”时使用。

    3.9k GitHub stars~640 tokensUpdated 8 days ago
    Auto-check passed
  • Helps when network-related commands (like curl, git, npm, pip, brew) are failing, timing out, or running slowly due to network issues.

    3.9k GitHub stars~464 tokensUpdated 8 days ago
    Auto-check passed
  • Skill2gene

    didi/mpx

    将传统文档导向的 Procedural Skill 转换为紧凑的 Strategy Gene 格式。基于论文 "From Procedural Skills to Strategy Genes" 的 Gene Evolution Protocol (GEP),将 ~2500 token 的文档型 Skill 蒸馏为 ~200-300 token 的控制型 Gene 集合。当用户要求将…

    3.9k GitHub stars~558 tokensUpdated 8 days ago
    Auto-check passed

Works with

Categories

Questions about Mpx Mode Migration

What does Mpx Mode Migration do?

审计存量 Mpx 项目迁移到“mode 只负责目标筛选、srcMode 只负责源码方言”的新版编译语义。只要用户提到升级 Mpx 后检查条件编译、排查 .ali/.swan 等条件文件、mode/src-mode 区块、@mode/@mode、modeRules/srcModeRules 或外部模板迁移,就应使用本 Skill;不用于与该语义变更无关的普通 Mpx 升级。. Mpx Mode Migration is an agent skill from didi/mpx.

When should I use Mpx Mode Migration?

Mpx Mode Migration fits situations like: development work in your project.

How do I install Mpx Mode Migration in Claude Code?

Run `npx skills add didi/mpx --skill mpx-mode-migration -a claude-code`. Or copy the skill folder (.agents/skills/mpx-mode-migration in didi/mpx) into .claude/skills/mpx-mode-migration in your project. Claude Code loads it when a task matches its description.

How do I install Mpx Mode Migration in Codex?

Run `npx skills add didi/mpx --skill mpx-mode-migration -a codex`. Or copy the skill folder (.agents/skills/mpx-mode-migration in didi/mpx) into .agents/skills/mpx-mode-migration in your project. Codex loads it when a task matches its description.

Can I use Mpx Mode Migration in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add didi/mpx --skill mpx-mode-migration -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/mpx-mode-migration, .gemini/skills/mpx-mode-migration, .github/skills/mpx-mode-migration and .opencode/skills/mpx-mode-migration in your project.

What does Mpx Mode Migration need to run?

Going by SKILL.md and its folder, Mpx Mode Migration needs JavaScript for the scripts in its folder and the command-line tools its instructions call (node). Our summary lists: Node.js. Compatibility (from SKILL.md): 需要 Node.js 14+;扫描脚本只读取目标项目,不会自动修改业务文件。.

Does Mpx Mode Migration access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Mpx Mode Migration safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Mpx Mode Migration use?

Mpx Mode Migration is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Mpx Mode Migration use?

About 731 tokens (SKILL.md is roughly 2.9k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 2.1k tokens, read only when the agent opens those files.

What are the alternatives to Mpx Mode Migration?

Skills that share tags, products or a category with Mpx Mode Migration: Releasing Php Package (yansongda/pay, 5.4k stars), React Joyride (cadence-workflow/cadence-web, 435 stars), Runtime Debug (OpenHikmah/openhikmah-web, 181 stars) and Release (OvenMediaLabs/OvenPlayer, 592 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Mpx Mode Migration?

didi (a GitHub organization) maintains it in didi/mpx, which has 3,941 GitHub stars. The repository holds 7 skills in this directory. The repository was last updated on September 29, 2026.

Source: didi/mpx on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.