Standalone Install Note
If this environment only installed the current skill, start from the CloudBase main entry and use the published cloudbase/references/... paths for sibling skills.
- - CloudBase main entry: INLINECODE1
- Current skill raw source: INLINECODE2
Keep local references/... paths for files that ship with the current skill directory. When this file points to a sibling skill such as auth-tool or web-development, use the standalone fallback URL shown next to that reference.
Activation Contract
Use this first when
- - The request is about WeChat Mini Program structure, pages, preview, publishing, or CloudBase mini program integration.
Read before writing code if
- - The user mentions
wx.cloud, CloudBase mini programs, OPENID, or mini program deployment/debug workflows.
Then also read
- - CloudBase auth ->
../auth-wechat/SKILL.md (standalone fallback: https://cnb.cool/tencent/cloud/cloudbase/cloudbase-skills/-/git/raw/main/skills/cloudbase/references/auth-wechat/SKILL.md) - CloudBase document DB ->
../no-sql-wx-mp-sdk/SKILL.md (standalone fallback: https://cnb.cool/tencent/cloud/cloudbase/cloudbase-skills/-/git/raw/main/skills/cloudbase/references/no-sql-wx-mp-sdk/SKILL.md) - UI generation ->
../ui-design/SKILL.md (standalone fallback: https://cnb.cool/tencent/cloud/cloudbase/cloudbase-skills/-/git/raw/main/skills/cloudbase/references/ui-design/SKILL.md) first
Do NOT use for
- - Web auth flows or Web SDK-specific frontend implementation.
Common mistakes / gotchas
- - Generating a Web-style login flow for mini programs.
- Mixing Web SDK assumptions into
wx.cloud projects. - Applying CloudBase constraints before confirming the project actually uses CloudBase.
When to use this skill
Use this skill for WeChat Mini Program development when you need to:
- - Build or modify mini program pages and components
- Organize mini program project structure and configuration
- Debug, preview, or publish mini program projects
- Work with WeChat Developer Tools workflows
- Handle mini program runtime behavior, assets, or page config files
- Integrate CloudBase in a mini program project when explicitly needed
Do NOT use for:
- - Web frontend development (use
web-development) - Pure backend service development (use
cloudrun-development or cloud-functions as appropriate) - UI design-only tasks without mini program development context (use
ui-design)
How to use this skill (for a coding agent)
- 1. Start with the general mini program workflow
- Treat WeChat Mini Program development as the default scope
- Do not assume the project uses CloudBase unless the user or codebase indicates it
- 2. Follow mini program project conventions
- Keep mini program source under the configured mini program root
- Ensure page files include the required configuration file such as
index.json
- Check
project.config.json before suggesting preview or IDE workflows
- 3. Route by scenario
- If the task involves CloudBase,
wx.cloud, cloud functions, CloudBase database/storage, or CloudBase identity handling, read
CloudBase integration reference
- If the task involves debugging, previewing, publishing, WeChat Developer Tools, or no-DevTools workflows, read
debug and preview reference
- 4. Use CloudBase rules only when applicable
- CloudBase is an important mini program integration path, but not a universal requirement
- Only apply CloudBase-specific auth, database, storage, or cloud function constraints when the project is using CloudBase
- 5. Recommend the right preview/debug path
- Prefer WeChat Developer Tools for simulator, panel-based debugging, preview, and real-device validation
- If WeChat Developer Tools is unavailable, use
miniprogram-ci for preview, upload, and npm build workflows where appropriate
WeChat Mini Program Development Rules
General Project Rules
- 1. Project Structure
- Mini program code should follow the project root configured in
project.config.json
- Keep page-level files complete, including
.json configuration files
- Ensure referenced local assets actually exist to avoid compile failures
- 2. Configuration Checks
- Check
project.config.json before opening, previewing, or publishing a project
- Confirm
appid is available when a real preview, upload, or WeChat Developer Tools workflow is required
- Confirm
miniprogramRoot and related path settings are correct
- 3. Resource Handling
- When generating local asset references such as icons, ensure the files are downloaded into the project
- Keep file paths stable and consistent with mini program config files
CloudBase as a Mini Program Sub-Scenario
- - If the user explicitly uses CloudBase,
wx.cloud, Tencent CloudBase, 腾讯云开发, or 云开发, follow the CloudBase integration reference - In CloudBase mini program projects, use
wx.cloud APIs and CloudBase environment configuration appropriately - Do not apply CloudBase-specific rules to non-CloudBase mini program projects
Debugging, Preview, and Publishing
- - If WeChat Developer Tools is available, use it as the primary path for simulator debugging, panel inspection, preview, and device validation
- If WeChat Developer Tools is not available, use
miniprogram-ci as the fallback path for preview, upload, and npm build-related automation - For detailed workflows, read debug and preview reference
Minimal project skeleton
INLINECODE30
CODEBLOCK0
INLINECODE31
CODEBLOCK1
INLINECODE32
CODEBLOCK2
INLINECODE33
CODEBLOCK3
INLINECODE34
CODEBLOCK4
References
独立安装说明
如果当前环境仅安装了本技能,请从CloudBase主入口开始,并使用已发布的cloudbase/references/...路径来引用同级技能。
- - CloudBase主入口:https://cnb.cool/tencent/cloud/cloudbase/cloudbase-skills/-/git/raw/main/skills/cloudbase/SKILL.md
- 当前技能原始源码:https://cnb.cool/tencent/cloud/cloudbase/cloudbase-skills/-/git/raw/main/skills/cloudbase/references/miniprogram-development/SKILL.md
对于随当前技能目录提供的文件,请保留本地的references/...路径。当本文件指向同级技能(如auth-tool或web-development)时,请使用该引用旁显示的独立回退URL。
激活契约
首先使用此技能的情况
- - 请求涉及微信小程序结构、页面、预览、发布或CloudBase小程序集成。
在编写代码前需阅读的情况
- - 用户提及wx.cloud、CloudBase小程序、OPENID或小程序部署/调试工作流。
还需阅读的内容
- - CloudBase认证 -> ../auth-wechat/SKILL.md(独立回退:https://cnb.cool/tencent/cloud/cloudbase/cloudbase-skills/-/git/raw/main/skills/cloudbase/references/auth-wechat/SKILL.md)
- CloudBase文档数据库 -> ../no-sql-wx-mp-sdk/SKILL.md(独立回退:https://cnb.cool/tencent/cloud/cloudbase/cloudbase-skills/-/git/raw/main/skills/cloudbase/references/no-sql-wx-mp-sdk/SKILL.md)
- UI生成 -> 首先阅读../ui-design/SKILL.md(独立回退:https://cnb.cool/tencent/cloud/cloudbase/cloudbase-skills/-/git/raw/main/skills/cloudbase/references/ui-design/SKILL.md)
禁止使用的情况
- - Web认证流程或Web SDK特定的前端实现。
常见错误/注意事项
- - 为小程序生成Web风格的登录流程。
- 将Web SDK的假设混入wx.cloud项目。
- 在确认项目实际使用CloudBase之前应用CloudBase约束。
何时使用此技能
在以下情况下,使用此技能进行微信小程序开发:
- - 构建或修改小程序页面和组件
- 组织小程序项目结构和配置
- 调试、预览或发布小程序项目
- 处理微信开发者工具工作流
- 处理小程序运行时行为、资源或页面配置文件
- 在明确需要时,在小程序项目中集成CloudBase
禁止用于:
- - Web前端开发(使用web-development)
- 纯后端服务开发(酌情使用cloudrun-development或cloud-functions)
- 无小程序开发背景的纯UI设计任务(使用ui-design)
如何使用此技能(针对编码代理)
- 1. 从通用小程序工作流开始
- 将微信小程序开发视为默认范围
- 除非用户或代码库指明,否则不要假设项目使用CloudBase
- 2. 遵循小程序项目约定
- 将小程序源码保留在配置的小程序根目录下
- 确保页面文件包含所需的配置文件,如index.json
- 在建议预览或IDE工作流之前检查project.config.json
- 3. 按场景路由
- 如果任务涉及CloudBase、wx.cloud、云函数、CloudBase数据库/存储或CloudBase身份处理,请阅读
CloudBase集成参考
- 如果任务涉及调试、预览、发布、微信开发者工具或无开发者工具工作流,请阅读
调试和预览参考
- 4. 仅在适用时使用CloudBase规则
- CloudBase是一个重要的小程序集成路径,但不是通用要求
- 仅在项目使用CloudBase时,才应用CloudBase特定的认证、数据库、存储或云函数约束
- 5. 推荐正确的预览/调试路径
- 优先使用微信开发者工具进行模拟器、面板式调试、预览和真机验证
- 如果微信开发者工具不可用,酌情使用miniprogram-ci进行预览、上传和npm构建工作流
微信小程序开发规则
通用项目规则
- 1. 项目结构
- 小程序代码应遵循project.config.json中配置的项目根目录
- 保持页面级文件完整,包括.json配置文件
- 确保引用的本地资源实际存在,以避免编译失败
- 2. 配置检查
- 在打开、预览或发布项目前检查project.config.json
- 当需要真实预览、上传或微信开发者工具工作流时,确认appid可用
- 确认miniprogramRoot及相关路径设置正确
- 3. 资源处理
- 生成图标等本地资源引用时,确保文件已下载到项目中
- 保持文件路径稳定,并与小程序配置文件一致
CloudBase作为小程序子场景
- - 如果用户明确使用CloudBase、wx.cloud、腾讯云开发或云开发,请遵循CloudBase集成参考
- 在CloudBase小程序项目中,适当使用wx.cloud API和CloudBase环境配置
- 不要将CloudBase特定规则应用于非CloudBase小程序项目
调试、预览和发布
- - 如果微信开发者工具可用,将其作为模拟器调试、面板检查、预览和设备验证的主要路径
- 如果微信开发者工具不可用,使用miniprogram-ci作为预览、上传和npm构建相关自动化的回退路径
- 有关详细工作流,请阅读调试和预览参考
最小项目骨架
app.js
js
App({
onLaunch() {
console.log(小程序已启动);
},
});
pages/index/index.js
js
Page({
data: {
message: 你好,CloudBase 小程序,
},
});
pages/index/index.wxml
xml
{{message}}
pages/index/index.json
json
{
navigationBarTitleText: 首页
}
project.config.json
json
{
appid: your-mini-program-appid,
projectname: cloudbase-mini-program,
miniprogramRoot: ./,
compileType: miniprogram
}
参考文档