Skip to content

Commit 0a35013

Browse files
committed
feat(rules): ✨ enforce template download and UI design doc reading
- Add mandatory template download requirement for new projects - Strengthen UI design document reading enforcement - Update Quick Reference section with explicit template download step - Add template download check to Core Behavior Rules - Enhance UI Design rules with explicit file reading requirement - Update Development Quality Checklist with mandatory checks
1 parent 42b4a97 commit 0a35013

File tree

1 file changed

+53
-30
lines changed

1 file changed

+53
-30
lines changed

config/.cursor/rules/cloudbase-rules.mdc

Lines changed: 53 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,23 @@ alwaysApply: true
1212

1313
### When Developing a Web Project:
1414
1. **Environment Check**: Call `envQuery` tool first (applies to all interactions)
15-
2. **⚠️ UI Design (CRITICAL)**: **MUST read `rule/ui-design-skill/SKILL.md` FIRST before generating any page, interface, component, or style**
16-
3. **Core Capabilities**: Read Core Capabilities section below (especially UI Design and Database + Authentication for Web)
17-
4. **Platform Rules**: Read `rule/web-development-skill/SKILL.md` for platform-specific rules (SDK integration, static hosting, build configuration)
18-
5. **Authentication**: Read `rule/auth-web-skill/SKILL.md` - **MUST use Web SDK built-in authentication**
19-
6. **Database**:
15+
2. **⚠️ Template Download (MANDATORY for New Projects)**: **MUST call `downloadTemplate` tool FIRST when starting a new project** - Do NOT create files manually. Use `downloadTemplate` with `template="react"` or `template="vue"` to get the complete project structure. Only proceed with manual file creation if template download fails or user explicitly requests it.
16+
3. **⚠️ UI Design (CRITICAL)**: **MUST read `rule/ui-design-skill/SKILL.md` FIRST before generating any page, interface, component, or style** - This is NOT optional. You MUST explicitly read this file and output the design specification before writing any UI code.
17+
4. **Core Capabilities**: Read Core Capabilities section below (especially UI Design and Database + Authentication for Web)
18+
5. **Platform Rules**: Read `rule/web-development-skill/SKILL.md` for platform-specific rules (SDK integration, static hosting, build configuration)
19+
6. **Authentication**: Read `rule/auth-web-skill/SKILL.md` - **MUST use Web SDK built-in authentication**
20+
7. **Database**:
2021
- NoSQL: `rule/no-sql-web-sdk/SKILL.md`
2122
- MySQL: `rule/relational-database-web-skill/SKILL.md` + `rule/relational-database-mcp-skill/SKILL.md`
2223

2324
### When Developing a Mini Program Project:
2425
1. **Environment Check**: Call `envQuery` tool first (applies to all interactions)
25-
2. **⚠️ UI Design (CRITICAL)**: **MUST read `rule/ui-design-skill/SKILL.md` FIRST before generating any page, interface, component, or style**
26-
3. **Core Capabilities**: Read Core Capabilities section below (especially UI Design and Database + Authentication for Mini Program)
27-
4. **Platform Rules**: Read `rule/miniprogram-development-skill/SKILL.md` for platform-specific rules (project structure, WeChat Developer Tools, wx.cloud usage)
28-
5. **Authentication**: Read `rule/auth-wechat-skill/SKILL.md` - **Naturally login-free, get OPENID in cloud functions**
29-
6. **Database**:
26+
2. **⚠️ Template Download (MANDATORY for New Projects)**: **MUST call `downloadTemplate` tool FIRST when starting a new project** - Do NOT create files manually. Use `downloadTemplate` with `template="miniprogram"` to get the complete project structure. Only proceed with manual file creation if template download fails or user explicitly requests it.
27+
3. **⚠️ UI Design (CRITICAL)**: **MUST read `rule/ui-design-skill/SKILL.md` FIRST before generating any page, interface, component, or style** - This is NOT optional. You MUST explicitly read this file and output the design specification before writing any UI code.
28+
4. **Core Capabilities**: Read Core Capabilities section below (especially UI Design and Database + Authentication for Mini Program)
29+
5. **Platform Rules**: Read `rule/miniprogram-development-skill/SKILL.md` for platform-specific rules (project structure, WeChat Developer Tools, wx.cloud usage)
30+
6. **Authentication**: Read `rule/auth-wechat-skill/SKILL.md` - **Naturally login-free, get OPENID in cloud functions**
31+
7. **Database**:
3032
- NoSQL: `rule/no-sql-wx-mp-sdk/SKILL.md`
3133
- MySQL: `rule/relational-database-mcp-skill/SKILL.md` (via MCP tools)
3234

@@ -39,8 +41,10 @@ As the most important part of application development, the following four core c
3941
### 1. ⚠️ UI Design (CRITICAL - Highest Priority)
4042
**⚠️ MANDATORY: Must strictly follow `rule/ui-design-skill/SKILL.md` rules for ALL design work**
4143

44+
**🚨 CRITICAL ENFORCEMENT: You MUST explicitly read the file `rule/ui-design-skill/SKILL.md` before generating ANY UI code. This is NOT a suggestion - it is a MANDATORY requirement.**
45+
4246
**Before generating ANY page, interface, component, or style:**
43-
1. **MUST FIRST read `rule/ui-design-skill/SKILL.md`** - This is not optional
47+
1. **MUST FIRST explicitly read `rule/ui-design-skill/SKILL.md` file** - Use file reading tools to read this file, do NOT skip this step
4448
2. **MUST complete design specification output** before writing any code:
4549
- Purpose Statement
4650
- Aesthetic Direction (choose from specific options, NOT generic terms)
@@ -57,6 +61,8 @@ As the most important part of application development, the following four core c
5761
- Style/visual effects
5862
- Any frontend visual elements
5963

64+
**⚠️ VIOLATION DETECTION: If you find yourself writing UI code without first reading `rule/ui-design-skill/SKILL.md`, STOP immediately and read the file first.**
65+
6066
### 2. Database + Authentication
6167
**Strengthen database and authentication capabilities**
6268

@@ -141,27 +147,38 @@ Before starting work, suggest confirming with user:
141147

142148
## Core Behavior Rules
143149
1. **Tool Priority**: For Tencent CloudBase operations, must prioritize using CloudBase MCP tools
144-
2. **Project Understanding**: First read current project's README.md, follow project instructions for development
145-
3. **Directory Standards**: Before outputting project code in current directory, first check current directory files
146-
4. **Development Order**: When developing, prioritize frontend first, then backend, ensuring frontend interface and interaction logic are completed first, then implement backend business logic
147-
5. **⚠️ UI Design Rules Mandatory Application**: When tasks involve generating pages, interfaces, components, styles, or any frontend visual elements, **MUST FIRST read and strictly follow `rule/ui-design-skill/SKILL.md` rule file**, ensuring generated interfaces have distinctive aesthetic styles and high-quality visual design, avoiding generic AI aesthetics
148-
6. **Backend Development Priority Strategy**: When developing backend, prioritize using SDK to directly call CloudBase database, rather than through cloud functions, unless specifically needed (such as complex business logic, server-side computation, calling third-party APIs, etc.)
149-
7. **Deployment Order**: When there are backend dependencies, prioritize deploying backend before previewing frontend
150-
8. **Interactive Confirmation**: Use interactiveDialog to clarify when requirements are unclear, must confirm before executing high-risk operations
151-
9. **Real-time Communication**: Use CloudBase real-time database watch capability
152-
10. **⚠️ Authentication Rules**: When users develop projects, if user login authentication is needed, must use built-in authentication functions, must strictly distinguish authentication methods by platform
150+
2. **⚠️ Template Download (MANDATORY)**: **When starting a new project or when user requests to develop an application, MUST FIRST call `downloadTemplate` tool** - Do NOT manually create project files. Use `downloadTemplate` with appropriate template type (`react`, `vue`, `miniprogram`, `uniapp`). Only create files manually if template download fails or user explicitly requests manual creation. This ensures proper project structure, configuration files, and best practices.
151+
3. **Project Understanding**: First read current project's README.md, follow project instructions for development
152+
4. **Directory Standards**: Before outputting project code in current directory, first check current directory files
153+
5. **Development Order**: When developing, prioritize frontend first, then backend, ensuring frontend interface and interaction logic are completed first, then implement backend business logic
154+
6. **⚠️ UI Design Rules Mandatory Application**: When tasks involve generating pages, interfaces, components, styles, or any frontend visual elements, **MUST FIRST explicitly read the file `rule/ui-design-skill/SKILL.md` using file reading tools**, then strictly follow the rule file, ensuring generated interfaces have distinctive aesthetic styles and high-quality visual design, avoiding generic AI aesthetics. **You MUST output the design specification before writing any UI code.**
155+
7. **Backend Development Priority Strategy**: When developing backend, prioritize using SDK to directly call CloudBase database, rather than through cloud functions, unless specifically needed (such as complex business logic, server-side computation, calling third-party APIs, etc.)
156+
8. **Deployment Order**: When there are backend dependencies, prioritize deploying backend before previewing frontend
157+
9. **Interactive Confirmation**: Use interactiveDialog to clarify when requirements are unclear, must confirm before executing high-risk operations
158+
10. **Real-time Communication**: Use CloudBase real-time database watch capability
159+
11. **⚠️ Authentication Rules**: When users develop projects, if user login authentication is needed, must use built-in authentication functions, must strictly distinguish authentication methods by platform
153160
- **Web Projects**: **MUST use CloudBase Web SDK built-in authentication** (e.g., `auth.toDefaultLoginPage()`), refer to `rule/auth-web-skill/SKILL.md`
154161
- **Mini Program Projects**: **Naturally login-free**, get `wxContext.OPENID` in cloud functions, refer to `rule/auth-wechat-skill/SKILL.md`
155162

156163
## Development Workflow
157164

158165
### Development
159166

160-
1. **Download CloudBase AI Rules or Other Templates**: Recommend starting new projects from templates, can use downloadTemplate to download. If unable to download to current directory, can use scripts to copy, note that hidden files also need to be copied
167+
1. **⚠️ Download CloudBase Templates (MANDATORY for New Projects)**:
168+
- **MUST call `downloadTemplate` tool FIRST when starting a new project** - Do NOT manually create project files
169+
- For Web projects: Use `downloadTemplate` with `template="react"` or `template="vue"`
170+
- For Mini Program projects: Use `downloadTemplate` with `template="miniprogram"`
171+
- For UniApp projects: Use `downloadTemplate` with `template="uniapp"`
172+
- **Only proceed with manual file creation if template download fails or user explicitly requests manual creation**
173+
- If unable to download to current directory, can use scripts to copy, note that hidden files also need to be copied
161174

162-
2. **Mini Program TabBar Material Download - Download Remote Material Links**: Mini program Tabbar and other material images must use **png** format, must use downloadRemoteFile tool to download files locally. Can select from Unsplash, wikimedia (generally choose 500 size), Pexels, Apple official UI and other resources
175+
2. **⚠️ UI Design Document Reading (MANDATORY)**:
176+
- **Before generating ANY page, interface, component, or style, MUST FIRST explicitly read the file `rule/ui-design-skill/SKILL.md` using file reading tools**
177+
- **MUST output the design specification** (Purpose Statement, Aesthetic Direction, Color Palette, Typography, Layout Strategy) before writing any UI code
178+
- This is NOT optional - you MUST read the file and follow the design thinking framework and frontend aesthetics guidelines
179+
- Avoid generating generic AI aesthetic style interfaces
163180

164-
**Important Reminder**: Before generating any page, interface, component, or style, must first read and understand `rule/ui-design-skill/SKILL.md` rule file, ensure following design thinking framework and frontend aesthetics guidelines, avoid generating generic AI aesthetic style interfaces.
181+
3. **Mini Program TabBar Material Download - Download Remote Material Links**: Mini program Tabbar and other material images must use **png** format, must use downloadRemoteFile tool to download files locally. Can select from Unsplash, wikimedia (generally choose 500 size), Pexels, Apple official UI and other resources
165182

166183
If remote links are needed in the application, can continue to call uploadFile to upload and obtain temporary access links and cloud storage cloudId
167184

@@ -240,20 +257,26 @@ To ensure development quality, recommend completing the following checks before
240257

241258
### Recommended Steps
242259
0. **[ ] Environment Check**: Call `envQuery` tool to check CloudBase environment status (applies to all interactions)
243-
1. **[ ] Scenario Identification**: Clearly identify what type of project this is (Web/Mini Program/Database/UI)
244-
2. **[ ] Core Capability Confirmation**: Confirm all four core capabilities have been considered
245-
- UI Design: Have you read `rule/ui-design-skill/SKILL.md`?
260+
1. **[ ] Template Download Check (MANDATORY for New Projects)**: If starting a new project, have you called `downloadTemplate` tool FIRST? Do NOT manually create project files - use templates.
261+
2. **[ ] Scenario Identification**: Clearly identify what type of project this is (Web/Mini Program/Database/UI)
262+
3. **[ ] Core Capability Confirmation**: Confirm all four core capabilities have been considered
263+
- UI Design: Have you explicitly read the file `rule/ui-design-skill/SKILL.md` using file reading tools?
246264
- Database + Authentication: Have you referred to corresponding authentication and database skills?
247265
- Static Hosting Deployment: Have you understood the deployment process?
248266
- Backend Deployment: Have you understood cloud function or CloudRun deployment process?
249-
3. **[ ] UI Design Rules Check**: If task involves generating pages, interfaces, components, or styles, must confirm you have read and understood `rule/ui-design-skill/SKILL.md` rules
250-
4. **[ ] User Confirmation**: Confirm with user whether scenario identification and core capability understanding are correct
251-
5. **[ ] Rule Execution**: Strictly follow core capability requirements and relevant rule files for development
267+
4. **[ ] UI Design Rules Check (MANDATORY)**: If task involves generating pages, interfaces, components, or styles:
268+
- Have you explicitly read the file `rule/ui-design-skill/SKILL.md` using file reading tools? (Required: YES)
269+
- Have you output the design specification before writing code? (Required: YES)
270+
- Have you understood and will follow the design thinking framework? (Required: YES)
271+
5. **[ ] User Confirmation**: Confirm with user whether scenario identification and core capability understanding are correct
272+
6. **[ ] Rule Execution**: Strictly follow core capability requirements and relevant rule files for development
252273

253274
### ⚠️ Common Issues to Avoid
275+
- **❌ DO NOT manually create project files** - Always use `downloadTemplate` tool first for new projects
276+
- **❌ DO NOT skip reading UI design document** - Must explicitly read `rule/ui-design-skill/SKILL.md` file before generating any UI code
254277
- Avoid skipping core capabilities and starting development directly
255278
- Avoid mixing APIs and authentication methods from different platforms
256-
- Avoid ignoring UI design rules: All tasks involving interfaces, pages, components, styles must strictly refer to `rule/ui-design-skill/SKILL.md`
279+
- Avoid ignoring UI design rules: All tasks involving interfaces, pages, components, styles must explicitly read and strictly follow `rule/ui-design-skill/SKILL.md`
257280
- Avoid ignoring database and authentication standards: Must use correct authentication methods and database operation methods
258281
- Important technical solutions should be confirmed with users
259282

0 commit comments

Comments
 (0)