Create Collection
Follow the schema-design skill (${CLAUDE_PLUGIN_ROOT}/skills/schema-design/SKILL.md) for the creation order, system fields and primary key rules; read it before the first call.
Arguments
name (required) — Collection name (snake_case recommended)
--fields <field1:type,...> — Comma-separated field definitions (e.g., title:string,content:text,price:decimal)
--icon <icon> — Material icon name (default: box)
Process
- Parse arguments
- Call
schema tool (no params) to check collection doesn't already exist
- Call
collections tool to create the collection:{
"action": "create",
"data": [{
"collection": "<name>",
"schema": {},
"meta": {
"icon": "<icon>",
"display_template": "{{<first_string_field>}}"
}
}]
}
- If
--fields provided, parse and create fields:{
"action": "create",
"collection": "<name>",
"data": [
{ "field": "<name>", "type": "<type>", "meta": { "interface": "<auto-mapped>" } }
]
}
Auto-map types to interfaces: string→input, text→input-rich-text-md, integer→input, decimal→input, boolean→boolean, datetime→datetime, json→input-code
- Display the created collection and its fields
- Suggest adding relations or more fields
Example
Input: products --fields name:string,description:text,price:decimal,active:boolean --icon inventory_2
1---2name: create-collection3description: 'Create a new Directus collection with optional fields Arguments: <name> [--fields <field1:type,field2:type>] [--icon <icon>].'4metadata:5 source: https://skillmd.com/skills/agents-store/create-collection6---78# Create Collection910Follow the `schema-design` skill (`${CLAUDE_PLUGIN_ROOT}/skills/schema-design/SKILL.md`) for the creation order, system fields and primary key rules; read it before the first call.1112## Arguments1314- `name` (required) — Collection name (snake_case recommended)15- `--fields <field1:type,...>` — Comma-separated field definitions (e.g., `title:string,content:text,price:decimal`)16- `--icon <icon>` — Material icon name (default: `box`)1718## Process19201. Parse arguments212. Call `schema` tool (no params) to check collection doesn't already exist223. Call `collections` tool to create the collection:23 ```json24 {25 "action": "create",26 "data": [{27 "collection": "<name>",28 "schema": {},29 "meta": {30 "icon": "<icon>",31 "display_template": "{{<first_string_field>}}"32 }33 }]34 }35 ```364. If `--fields` provided, parse and create fields:37 ```json38 {39 "action": "create",40 "collection": "<name>",41 "data": [42 { "field": "<name>", "type": "<type>", "meta": { "interface": "<auto-mapped>" } }43 ]44 }45 ```46 Auto-map types to interfaces: string→input, text→input-rich-text-md, integer→input, decimal→input, boolean→boolean, datetime→datetime, json→input-code475. Display the created collection and its fields486. Suggest adding relations or more fields4950## Example5152Input: `products --fields name:string,description:text,price:decimal,active:boolean --icon inventory_2`