newlifex/newlife.cube/cube-add-app
Claude Code and agent skill by newlifex/newlife.cube
Trust tier 2
- community
Source check pending
Checking that the SKILL.md file is still in the repository.
在 @newlifex/cube-vue 微前端架构中新增一个子应用/模块。 当用户说"新增应用"、"创建子应用"、"添加新模块"、"新建页面"、"创建新页面"时使用。 注意:新增的应用放在调用技能的目录(项目根目录 apps/),而不是 @newlifex/cube-vue 目录。
Install
npx vskill@latest install newlifex/newlife.cube/cube-add-appSKILL.md
@newlifex/cube-vue 新增应用
什么时候用
当用户需要新增一个子应用或新页面时使用。
最小步骤(新增应用只需4步)
- 新建测试页面:
{项目根目录}/apps/<app-name>/src/views/Test/index.vue - 导出路由:在
apps/<app-name>/src/routes.ts添加路由导出 - 新建 main.ts:
apps/<app-name>/src/main.ts,内容为export { default as routes } from './routes'; - 注册应用:在
{前端项目}/configs/microAppConfig.json添加配置
packageName 写法详解
microAppConfig.json 中的 packageName 字段支持多种写法,框架会根据前缀自动解析:
1. 本项目内置应用(推荐)
| packageName | 解析结果 | |
|---|---|---|
/apps/ioc | {root}/apps/ioc/src/main.ts | |
apps/ioc | {root}/apps/ioc/src/main.ts | |
./apps/ioc | {root}/apps/ioc/src/main.ts |
2. 外部包引用(@scope/name 格式)
| packageName | 包名 | 路径 | |
|---|---|---|---|
@newlifex/cube-vue | @newlifex/cube-vue | {root}/node_modules/@newlifex/cube-vue/src/main.ts | |
@newlifex/cube-vue/apps/cube-admin | @newlifex/cube-vue | {root}/node_modules/@newlifex/cube-vue/apps/cube-admin/src/main.ts |
3. 普通包名
会从 node_modules/some-lib/src/main.ts 加载。
4. 不写 packageName(使用内置应用)
| 场景 | 行为 | |
|---|---|---|
@newlifex/cube-vue 源码开发 | 自动加载 {root}/apps/{name}/src/main.ts | |
| 外部项目引用 @newlifex/cube-vue | 自动加载 node_modules/@newlifex/cube-vue/apps/{name}/src/main.ts |
💡 提示:使用@newlifex/cube-vue内置应用(如 cube-admin、cube-cube)时,可以不写packageName,框架会自动从包内加载。
完整配置示例
microAppConfig.json
| 字段 | 说明 | |
|---|---|---|
name | 应用唯一标识,用于内部路由和状态管理 | |
prefix | URL 前缀,访问路径为 /{prefix}/* | |
packageName | 包路径,支持多种格式(见上表) |
内置模板
1. 页面组件 (views/Test/index.vue)
2. 路由导出 (apps/<app-name>/src/routes.ts)
3. main.ts (apps/<app-name>/src/main.ts)
新增页面
在已有应用中新增页面只需2步:
- 创建页面:
apps/<app-name>/src/views/<Module>/index.vue - 注册路由:在
apps/<app-name>/src/routes.ts添加路由
常用工具
红线 / 禁止自行发挥
以下为历史踩坑固化的强制约束,落实时严格照办,禁止凭记忆或"想当然"自行发挥:
- 新增应用放在调用技能的项目根目录 `apps/`,不要放进
@newlifex/cube-vue框架目录——那是框架源码,会被覆盖/冲突。 - 区分「微应用」与「自动加载页面」两条路径,别混淆:
- 本技能(cube-add-app)创建的是微应用:需要
routes.ts+main.ts+ 在microAppConfig.json注册,页面路由手写; - 若只是给已有应用加一个普通 CRUD/看板页,应走
cube-add-page:页面按目录约定放好即被import.meta.glob自动加载,不需要routes.ts、不需要改microAppConfig.json。 - 不要把自动加载页面的场景错误地用本技能手写
routes.ts,也不要给微应用漏掉microAppConfig.json注册(漏注册 = 应用不可见)。
- `packageName` 写法严格按文档:内置应用可省略
packageName(框架自动从apps/{name}/src/main.ts加载);外部包用@newlifex/cube-vue/apps/xxx。不要臆造路径格式。 - 新增应用后必须重启 `pnpm dev`:虚拟模块在构建期生成,新增应用需重新构建才能被加载。
验证
- 重新启动应用:
pnpm dev,因为新增应用需要重新构建虚拟模块 - 访问测试路由:
/<app-name>/test - 页面验证:
- 页面正常渲染 → 成功
- 跳转到登录页 → 登录后重新访问
/<app-name>/test,确认页面正常显示
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingNewLife.Cube.Vue/skills/cube-add-app/SKILL.md
Popularity
- Repository stars
- 629
- Repository forks
- 167
- 7-day trend score
- 32
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 20 Jul 2026, 3 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/newlifex/newlife.cube/cube-add-app)