---
title: "Data Modeling"
description: "The Data Modeling Skill enables creating and managing NocoBase data tables through natural language, including creating tables, adding fields, and setting up relationships."
keywords: "AI Builder,data modeling,data tables,fields,relationships,collections"
---

# Data Modeling

:::tip Prerequisites

Before reading this page, make sure you have installed the NocoBase CLI and completed initialization as described in [AI Builder Quick Start](./index.md).

:::

## Introduction

The Data Modeling Skill enables creating and managing NocoBase data tables through natural language — creating tables, adding fields, setting up relationships, and more.

Before use, make sure the target data source has been configured in "Data Source Management."


## Capabilities

- Create, modify, and delete data tables, supporting general tables, tree tables, file tables, calendar tables, SQL tables, view tables, and inheritance tables
- Add, modify, and delete fields, including all NocoBase built-in field types (including relationship fields) and plugin-extended field types

## Prompt Examples

### Scenario A: Creating a data table

```
Please create a file table for managing contracts
```

The Skill will guide the AI to analyze the fields needed for the data table and their corresponding NocoBase field types, then create a file-type data table and add the appropriate fields in the system.

![Creating a data table](https://static-docs.nocobase.com/202604162103369.png)

### Scenario B: Adding fields

```
Please add a status field to the users table to indicate whether the user is active, with three statuses: Active, Leaving, and Left
```

The Skill will guide the AI to retrieve the users table metadata and determine that an employment status field corresponds to a "Dropdown (single select)" field type in NocoBase, then add the field to the users table and configure the enum values.

![Adding fields](https://static-docs.nocobase.com/202604162112692.png)

### Scenario C: Initializing a data model

```
I'm building a CRM, please help me design and build the data model
```

The Skill will create data tables, add fields, and configure relationships in the system based on the data model designed by the AI.

![Initializing a data model](https://static-docs.nocobase.com/202604162126729.png)

![Initializing a data model result](https://static-docs.nocobase.com/202604162201867.png)

### Scenario D: Adding a feature module

```
I'd like to add an order management data model to the existing CRM system
```

The Skill will guide the AI to retrieve the current system's data model and design the new feature's data modeling based on it, then automatically create data tables, add fields, and configure relationships.

![Adding a feature module](https://static-docs.nocobase.com/202604162203006.png)

![Adding a feature module result](https://static-docs.nocobase.com/202604162203893.png)

## FAQ

**Are system fields created automatically when creating a table?**

Yes. System fields like `id`, `createdAt`, `createdBy`, `updatedAt`, and `updatedBy` are automatically generated by the server and do not need to be specified manually.

**How do I fix an incorrectly configured relationship?**

It's recommended to first check the current relationship field's foreign key and inverse field, then decide whether to modify or delete and recreate it. The Skill will read back and verify the relationship status on both ends after any changes.

**How do I create a data table based on a plugin-extended table type?**

The corresponding plugin must be enabled. If it's not enabled, the AI will typically attempt to enable the plugin. If the AI doesn't succeed, please enable the plugin manually.

**How do I add a field based on a plugin-extended field type?**

Same as above.

## Related Links

- [AI Builder Overview](./index.md) — Overview and installation guide for all AI Builder Skills
- [UI Configuration](./ui-builder) — Use AI to build pages and blocks after creating data tables
- [Solutions](./dsl-reconciler) — Batch-build entire business systems from YAML
