web-development
Web frontend project development rules. Use this skill when developing web frontend pages, deploying static hosting, and integrating CloudBase Web SDK.
Best use case
web-development is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Web frontend project development rules. Use this skill when developing web frontend pages, deploying static hosting, and integrating CloudBase Web SDK.
Teams using web-development should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/web-development/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How web-development Compares
| Feature / Agent | web-development | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Web frontend project development rules. Use this skill when developing web frontend pages, deploying static hosting, and integrating CloudBase Web SDK.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
## When to use this skill
Use this skill for **Web frontend project development** when you need to:
- Develop web frontend pages and interfaces
- Deploy static websites to CloudBase static hosting
- Integrate CloudBase Web SDK for database, cloud functions, and authentication
- Set up modern frontend build systems (Vite, Webpack, etc.)
- Handle routing and build configurations for static hosting
**Do NOT use for:**
- Mini-program development (use miniprogram-development skill)
- Backend service development (use cloudrun-development skill)
- UI design only (use ui-design skill, but may combine with this skill)
---
## How to use this skill (for a coding agent)
1. **Follow project structure conventions**
- Frontend source code in `src` directory
- Build output in `dist` directory
- Cloud functions in `cloudfunctions` directory
- Use modern frontend build systems (Vite, etc.)
2. **Use CloudBase Web SDK correctly**
- Always use SDK built-in authentication features
- Never implement login logic in cloud functions
- Use `envQuery` tool to get environment ID
3. **Deploy and preview properly**
- Build project first (ensure `npm install` is executed)
- Use relative paths for `publicPath` configuration
- Use hash routing for better static hosting compatibility
- Deploy to subdirectory if user doesn't specify root directory
---
# Web Frontend Development Rules
## Project Structure
1. **Directory Organization**:
- Frontend source code should be stored in `src` directory
- Build output should be placed in `dist` directory
- Cloud functions should be in `cloudfunctions` directory
2. **Build System**:
- Projects should use modern frontend build systems like Vite
- Install dependencies via npm
3. **Routing**:
- If the frontend project involves routing, use hash routing by default
- Hash routing solves the 404 refresh issue and is more suitable for static website hosting deployment
## Deployment and Preview
1. **Static Hosting Deployment**:
- For frontend projects, after building, you can use CloudBase static hosting
- First start local preview, then confirm with user if deployment to CloudBase static hosting is needed
- When deploying, if user has no special requirements, generally do not deploy directly to root directory
- Return deployed address in markdown link format
2. **Local Preview**:
- To preview static web pages locally, navigate to the specified output directory and use `npx live-server`
3. **Public Path Configuration**:
- When web projects are deployed to static hosting CDN, since paths cannot be known in advance, `publicPath` and similar configurations should use relative paths instead of absolute paths
- This solves resource loading issues
## CloudBase Web SDK Usage
1. **SDK Integration**:
- If user's project needs database, cloud functions, and other features, need to introduce `@cloudbase/js-sdk@latest` in the web application
**Important: Authentication must use SDK built-in features. It is strictly forbidden to implement login authentication logic using cloud functions!**
```js
import cloudbase from "@cloudbase/js-sdk";
const app = cloudbase.init({
env: "xxxx-yyy", // Can query environment ID via envQuery tool
});
const auth = app.auth();
// Check current login state
let loginState = await auth.getLoginState();
if (loginState && loginState.user) {
// Logged in
const user = await auth.getCurrentUser();
console.log("Current user:", user);
} else {
// Not logged in - use SDK built-in authentication features
// Method 1: Redirect to default login page (recommended)
await auth.toDefaultLoginPage({});
// Method 2: Anonymous login
// await auth.signInAnonymously();
}
```
**Initialization rules (Web, @cloudbase/js-sdk):**
- Always use **synchronous initialization** with the pattern above
- Do **not** lazy-load the SDK with `import("@cloudbase/js-sdk")`
- Do **not** wrap SDK initialization in async helpers such as `initCloudBase()` with internal `initPromise` caches
- Keep a single shared `app`/`auth` instance in your frontend app; reuse it instead of re-initializing
### Web SDK API usage rules
- Only use **documented** CloudBase Web SDK methods
- Before calling any method on `app`, `auth`, `db`, or other SDK objects, **confirm it exists in the official CloudBase Web SDK documentation**
- If a method or option is **not** mentioned in the official docs (for example some guessed method name), **do NOT invent or use it**
### Local development proxy for default login page
When using `auth.toDefaultLoginPage()` in local development, you must proxy the `/__auth` path to your CloudBase Web hosting domain. For example, in a Vite + React project:
```ts
// vite.config.ts
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
export default defineConfig({
plugins: [react()],
base: "./", // Use relative paths to avoid asset issues on static hosting
server: {
host: "127.0.0.1",
proxy: {
"/__auth": {
target: "https://envId-appid.tcloudbaseapp.com/", // Replace with your CloudBase Web app domain
changeOrigin: true,
},
},
allowedHosts: true,
},
});
```
The CloudBase Web hosting domain can be obtained via the CloudBase MCP `envQuery` tool (Static hosting config); in the response, use the value from the `StaticDomain` field.
In other dev servers/build tools (Webpack dev server, Next.js custom dev server, etc.), implement an **equivalent proxy rule** so that all `/__auth` requests are forwarded to the CloudBase domain during local development.
## Authentication Best Practices
1. **Must use SDK built-in authentication**: CloudBase Web SDK provides complete authentication features, including default login page, anonymous login, custom login, etc.
2. **Forbidden to implement login using cloud functions**: Do not create cloud functions to handle login logic, this is the wrong approach
3. **User data management**: After login, user information can be obtained via `auth.getCurrentUser()`, then stored to database
4. **Error handling**: All authentication operations should include complete error handling logic
## Build Process
**Web project build process**: Ensure `npm install` command has been executed first, then refer to project documentation for buildingRelated Skills
Workers Development
This skill should be used when the user asks about "Workers API", "fetch handler", "Workers runtime", "request handling", "response handling", "Workers bindings", "environment variables in Workers", "Workers context", or discusses implementing Workers code, routing patterns, or using Cloudflare bindings like KV, D1, R2, Durable Objects in Workers.
wordpress-woocommerce-development
WooCommerce store development workflow covering store setup, payment integration, shipping configuration, and customization.
wordpress-theme-development
WordPress theme development workflow covering theme architecture, template hierarchy, custom post types, block editor support, and responsive design.
vercel-ai-sdk-development
Use when building AI-powered applications with the Vercel AI SDK (V6+). Covers agents (ToolLoopAgent), tool design with execution approval and strict mode, MCP client integration, structured output with tool calling, streaming patterns, DevTools debugging, reranking, provider-specific tools, and UI integration with React/Next.js.
ui-development
Generate production-ready Next.js projects with TypeScript, Tailwind CSS, shadcn/ui, and API integration. Use when the user asks to build, create, develop, or scaffold a Next.js application, web app, full-stack project, or frontend with backend integration. Prioritizes modern stack (Next.js 14+, TypeScript, shadcn/ui, axios, react-query) and best practices. Also triggers on requests to add features, integrate APIs, or extend existing Next.js projects.
u01934-handoff-contracting-for-research-and-development-labs
Operate the "Handoff Contracting for research and development labs" capability in production for research and development labs workflows. Use when mission execution explicitly requires this capability and outcomes must be reproducible, policy-gated, and handoff-ready.
test-driven-development
Use when implementing any feature or bugfix, before writing implementation code
tauri-development
Tauri development guidelines for building cross-platform desktop applications with TypeScript, Rust, and modern web technologies
spec-driven-development
Guide for implementing Specification-Driven Development in any project using GitHub's spec-kit. Use when users want to start spec-driven development, need to initialize spec-kit in a project, or want guidance on the spec-kit workflow (constitution, specify, clarify, plan, tasks, implement). Covers installation, initialization, and step-by-step prompts for each phase.
seeksaas-development
Complete SeekSaaS development guide covering project setup, workflows, conventions, and best practices
salesforce-development
Expert patterns for Salesforce platform development including Lightning Web Components (LWC), Apex triggers and classes, REST/Bulk APIs, Connected Apps, and Salesforce DX with scratch orgs and 2nd ...
Report Development
Create QWeb PDF reports and report actions in Odoo.