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:
https://cnb.cool/tencent/cloud/cloudbase/cloudbase-skills/-/git/raw/main/skills/cloudbase/SKILL.md
- Current skill raw source:
https://cnb.cool/tencent/cloud/cloudbase/cloudbase-skills/-/git/raw/main/skills/cloudbase/references/data-model-creation/SKILL.md
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.
Data Model Creation
Activation Contract
Use this first when
- The user explicitly wants Mermaid
classDiagram modeling.
- The task needs complex multi-entity relational design, visual ER-style output, or generated data-model structure rather than direct SQL.
- You need to create CloudBase data models through the dedicated modeling tools, or you need to inspect an existing model before planning follow-up changes.
Read before writing code if
- The request mentions data model, ER diagram, Mermaid, relationship graph, or enterprise schema design.
- The user wants to reuse or update an existing published model.
Then also read
- Direct MySQL SQL creation or schema change ->
../relational-database-tool/SKILL.md (standalone fallback: https://cnb.cool/tencent/cloud/cloudbase/cloudbase-skills/-/git/raw/main/skills/cloudbase/references/relational-database-tool/SKILL.md)
- PostgreSQL / CloudBase PG schema work ->
../postgresql-development/SKILL.md (standalone fallback: https://cnb.cool/tencent/cloud/cloudbase/cloudbase-skills/-/git/raw/main/skills/cloudbase/references/postgresql-development/SKILL.md)
- Broader feature planning before schema work ->
../spec-workflow/SKILL.md (standalone fallback: https://cnb.cool/tencent/cloud/cloudbase/cloudbase-skills/-/git/raw/main/skills/cloudbase/references/spec-workflow/SKILL.md)
Do NOT use for
- Simple
CREATE TABLE, ALTER TABLE, or CRUD tasks.
- Document-database collection design.
- Frontend-only data-shape discussions with no modeling requirement.
Common mistakes / gotchas
- Using Mermaid modeling for a task that only needs one or two SQL statements.
- Mixing SQL-table design and NoSQL collection design in the same model.
- Generating diagrams without first deciding entity boundaries and ownership relations.
- Publishing a new model before validating the generated fields and relationships.
Minimal checklist
- Confirm Mermaid modeling is actually needed.
- List the core entities and relationships first.
- Decide whether this is a new model or an update.
- Keep the initial model small unless the user explicitly wants a large enterprise schema.
Overview
This skill is an advanced modeling path, not the default path for database work.
- For most MySQL database tasks, use
relational-database-tool and write SQL directly. If the task says PostgreSQL, CloudBase PG, PG mode, app.rdb(), queryPgDatabase, managePgDatabase, or RLS, use postgresql-development instead.
- Use this skill only when diagram-driven modeling adds value.
Quick routing
Use relational-database-tool instead when
- You need MySQL
CREATE TABLE, ALTER TABLE, INSERT, UPDATE, DELETE, or SELECT
- The schema is small and already clear
- The user never asked for a visual model
- The task does not mention PostgreSQL / CloudBase PG / PG mode /
app.rdb() / queryPgDatabase / managePgDatabase / RLS
Use this skill when
- You need multi-entity relationship modeling
- You need Mermaid
classDiagram output
- You want generated model structure and documentation
- You need a clean modeling pass before SQL implementation
How to use this skill (for a coding agent)
Clarify the entity set
- Extract business entities, ownership, and relationship cardinality from the request.
- Prefer 3-5 core entities unless the user clearly asks for more.
Model first, then generate
- Draft Mermaid
classDiagram content.
- Validate names, field types, and relationships before calling modeling tools.
Use the right tools
- Read/list existing models ->
manageDataModel(action="list"|"get"|"docs")
- Create a new model ->
modifyDataModel (compatibility name; create-only)
Publish carefully
- Prefer creating with unpublished or draft-like intent first.
- Publish only after checking field names, required constraints, and relationship directions.
Mermaid generation rules
Naming
- Class names -> PascalCase
- Field names -> camelCase
- Convert Chinese business descriptions into clear English identifiers
- Keep enum values human-readable when needed
Type mapping
| Business meaning |
Mermaid type |
| text |
string |
| number |
number |
| boolean |
boolean |
| enum |
x-enum |
| email |
email |
| phone |
phone |
| URL |
url |
| image |
x-image |
| file |
x-file |
| rich text |
x-rtf |
| date |
date |
| datetime |
datetime |
| region |
x-area-code |
| location |
x-location |
| array |
string[] or another explicit array type |
Required structure conventions
- Use
required() only for fields the user explicitly marks as required.
- Use
unique() only for explicit uniqueness needs.
- Use
display_field() for the human-facing label field.
- Add concise
<<description>> notes to important fields.
- Keep relationship labels tied to actual field names rather than vague business prose.
Minimal example
classDiagram
class User {
username: string <<Username>>
email: email <<Email>>
display_field() "username"
required() ["username", "email"]
unique() ["username", "email"]
}
class Order {
orderNo: string <<Order Number>>
totalAmount: number <<Total Amount>>
userId: string <<User ID>>
display_field() "orderNo"
unique() ["orderNo"]
}
Order "n" --> "1" User : userId
%% Class naming
note for User "用户"
note for Order "订单"
Tool usage guidance
Read existing models
Use this before creating related models, checking naming consistency, or assessing how an existing model is defined:
manageDataModel(action="list")
manageDataModel(action="get", name="ModelName")
manageDataModel(action="docs", name="ModelName")
Create model
Use modifyDataModel with:
- a complete
mermaidDiagram
action="create" when you want to create new models
- a deliberate publish decision
- clear awareness that updating existing model structures is not currently supported by this tool
Best practices
- Prefer direct SQL unless the user clearly benefits from model-first design.
- Keep the first model iteration small and reviewable.
- Separate business entities from implementation-only helper fields.
- Validate relationship direction and ownership before publishing.
- After modeling, hand off actual MySQL SQL/table work to
relational-database-tool when needed. For PostgreSQL / CloudBase PG tables, hand off to postgresql-development instead.
1---2name: data-model-creation3description: Optional advanced tool for complex data modeling. For simple MySQL table creation, use relational-database-tool directly; for PostgreSQL / CloudBase PG schema work, use postgresql-development.4---5
6## Standalone Install Note
7
8If this environment only installed the current skill, start from the CloudBase main entry and use the published `cloudbase/references/...` paths for sibling skills.
9
10- CloudBase main entry: `https://cnb.cool/tencent/cloud/cloudbase/cloudbase-skills/-/git/raw/main/skills/cloudbase/SKILL.md`
11- Current skill raw source: `https://cnb.cool/tencent/cloud/cloudbase/cloudbase-skills/-/git/raw/main/skills/cloudbase/references/data-model-creation/SKILL.md`
12
13Keep 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.
14
15# Data Model Creation
16
17## Activation Contract
18
19### Use this first when
20
21- The user explicitly wants Mermaid `classDiagram` modeling.
22- The task needs complex multi-entity relational design, visual ER-style output, or generated data-model structure rather than direct SQL.
23- You need to create CloudBase data models through the dedicated modeling tools, or you need to inspect an existing model before planning follow-up changes.
24
25### Read before writing code if
26
27- The request mentions data model, ER diagram, Mermaid, relationship graph, or enterprise schema design.
28- The user wants to reuse or update an existing published model.
29
30### Then also read
31
32- Direct MySQL SQL creation or schema change -> `../relational-database-tool/SKILL.md` (standalone fallback: `https://cnb.cool/tencent/cloud/cloudbase/cloudbase-skills/-/git/raw/main/skills/cloudbase/references/relational-database-tool/SKILL.md`)
33- PostgreSQL / CloudBase PG schema work -> `../postgresql-development/SKILL.md` (standalone fallback: `https://cnb.cool/tencent/cloud/cloudbase/cloudbase-skills/-/git/raw/main/skills/cloudbase/references/postgresql-development/SKILL.md`)
34- Broader feature planning before schema work -> `../spec-workflow/SKILL.md` (standalone fallback: `https://cnb.cool/tencent/cloud/cloudbase/cloudbase-skills/-/git/raw/main/skills/cloudbase/references/spec-workflow/SKILL.md`)
35
36### Do NOT use for
37
38- Simple `CREATE TABLE`, `ALTER TABLE`, or CRUD tasks.
39- Document-database collection design.
40- Frontend-only data-shape discussions with no modeling requirement.
41
42### Common mistakes / gotchas
43
44- Using Mermaid modeling for a task that only needs one or two SQL statements.
45- Mixing SQL-table design and NoSQL collection design in the same model.
46- Generating diagrams without first deciding entity boundaries and ownership relations.
47- Publishing a new model before validating the generated fields and relationships.
48
49### Minimal checklist
50
51- Confirm Mermaid modeling is actually needed.
52- List the core entities and relationships first.
53- Decide whether this is a new model or an update.
54- Keep the initial model small unless the user explicitly wants a large enterprise schema.
55
56## Overview
57
58This skill is an **advanced modeling path**, not the default path for database work.
59
60- For most MySQL database tasks, use `relational-database-tool` and write SQL directly. If the task says PostgreSQL, CloudBase PG, PG mode, `app.rdb()`, `queryPgDatabase`, `managePgDatabase`, or RLS, use `postgresql-development` instead.
61- Use this skill only when diagram-driven modeling adds value.
62
63## Quick routing
64
65### Use `relational-database-tool` instead when
66
67- You need MySQL `CREATE TABLE`, `ALTER TABLE`, `INSERT`, `UPDATE`, `DELETE`, or `SELECT`
68- The schema is small and already clear
69- The user never asked for a visual model
70- The task does **not** mention PostgreSQL / CloudBase PG / PG mode / `app.rdb()` / `queryPgDatabase` / `managePgDatabase` / RLS
71
72### Use this skill when
73
74- You need multi-entity relationship modeling
75- You need Mermaid `classDiagram` output
76- You want generated model structure and documentation
77- You need a clean modeling pass before SQL implementation
78
79## How to use this skill (for a coding agent)
80
811. **Clarify the entity set**
82 - Extract business entities, ownership, and relationship cardinality from the request.
83 - Prefer 3-5 core entities unless the user clearly asks for more.
84
852. **Model first, then generate**
86 - Draft Mermaid `classDiagram` content.
87 - Validate names, field types, and relationships before calling modeling tools.
88
893. **Use the right tools**
90 - Read/list existing models -> `manageDataModel(action="list"|"get"|"docs")`
91 - Create a new model -> `modifyDataModel` (compatibility name; create-only)
92
934. **Publish carefully**
94 - Prefer creating with unpublished or draft-like intent first.
95 - Publish only after checking field names, required constraints, and relationship directions.
96
97## Mermaid generation rules
98
99### Naming
100
101- Class names -> PascalCase
102- Field names -> camelCase
103- Convert Chinese business descriptions into clear English identifiers
104- Keep enum values human-readable when needed
105
106### Type mapping
107
108| Business meaning | Mermaid type |
109| --- | --- |
110| text | `string` |
111| number | `number` |
112| boolean | `boolean` |
113| enum | `x-enum` |
114| email | `email` |
115| phone | `phone` |
116| URL | `url` |
117| image | `x-image` |
118| file | `x-file` |
119| rich text | `x-rtf` |
120| date | `date` |
121| datetime | `datetime` |
122| region | `x-area-code` |
123| location | `x-location` |
124| array | `string[]` or another explicit array type |
125
126### Required structure conventions
127
128- Use `required()` only for fields the user explicitly marks as required.
129- Use `unique()` only for explicit uniqueness needs.
130- Use `display_field()` for the human-facing label field.
131- Add concise `<<description>>` notes to important fields.
132- Keep relationship labels tied to actual field names rather than vague business prose.
133
134## Minimal example
135
136```mermaid
137classDiagram
138 class User {
139 username: string <<Username>>
140 email: email <<Email>>
141 display_field() "username"
142 required() ["username", "email"]
143 unique() ["username", "email"]
144 }
145
146 class Order {
147 orderNo: string <<Order Number>>
148 totalAmount: number <<Total Amount>>
149 userId: string <<User ID>>
150 display_field() "orderNo"
151 unique() ["orderNo"]
152 }
153
154 Order "n" --> "1" User : userId
155
156 %% Class naming
157 note for User "用户"
158 note for Order "订单"
159```
160
161## Tool usage guidance
162
163### Read existing models
164
165Use this before creating related models, checking naming consistency, or assessing how an existing model is defined:
166
167- `manageDataModel(action="list")`
168- `manageDataModel(action="get", name="ModelName")`
169- `manageDataModel(action="docs", name="ModelName")`
170
171### Create model
172
173Use `modifyDataModel` with:
174
175- a complete `mermaidDiagram`
176- `action="create"` when you want to create new models
177- a deliberate publish decision
178- clear awareness that updating existing model structures is not currently supported by this tool
179
180## Best practices
181
1821. Prefer direct SQL unless the user clearly benefits from model-first design.
1832. Keep the first model iteration small and reviewable.
1843. Separate business entities from implementation-only helper fields.
1854. Validate relationship direction and ownership before publishing.
1865. After modeling, hand off actual MySQL SQL/table work to `relational-database-tool` when needed. For PostgreSQL / CloudBase PG tables, hand off to `postgresql-development` instead.