$npx -y skills add TencentCloudBase/cloudbase-skills --skill cloudbase-code-reviewCode review and validation for CloudBase projects. After writing code for Web / miniprogram / CloudRun / cloud-function projects, call this skill to check for known pitfalls — auth guard misuse, missing database tables, RLS misconfiguration, storage domain setup, and SDK API misu
| 1 | ## Standalone Install Note |
| 2 | |
| 3 | If this environment only installed the current skill, start from the CloudBase main entry and use the published `cloudbase/references/...` paths for sibling skills. |
| 4 | |
| 5 | - CloudBase main entry: `https://cnb.cool/tencent/cloud/cloudbase/cloudbase-skills/-/git/raw/main/skills/cloudbase/SKILL.md` |
| 6 | - Current skill raw source: `https://cnb.cool/tencent/cloud/cloudbase/cloudbase-skills/-/git/raw/main/skills/cloudbase/references/cloudbase-code-review/SKILL.md` |
| 7 | |
| 8 | Keep local `references/...` paths for files that ship with the current skill directory. When this file points to a sibling skill, use the standalone fallback URL shown next to that reference. |
| 9 | |
| 10 | # CloudBase Code Review |
| 11 | |
| 12 | > **One-liner**: After implementing CloudBase features, call this skill to catch common mistakes before the grader does. |
| 13 | |
| 14 | ## When to use |
| 15 | |
| 16 | Call this skill **after** completing a CloudBase implementation task, before declaring done: |
| 17 | |
| 18 | - You implemented auth (login / register / route guard) |
| 19 | - You created database tables or wrote CRUD (NoSQL / PostgreSQL / MySQL) |
| 20 | - You set up CloudBase Storage (file upload, hosting) |
| 21 | - You configured security rules or RLS policies |
| 22 | - You wrote MCP-dependent code |
| 23 | |
| 24 | ## How it works |
| 25 | |
| 26 | The skill runs in two layers: |
| 27 | |
| 28 | | Layer | Method | Speed | What it catches | |
| 29 | |-------|--------|-------|-----------------| |
| 30 | | **Lint (optional)** | No executable script is shipped. If the user approves running lint, review the code block in `references/lint-rules/README.md`, copy it to a temporary local `cloudbase-lint.mjs`, then run `node cloudbase-lint.mjs --project-dir <path>` | Seconds | Deterministic regex checks — wrong API calls, missing configs, pattern mismatches | |
| 31 | | **LLM review** | Read each rule's "LLM 检查" section, inspect code semantically | Variable | Semantic issues — route guard logic, RLS completeness, architecture-level problems | |
| 32 | |
| 33 | ## Rule index |
| 34 | |
| 35 | See `references/RULES_INDEX.md` for the full matrix (module × frontend type → applicable rules). |
| 36 | |
| 37 | ## Rule boundary |
| 38 | |
| 39 | Do not promote a single failed run or case-specific workaround into a hard rule. A rule should be backed by stable SDK/API documentation, repeated failures, or deterministic runtime behavior. Case-specific observations belong in attribution reports; only broadly applicable constraints should enter `RULES_INDEX.md` or the optional lint checklist. |
| 40 | |
| 41 | ## Quick start |
| 42 | |
| 43 | ```bash |
| 44 | # Step 1: Read relevant rules for identified modules |
| 45 | # references/rules/cross-cutting/AUTH001.md |
| 46 | # references/rules/postgresql/PG-CR001.md |
| 47 | # ... |
| 48 | |
| 49 | # Optional: if the user approves running lint, review the script code block in |
| 50 | # references/lint-rules/README.md, copy it to a temporary cloudbase-lint.mjs, |
| 51 | # then run: node cloudbase-lint.mjs --project-dir . |
| 52 | |
| 53 | # Step 2: For each applicable rule, read the "LLM 检查" section |
| 54 | # and manually inspect your code before claiming done. |
| 55 | ``` |
| 56 | |
| 57 | ## Rule format |
| 58 | |
| 59 | Each rule `.md` file follows this structure: |
| 60 | |
| 61 | ```markdown |
| 62 | # RULE-ID Rule Name |
| 63 | |
| 64 | - **Module**: which module (auth / postgresql / storage / ...) |
| 65 | - **Severity**: error | warning |
| 66 | - **Stage**: code-generation | deployment | config |
| 67 | |
| 68 | ## 正则检查 (Lint) |
| 69 | |
| 70 | The condition checked by the optional script code block in `references/lint-rules/README.md`. |
| 71 | |
| 72 | ## LLM 检查 |
| 73 | |
| 74 | Semantic review prompt for human or LLM to evaluate. |
| 75 | |
| 76 | ## 修复指引 |
| 77 | |
| 78 | How to fix the issue. |
| 79 | ``` |