激活合约
首先使用此技能当
- 请求是实现、集成、调试、构建、部署或验证 Web 前端或静态站点。
- 设计方向已经确定,或者用户是在询问工程执行而非视觉探索。
- 工作涉及 React、Vue、Vite、路由、基于浏览器的验证或 CloudBase Web 集成。
编写代码前阅读如果
- 任务包括项目结构、框架约定、构建配置、部署、路由或前端测试和验证流程。
- 请求包括 UI 实现但视觉方向已经固定;否则先阅读
ui-design。
然后也阅读
- 通用 React / Vue / Vite 指导 ->
frameworks.md
- 浏览器流程检查或页面验证 ->
browser-testing.md
- 登录流程 ->
../auth-tool/SKILL.md,然后 ../auth-web/SKILL.md
- CloudBase 数据库工作 -> 匹配的数据库技能
不要用于
- 视觉方向设置、原型优先的设计工作或纯美学探索。
- 小程序、原生 Apps 或仅后端服务。
常见错误/陷阱
- 在澄清任务是设计还是工程执行之前就开始实现。
- 将框架设置、部署和 CloudBase 集成 concerns 混合到一个模糊的更改中。
- 将云函数视为 Web 身份验证的默认解决方案。
- 在 UI 或路由更改后跳过浏览器级验证。
何时使用此技能
将此技能用于 Web 工程工作,例如:
- 实现 React 或 Vue 页面和组件
- 设置或维护基于 Vite 的前端项目
- 处理路由、数据加载、表单和构建配置
- 运行基于浏览器的验证和冒烟检查
- 集成 CloudBase Web SDK 和静态托管,当项目需要 CloudBase 功能时
不要用于:
- 仅 UI 方向或视觉系统设计;使用
ui-design
- 小程序开发;使用
miniprogram-development
- 后端服务实现;使用
cloudrun-development 或 cloud-functions
如何使用此技能(对于编码代理)
- 确认任务是框架设置、页面实现、调试、部署、验证还是 CloudBase 集成。
- 将工作限制在实际的 Web 应用表面,而不是扩展到无关的后端更改。
- 如果项目已存在,优先使用现有项目栈。
- 对于新工作,除非 repo 或用户约束另有说明,否则将 Vite 视为默认打包器。
- 将可复用应用代码放在
src 下,构建输出放在
dist 下,除非 repo 已经使用不同约定。
- 对于交互、路由、渲染或回归检查,使用
browser-testing.md 中的
agent-browser 工作流。
- 在声称前端工作完成之前,优先对更改的流程进行轻量级冒烟验证。
- 仅当项目实际需要 CloudBase 平台功能时才使用 CloudBase Web SDK 和静态托管指导。
- 对于登录或 provider 就绪状态,重用
auth-tool 和
auth-web 而非在此重新描述这些流程。
核心工作流
1. 选择正确的工程路径
- React / Vue 功能工作:在应用的现有组件、路由和状态约定内实现
- 新 Web 应用脚手架:除非 repo 已经标准化其他工具链,否则优先使用 Vite
- 调试和回归:在浏览器中重现,缩小到特定页面或交互,然后修补
- CloudBase 集成:仅在基础前端路径清晰后接入 Web SDK、auth、数据或静态托管
2. 将实现扎根于项目现实
- 遵循 repo 的包管理器、脚本和 lint/test 模式
- 除非用户明确要求,否则避免框架重写
- 优先满足任务的最小可行页面/组件/配置更改
3. 明确验证更改的流程
- 在可用时运行相关本地构建或测试命令
- 当行为依赖于渲染、交互或导航时,在浏览器中打开受影响的页面或流程
- 记录检查了什么:路由、操作、预期结果和任何剩余差距
CloudBase Web 集成
仅当 Web 项目需要 CloudBase 平台功能时使用本节。
Web SDK 规则
- 对于 React、Vue、Vite 和其他基于打包器的项目,优先使用 npm 安装
- 仅对于静态 HTML 页面、快速演示、嵌入片段或 README 示例使用 CDN
- 仅使用已记录的 CloudBase Web SDK API;不要发明方法或选项
- 共享
app 或 auth 实例,而不是每次调用时重新初始化
身份验证边界
- 身份验证必须使用 CloudBase SDK 内置功能
- 不要将 Web 登录逻辑移入云函数
- 对于 provider 就绪状态、登录方法设置或发布密钥问题,路由到
auth-tool 和 auth-web
静态托管默认值
- 部署前构建
- 为静态托管兼容性优先使用相对资产路径
- 当项目缺少服务器端路由重写时,默认使用 hash 路由
- 如果用户未指定根路径,默认避免直接部署到站点根
CloudBase 快速开始
import cloudbase from "@cloudbase/js-sdk";const app = cloudbase.init({
env: "xxxx-yyy",
});
const auth = app.auth();
Activation Contract
Use this first when
- The request is to implement, integrate, debug, build, deploy, or validate a Web frontend or static site.
- The design direction is already decided, or the user is asking for engineering execution rather than visual exploration.
- The work involves React, Vue, Vite, routing, browser-based verification, or CloudBase Web integration.
Read before writing code if
- The task includes project structure, framework conventions, build config, deployment, routing, or frontend test and validation flows.
- The request includes UI implementation but the visual direction is already fixed; otherwise read
ui-design first.
Then also read
- General React / Vue / Vite guidance ->
frameworks.md
- Browser flow checks or page validation ->
browser-testing.md
- Login flow ->
../auth-tool/SKILL.md, then ../auth-web/SKILL.md
- CloudBase database work -> matching database skill
Do NOT use for
- Visual direction setting, prototype-first design work, or pure aesthetic exploration.
- Mini programs, native Apps, or backend-only services.
Common mistakes / gotchas
- Starting implementation before clarifying whether the task is design or engineering execution.
- Mixing framework setup, deployment, and CloudBase integration concerns into one vague change.
- Treating cloud functions as the default solution for Web authentication.
- Skipping browser-level validation after a UI or routing change.
When to use this skill
Use this skill for Web engineering work such as:
- Implementing React or Vue pages and components
- Setting up or maintaining Vite-based frontend projects
- Handling routing, data loading, forms, and build configuration
- Running browser-based validation and smoke checks
- Integrating CloudBase Web SDK and static hosting when the project needs CloudBase capabilities
Do NOT use for:
- UI direction or visual system design only; use
ui-design
- Mini program development; use
miniprogram-development
- Backend service implementation; use
cloudrun-development or cloud-functions
How to use this skill (for a coding agent)
- Clarify the execution surface
- Confirm whether the task is framework setup, page implementation, debugging, deployment, validation, or CloudBase integration.
- Keep the work scoped to the actual Web app surface instead of spreading into unrelated backend changes.
- Follow framework and build conventions
- Prefer the existing project stack if one already exists.
- For new work, treat Vite as the default bundler unless the repo or user constraints say otherwise.
- Put reusable app code under
src and build output under
dist unless the repo already uses a different convention.
- Validate through the browser, not only by reading code
- For interaction, routing, rendering, or regression checks, use
agent-browser workflows from
browser-testing.md.
- Prefer lightweight smoke validation for changed flows before claiming the frontend work is complete.
- Treat CloudBase as an integration branch
- Use CloudBase Web SDK and static hosting guidance only when the project actually needs CloudBase platform features.
- Reuse
auth-tool and
auth-web for login or provider readiness instead of re-describing those flows here.
Core workflow
1. Choose the right engineering path
- React / Vue feature work: implement within the app's existing component, routing, and state conventions
- New Web app scaffold: prefer Vite unless the repo already standardizes on another toolchain
- Debugging and regressions: reproduce in browser, narrow to a specific page or interaction, then patch
- CloudBase integration: wire in Web SDK, auth, data, or static hosting only after the base frontend path is clear
2. Keep implementation grounded in project reality
- Follow the repo's package manager, scripts, and lint/test patterns
- Avoid framework rewrites unless the user explicitly asks for one
- Prefer the smallest viable page/component/config change that satisfies the task
3. Validate changed flows explicitly
- Run the relevant local build or test command when available
- Open the affected page or flow in a browser when behavior depends on rendering, interaction, or navigation
- Record what was checked: route, action, expected result, and any remaining gap
CloudBase Web integration
Use this section only when the Web project needs CloudBase platform features.
Web SDK rules
- Prefer npm installation for React, Vue, Vite, and other bundler-based projects
- Use the CDN only for static HTML pages, quick demos, embedded snippets, or README examples
- Only use documented CloudBase Web SDK APIs; do not invent methods or options
- Keep a shared
app or auth instance instead of re-initializing on every call
Authentication boundary
- Authentication must use CloudBase SDK built-in features
- Do not move Web login logic into cloud functions
- For provider readiness, login method setup, or publishable key issues, route to
auth-tool and auth-web
Static hosting defaults
- Build before deployment
- Prefer relative asset paths for static hosting compatibility
- Use hash routing by default when the project lacks server-side route rewrites
- If the user does not specify a root path, avoid deploying directly to the site root by default
CloudBase quick start
import cloudbase from "@cloudbase/js-sdk";const app = cloudbase.init({
env: "xxxx-yyy",
});
const auth = app.auth();