mcpField
C
cms-collection-setup

cms-collection-setup

github.com/webflow数据与数据库132337 次安装6 天前更新
代码仓库

关于 cms-collection-setup

为 Webflow CMS 集合建模的操作技能,指导 Agent 按步骤检查站点、规划字段与关系,并在用户确认后创建和验证集合。

主要功能

  1. 01检查站点与套餐限制
  2. 02规划字段类型及集合关系
  3. 03预览模式并等待确认
  4. 04创建字段并验证集合结构

适用场景

  1. 01建立带自定义字段的 CMS 集合
  2. 02配置选项、引用及多重引用字段

MCP 相关

要求所有 Webflow 操作都通过 Webflow MCP 工具执行,包括站点与集合检查、创建和验证。

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/webflow/webflow-skills --skill cms-collection-setup

安装后在 Claude Code 中输入/cms-collection-setup确认已加载。

详细介绍

CMS 集合设置

创建一个包含自定义字段、关系和适当配置的新 CMS 集合。

重要提示

所有操作始终使用 Webflow MCP 工具:

  • 开始前,使用 Webflow MCP 的 webflow_guide_tool 获取最佳实践
  • 使用 Webflow MCP 的 data_sites_tool,并将操作设为 list_sites,以识别可用站点
  • 使用 Webflow MCP 的 data_sites_tool,并将操作设为 get_site,以获取站点详情和计划限制
  • 使用 Webflow MCP 的 data_cms_tool,并将操作设为 get_collection_list,以检查名称冲突
  • 使用 Webflow MCP 的 data_cms_tool,并将操作设为 create_collection,以创建集合
  • 使用 Webflow MCP 的 data_cms_tool,并将操作设为 create_collection_static_field,以创建静态字段
  • 使用 Webflow MCP 的 data_cms_tool,并将操作设为 create_collection_option_field,以创建选项字段
  • 使用 Webflow MCP 的 data_cms_tool,并将操作设为 create_collection_reference_field,以创建引用/多重引用字段
  • 使用 Webflow MCP 的 data_cms_tool,并将操作设为 get_collection_details,以验证集合是否创建正确
  • Webflow 操作不得使用任何其他工具或方法
  • 所有工具调用都必须包含必需的 context 参数(15–25 个词,以第三人称视角撰写)

说明

阶段 1:站点选择与发现
  1. 获取站点信息:使用 Webflow MCP 的 data_sites_tool,并将操作设为 list_sites,以识别目标站点
  2. 确认站点:如果有多个可用站点,请用户选择
  3. 检查计划限制:使用 Webflow MCP 的 data_sites_tool,并将操作设为 get_site,以验证集合数量限制
  4. 列出现有集合:使用 Webflow MCP 的 data_cms_tool,并将操作设为 get_collection_list,以检查冲突
  5. 验证命名:确保新集合名称与现有名称不冲突
阶段 2:收集需求
  1. 获取集合详情:询问用户:
    • 集合显示名称(例如,“Blog Posts”)
    • 单数名称(例如,“Blog Post”)
    • 可选:自定义 slug(默认:根据显示名称自动生成)
  2. 获取字段定义:对于每个字段,收集以下信息:
    • 字段名称(例如,“Author Name”、“Publish Date”)
    • 字段类型(Text、Rich Text、Image、Option、Reference 等)
    • 是否必填
    • 任何验证规则或帮助文本
  3. 确定关系:判断集合是否需要:
    • 引用字段(一对多关系)
    • 多重引用字段(多对多关系)
    • 选项字段(受控词汇表)
阶段 3:验证并规划架构
  1. 验证字段类型:检查所有字段类型是否受支持
  2. 检查字段限制:确保符合 Webflow 限制:
    • 每个集合的字段数上限:因计划而异
    • 每个集合最多 5 个多重引用字段
  3. 规划创建顺序:按依赖关系组织字段:
    • 如果存在引用,按顺序创建集合
    • 先创建被引用的集合
    • 先创建选项字段,再创建引用字段
  4. 生成预览:显示包含所有字段的完整架构
阶段 4:用户批准
  1. 显示完整预览:展示:
    • 集合名称和 slug
    • 所有字段及其类型和属性
    • 与其他集合的任何关系
    • 计划限制验证结果
  2. 验证架构:检查常见问题:
    • 缺少必填字段(名称和 slug 始终为必填项)
    • 字段类型无效
    • 引用不存在的集合
    • 超出计划限制
  3. 请求确认:等待用户明确批准“create”
阶段 5:创建集合
  1. 创建集合:使用 Webflow MCP 的 data_cms_tool,并将操作设为 create_collection,同时提供:
    • 显示名称
    • 单数名称
    • 可选的 slug
  2. 记录集合 ID:保存 ID 以供创建字段时使用
  3. 显示进度:报告集合已成功创建
阶段 6:创建字段
  1. 按顺序创建字段:对于每个字段:
    • 根据类型使用相应的创建工具
    • 静态字段:使用操作为 create_collection_static_field 的 data_cms_tool
    • 选项字段:使用操作为 create_collection_option_field 的 data_cms_tool
    • 引用字段:使用操作为 create_collection_reference_field 的 data_cms_tool
  2. 设置字段属性:
    • 显示名称
    • 必填标记
    • 帮助文本(如有提供)
    • 验证规则(如适用)
  3. 显示进度:报告每个已创建的字段
  4. 处理错误:如果字段创建失败,报告错误并继续
阶段 7:验证与报告
  1. 验证集合:使用 Webflow MCP 的 data_cms_tool,并将操作设为 get_collection_details,以获取完整架构
  2. 确认所有字段:检查是否已创建所有请求的字段
  3. 生成报告:显示:
    • 集合 ID
    • 集合名称和别名
    • 所有已创建字段及其 ID
    • 任何失败或警告
  4. 提供后续步骤:建议:
    • 使用 bulk-cms-update 添加初始条目
    • 在 Designer 中创建集合页面
    • 如适用,设置关联关系

字段类型参考

静态字段类型

PlainText - 短文本(最多 256 个字符)或长文本

  • 用于:标题、姓名、描述、摘要
  • 属性:maxLength 验证(短文本为 256)
  • 示例:"Title"(标题)、"Author Name"(作者姓名)、"Excerpt"(摘要)

RichText - 带 HTML 格式的文本

  • 用于:博客内容、简介、文章、长篇描述
  • 属性:无长度限制
  • 示例:"Post Content"(文章内容)、"Bio"(简介)、"Description"(描述)

Email - 电子邮件地址

  • 用于:联系邮箱、作者邮箱
  • 属性:电子邮件格式验证
  • 示例:"Contact Email"(联系邮箱)、"Author Email"(作者邮箱)

Phone - 电话号码

  • 用于:联系电话
  • 属性:E.164 格式
  • 示例:"Phone Number"(电话号码)、"Mobile"(手机)

Link - 外部 URL 或内部链接

  • 用于:网站链接、社交媒体、外部资源
  • 属性:URL 验证
  • 示例:"Website"(网站)、"LinkedIn Profile"(LinkedIn 个人资料)

Number - 数值

  • 用于:价格、评分、数量、订单号
  • 属性:整数或小数
  • 示例:"Price"(价格)、"Rating"(评分)、"Order"(订单)

Image - 单张图片

  • 用于:主图、照片、缩略图
  • 属性:每张图片最大 4MB
  • 示例:"Featured Image"(主图)、"Photo"(照片)、"Thumbnail"(缩略图)

MultiImage - 多张图片(最多 25 张)

  • 用于:图库、产品照片
  • 属性:最多 25 张图片,每张 4MB
  • 示例:"Gallery"(图库)、"Product Photos"(产品照片)

File - 文件上传

  • 用于:PDF、文档、下载内容
  • 属性:每个文件最大 4MB
  • 示例:"Resume PDF"(简历 PDF)、"Brochure"(宣传册)、"Manual"(手册)

Video - 视频嵌入(YouTube/Vimeo)

  • 用于:视频内容
  • 属性:嵌入 URL
  • 示例:"Tutorial Video"(教程视频)、"Demo"(演示)

DateTime - 日期和/或时间

  • 用于:发布日期、活动日期、截止日期
  • 属性:ISO 8601 格式
  • 示例:"Publish Date"(发布日期)、"Event Date"(活动日期)

Switch - 布尔值(true/false)

  • 用于:精选标记、可见性开关
  • 属性:布尔值
  • 示例:"Featured"(精选)、"Published"(已发布)、"Active"(启用)

Color - 颜色值

  • 用于:主题颜色、点缀色、品牌颜色
  • 属性:十六进制格式
  • 示例:"Brand Color"(品牌颜色)、"Accent Color"(点缀色)
选项字段类型

Option - 从预定义列表中单选

  • 用于:状态、类别、类型、优先级
  • 属性:选项名称列表
  • 示例:"Status"(状态)(Draft(草稿)、Review(审核中)、Published(已发布))
  • 创建:使用 data_cms_tool,将操作设为 create_collection_option_field,并传入选项数组

示例:

{
  "type": "Option",
  "displayName": "Status",
  "metadata": {
    "options": [
      {"name": "Draft"},
      {"name": "In Review"},
      {"name": "Published"}
    ]
  }
}
引用字段类型

Reference - 链接到另一个集合中的一个项目(一对多)

  • 用途:作者 → 文章、类别 → 文章、品牌 → 产品
  • 属性:被引用集合的 Collection ID
  • 示例:"作者"(引用 Authors 集合)
  • 创建:使用 data_cms_tool,操作为 create_collection_reference_field,并提供 collectionId

MultiReference - 链接到另一个集合中的多个项目(多对多)

  • 用途:文章 → 标签、产品 → 功能、项目 → 技术
  • 属性:被引用集合的 Collection ID
  • 限制:每个集合最多 5 个多重引用字段
  • 示例:"标签"(引用 Tags 集合)
  • 创建:使用 data_cms_tool,操作为 create_collection_reference_field,并提供 collectionId

引用字段示例:

{
  "type": "Reference",
  "displayName": "Author",
  "metadata": {
    "collectionId": "abc123..."
  }
}

多重引用字段示例:

{
  "type": "MultiReference",
  "displayName": "Tags",
  "metadata": {
    "collectionId": "xyz789..."
  }
}

示例

示例 1:简单博客集合

用户提示词:

Create a Blog Posts collection with title, content, author, and publish date

步骤 1:探索

🔍 CMS Collection Setup

Available sites:
1. Company Website
2. Blog Site

Which site? (1/2)

步骤 2:用户选择站点后

📊 Existing Collections on Company Website:

Currently: 0 collections
Plan limit: 20 collections (CMS Plan)

✅ You have capacity to create new collections.

---

📋 Collection Requirements

Display Name: Blog Posts
Singular Name: Blog Post
Slug: blog-posts (auto-generated)

Fields to create:
1. Title - Text (required)
2. Content - Rich Text (required)
3. Author - Text
4. Publish Date - Date/Time (required)

Is this correct? (yes/no)
If you want to add/modify fields, describe the changes.

步骤 3:预览

📋 Preview: Create "Blog Posts" Collection

Collection:
├── Display Name: Blog Posts
├── Singular Name: Blog Post
├── Slug: blog-posts
└── Site: Company Website

Fields (6 total):
├── name (PlainText, required) ← Auto-created
├── slug (PlainText, required) ← Auto-created
├── title (PlainText, required)
├── content (RichText, required)
├── author (PlainText)
└── publish-date (DateTime, required)

✅ Validation Passed:
- Collection name available
- Within plan limits (0/20 collections)
- All field types valid
- No dependency issues

⚠️ Type "create" to proceed.

步骤 4:创建

🔄 Creating Collection...

✅ Collection created: Blog Posts (ID: 64f1a2b3...)

Adding fields...
├── ✅ title (PlainText)
├── ✅ content (RichText)
├── ✅ author (PlainText)
└── ✅ publish-date (DateTime)

Progress: ████████████████████ 100% (4/4 fields)

🎉 Collection Setup Complete!

Collection: Blog Posts
ID: 64f1a2b3...
Fields: 6 (2 auto-created + 4 custom)

---

💡 Next Steps:
1. Use bulk-cms-update to add initial blog posts
2. Create collection template page in Designer
3. Set up collection list page for blog index
4. Configure SEO settings for dynamic pages
示例 2:包含关联关系的集合

用户提示词:

Create a Products collection with name, price, description, images, brand, and tags

步骤 1:初步收集信息后

📋 Collection Analysis

I see you want:
- Brand: This should be a reference field
- Tags: This should be a multi-reference field

This requires creating additional collections first:
1. Brands collection
2. Tags collection

Then we can create Products with references to them.

Would you like me to:
A) Create all three collections (Brands, Tags, Products)
B) Just create Products (you'll add relationships later)
C) Modify the requirements

Your choice? (A/B/C)

步骤 2:用户选择 "A" 后

📋 Preview: Create 3 Collections

---

### 1. Brands Collection

Fields (4 total):
├── name (PlainText, required) ← Auto
├── slug (PlainText, required) ← Auto
├── logo (Image)
└── description (PlainText)

---

### 2. Tags Collection

Fields (3 total):
├── name (PlainText, required) ← Auto
├── slug (PlainText, required) ← Auto
└── color (Color)

---

### 3. Products Collection

Fields (9 total):
├── name (PlainText, required) ← Auto
├── slug (PlainText, required) ← Auto
├── price (Number, required)
├── description (RichText)
├── images (MultiImage)
├── brand (Reference → Brands)
└── tags (MultiReference → Tags)

---

Creation Order:
1. Brands (no dependencies)
2. Tags (no dependencies)
3. Products (references 1 & 2)

✅ Validation:
- All collections available
- Within plan limits (0/20 collections)
- Multi-reference limit: 1/5 ✅
- All dependencies resolvable

⚠️ Type "create" to proceed with all 3 collections.

步骤 3:创建

🔄 Creating Collections...

[1/3] Creating Brands...
✅ Brands collection created (ID: abc123...)
├── ✅ logo (Image)
└── ✅ description (PlainText)

[2/3] Creating Tags...
✅ Tags collection created (ID: def456...)
└── ✅ color (Color)

[3/3] Creating Products...
✅ Products collection created (ID: ghi789...)
├── ✅ price (Number)
├── ✅ description (RichText)
├── ✅ images (MultiImage)
├── ✅ brand (Reference → Brands)
└── ✅ tags (MultiReference → Tags)

Progress: ████████████████████ 100% (3/3 collections)

🎉 All Collections Created!

Summary:
├── Brands (ID: abc123...)
├── Tags (ID: def456...)
└── Products (ID: ghi789...)

---

💡 Next Steps:
1. Add brand items first (use bulk-cms-update)
2. Add tag items (use bulk-cms-update)
3. Then add products with brand/tag references
4. Create collection pages in Designer
示例 3:带有选项字段的团队成员

用户提示词:

Create a Team Members collection with name, role (dropdown: Designer, Developer, Manager), bio, photo, email

步骤 1:预览

📋 Preview: Create "Team Members" Collection

Collection:
├── Display Name: Team Members
├── Singular Name: Team Member
└── Slug: team-members

Fields (7 total):
├── name (PlainText, required) ← Auto
├── slug (PlainText, required) ← Auto
├── role (Option, required)
│   Options:
│   ├── Designer
│   ├── Developer
│   └── Manager
├── bio (RichText)
├── photo (Image)
└── email (Email)

✅ Validation Passed

⚠️ Type "create" to proceed.

步骤 2:创建

🔄 Creating Collection...

✅ Collection created: Team Members (ID: jkl012...)

Adding fields...
├── ✅ role (Option: 3 options)
├── ✅ bio (RichText)
├── ✅ photo (Image)
└── ✅ email (Email)

Progress: ████████████████████ 100% (4/4 fields)

🎉 Collection Setup Complete!

Collection: Team Members
Fields: 6 (2 auto + 4 custom)

Field Details:
- role: Option field with 3 choices
  • Designer
  • Developer
  • Manager

---

💡 Next Steps:
1. Add team member items
2. Create team page in Designer
3. Consider adding:
   - LinkedIn profile (Link field)
   - Years of experience (Number field)
   - Specializations (MultiReference to Skills collection)
示例 4:复杂的电子商务设置

用户提示词:

Create an e-commerce setup with Products, Categories, Brands, and Features

步骤 1:明确需求

📋 E-commerce Collection Planning

I'll create 4 collections:

1. **Categories** - Product categories
2. **Brands** - Product brands
3. **Features** - Product features (e.g., "Waterproof", "Wireless")
4. **Products** - Main product catalog

Relationships:
- Product → Category (Reference)
- Product → Brand (Reference)
- Product → Features (MultiReference)

Fields per collection:

**Categories:**
- Name, Slug (auto)
- Description
- Parent Category (self-reference for hierarchy)
- Icon

**Brands:**
- Name, Slug (auto)
- Logo
- Description

**Features:**
- Name, Slug (auto)
- Icon
- Description

**Products:**
- Name, Slug (auto)
- Price
- Sale Price
- Description
- Images (MultiImage)
- Category (Reference → Categories)
- Brand (Reference → Brands)
- Features (MultiReference → Features)
- In Stock (Switch)
- SKU (PlainText)

Is this structure good? (yes/modify/cancel)

步骤 2:预览(用户回答 "yes")

📋 Preview: Create E-commerce Collections

---

### Collection 1: Categories

Fields (5 total):
├── name (PlainText, required)
├── slug (PlainText, required)
├── description (PlainText)
├── parent-category (Reference → Categories) ← Self-reference
└── icon (Image)

---

### Collection 2: Brands

Fields (4 total):
├── name (PlainText, required)
├── slug (PlainText, required)
├── logo (Image)
└── description (PlainText)

---

### Collection 3: Features

Fields (4 total):
├── name (PlainText, required)
├── slug (PlainText, required)
├── icon (Image)
└── description (PlainText)

---

### Collection 4: Products

Fields (12 total):
├── name (PlainText, required)
├── slug (PlainText, required)
├── price (Number, required)
├── sale-price (Number)
├── description (RichText)
├── images (MultiImage)
├── category (Reference → Categories)
├── brand (Reference → Brands)
├── features (MultiReference → Features)
├── in-stock (Switch)
└── sku (PlainText)

---

Creation Order:
1. Categories (self-reference OK)
2. Brands (no dependencies)
3. Features (no dependencies)
4. Products (references 1, 2, 3)

✅ Validation:
- Within plan limits (0/20 collections)
- Multi-reference count: 1/5 ✅
- All field types valid
- Self-reference supported

⚠️ Type "create" to proceed with all 4 collections.

步骤 3:创建并报告进度

🔄 Creating E-commerce Collections...

[1/4] Creating Categories...
✅ Categories created (ID: aaa111...)
Progress: ████████░░░░░░░░░░░░ 25%

[2/4] Creating Brands...
✅ Brands created (ID: bbb222...)
Progress: ████████████░░░░░░░░ 50%

[3/4] Creating Features...
✅ Features created (ID: ccc333...)
Progress: ████████████████░░░░ 75%

[4/4] Creating Products...
✅ Products created (ID: ddd444...)
Progress: ████████████████████ 100%

---

🎉 E-commerce Setup Complete!

Collections Created (4):
├── Categories (ID: aaa111..., 5 fields)
├── Brands (ID: bbb222..., 4 fields)
├── Features (ID: ccc333..., 4 fields)
└── Products (ID: ddd444..., 12 fields)

Relationships Configured:
- Products → Categories (one-to-many)
- Products → Brands (one-to-many)
- Products → Features (many-to-many)
- Categories → Parent Category (self-reference)

---

💡 Recommended Content Order:
1. Add categories first (including parent relationships)
2. Add brands
3. Add features
4. Finally add products (with all references)

💡 Next Steps:
1. Use bulk-cms-update for initial data
2. Create product template page
3. Create product listing page with filters
4. Set up category landing pages
5. Configure e-commerce integration

指南

阶段 1:探索最佳实践

站点选择:

  • 始终使用 data_sites_tool,操作为 list_sites,以获取可用站点
  • 切勿假设站点 ID
  • 确认用户选择了正确的站点

检查套餐限制:

Check limits before creation:
- Starter: 1 collection, 50 items
- Basic: 2 collections, 200 items
- CMS: 20 collections, 2,000 items
- Business: 40 collections, 10,000 items
- Enterprise: Custom

Warn user if approaching limits.

避免名称冲突:

  • 检查现有集合名称
  • 如果发生冲突,建议使用其他名称
  • 验证 slug 是否可用
阶段 2:收集需求的最佳实践

显示名称与单数名称:

Display Name: Plural form shown in CMS
Singular Name: Singular form for individual items

Examples:
- Display: "Blog Posts" → Singular: "Blog Post"
- Display: "Team Members" → Singular: "Team Member"
- Display: "Products" → Singular: "Product"
- Display: "Categories" → Singular: "Category"

字段命名约定:

✅ Good names:
- author-name (descriptive, hyphenated)
- publish-date (clear purpose)
- featured-image (specifies which)
- main-content (explains use)

❌ Bad names:
- text1 (meaningless)
- field (too generic)
- data (unclear)
- img (which image?)

检测关联关系:

If user says:
"... with author" → Likely reference field
"... with tags" → Likely multi-reference field
"... with category" → Likely reference field
"... with related products" → Likely multi-reference field

Ask clarifying questions:
- Is [author] the same across items? → Reference
- Can items have multiple [tags]? → Multi-reference
- Do you have a [Categories] collection? → Check existence
阶段 3:架构验证最佳实践

字段类型验证:

Common field type mappings:

User says... → Field type:
"title", "name" → PlainText
"description", "summary" → PlainText (long)
"content", "bio", "article" → RichText
"photo", "image", "thumbnail" → Image
"gallery", "photos" → MultiImage
"document", "PDF", "file" → File
"video" → Video
"link", "URL", "website" → Link
"email" → Email
"phone", "mobile" → Phone
"price", "cost", "amount" → Number
"date", "published", "deadline" → DateTime
"featured", "active", "published" → Switch
"status", "type", "category" → Option (if fixed choices)
"color", "theme" → Color

多重引用数量限制检查:

Count multi-reference fields requested:

If > 5:
⚠️ Warning: Collection Limit Exceeded

Webflow allows max 5 multi-reference fields per collection.

You requested: 7 multi-reference fields

Options:
1. Choose 5 most important relationships
2. Convert some to reference fields (one-to-many)
3. Create bridging collections
4. Use option fields for simple categorization

Which would you prefer?

依赖项解析:

For reference fields:
1. Check if referenced collection exists
2. If not, add to creation queue
3. Create in correct order

Example:
Products needs:
- Categories collection (create first)
- Brands collection (create first)
Then create Products
阶段 4:预览最佳实践

完整预览格式:

📋 Preview: Create "[Collection Name]"

Collection Details:
├── Display Name: [Name]
├── Singular Name: [Singular]
├── Slug: [slug]
└── Site: [Site Name]

Fields ([X] total):
├── name (PlainText, required) ← Auto-created
├── slug (PlainText, required) ← Auto-created
├── [field-1] ([Type], [required/optional])
├── [field-2] ([Type], [required/optional])
│   [Additional info if Option or Reference]
└── [field-n] ([Type], [required/optional])

Relationships:
├── [field] → [Collection] (Reference)
└── [field] → [Collection] (MultiReference)

✅ Validation Results:
- Collection name available: Yes
- Within plan limits: X/Y collections
- Multi-reference count: X/5
- All field types valid: Yes
- Dependencies resolved: Yes

⚠️ Type "create" to proceed.

验证检查:

Before showing preview:
1. ✅ Collection name available
2. ✅ Within plan collection limit
3. ✅ All field types supported
4. ✅ Multi-reference limit ≤ 5
5. ✅ Referenced collections exist or queued
6. ✅ No circular dependencies
7. ✅ Field names follow conventions
阶段 5:创建最佳实践

创建集合:

Required fields:
- displayName (required)
- singularName (required)
- slug (optional, auto-generated if omitted)

Always include both names for clarity:
✅ {"displayName": "Blog Posts", "singularName": "Blog Post"}
❌ {"displayName": "Blog Posts"} (missing singular)

错误处理:

If collection creation fails:
❌ Collection Creation Failed

Error: [Error message from API]

Common causes:
- Collection name already exists
- Invalid characters in name/slug
- Plan limit reached
- API authentication issue

Would you like to:
1. Try a different collection name
2. Check existing collections
3. Upgrade plan
4. Cancel operation
阶段 6:字段创建最佳实践

字段创建顺序:

Create fields in this order:
1. Static fields (Text, Rich Text, Number, etc.)
2. Option fields (with options defined)
3. Reference fields (after referenced collections exist)

For each field:
- Set displayName
- Set isRequired flag
- Add helpText if provided by user
- Set validation rules if applicable

字段创建工具:

Field Type → Tool to use:

PlainText, RichText, Email, Phone, Link, Number,
Image, MultiImage, File, Video, DateTime, Switch, Color
→ data_cms_tool with action create_collection_static_field

Option
→ data_cms_tool with action create_collection_option_field
   (requires metadata.options array)

Reference, MultiReference
→ data_cms_tool with action create_collection_reference_field
   (requires metadata.collectionId)

进度报告:

For each field created:
✅ [field-name] ([FieldType])

If field fails:
❌ [field-name] - [Error message]

Continue with remaining fields even if one fails.
Report all failures at end.

选项字段创建:

{
  "type": "Option",
  "displayName": "Status",
  "isRequired": false,
  "metadata": {
    "options": [
      {"name": "Draft"},
      {"name": "Published"},
      {"name": "Archived"}
    ]
  }
}

Notes:
- Options have name property
- Options cannot have ID (auto-generated)
- Minimum 2 options required
- Maximum: unlimited

引用字段创建:

{
  "type": "Reference",
  "displayName": "Author",
  "isRequired": true,
  "metadata": {
    "collectionId": "abc123..."
  }
}

For MultiReference:
{
  "type": "MultiReference",
  "displayName": "Tags",
  "metadata": {
    "collectionId": "def456..."
  }
}

Notes:
- Must provide collectionId of referenced collection
- Referenced collection must already exist
- Max 5 MultiReference fields per collection
阶段 7:验证最佳实践

创建后验证:

After creating collection and fields:
1. Call data_cms_tool with action get_collection_details with collection ID
2. Verify all fields present
3. Check field properties match request
4. Confirm relationships configured correctly

最终报告格式:

🎉 Collection Setup Complete!

Collection: [Name]
ID: [collection-id]
Slug: [slug]

Fields Created ([X]):
├── name (PlainText, required) ← Auto
├── slug (PlainText, required) ← Auto
├── [field-1] ([Type])
├── [field-2] ([Type])
└── [field-n] ([Type])

[If relationships exist]
Relationships:
├── [field] → [Collection]
└── [field] → [Collection]

[If any failures]
⚠️ Failed Fields ([Y]):
├── [field]: [error]
└── [field]: [error]

---

💡 Next Steps:
[Relevant suggestions based on collection type]

后续步骤建议:

For any collection:
1. Use bulk-cms-update to add initial items
2. Create collection template page in Designer
3. Create collection list page
4. Configure SEO settings

For collections with relationships:
5. Create referenced collections first
6. Add items in dependency order
7. Test relationship displays

For e-commerce:
5. Set up payment integration
6. Configure inventory management
7. Create checkout flow
阶段 8:错误处理

常见错误:

1. 集合名称冲突:

❌ Collection Already Exists

A collection named "Blog Posts" already exists on this site.

Existing collection:
- Name: Blog Posts
- ID: xyz789...
- Created: 2025-12-15

Would you like to:
1. Choose a different name
2. View existing collection
3. Add fields to existing collection
4. Cancel

2. 达到套餐限制:

❌ Plan Limit Reached

Cannot create collection. You've reached your plan limit.

Current: 20/20 collections (CMS Plan)

Options:
1. Upgrade to Business Plan (40 collections)
2. Delete unused collections
3. Contact Webflow support

Would you like me to show your existing collections?

3. 字段类型无效:

❌ Invalid Field Type

Field type "dropdown" is not supported by Webflow.

Did you mean:
- "Option" - Single choice from list
- "Reference" - Link to another collection
- "MultiReference" - Link to multiple items

Which would you like to use?

4. 找不到被引用的集合:

❌ Referenced Collection Not Found

Cannot create reference field to "Authors" collection.

Issue: "Authors" collection doesn't exist yet.

Solutions:
1. Create "Authors" collection first
2. Remove reference field for now
3. Let me create both collections in order

Your choice? (1/2/3)

5. 超出多重引用数量限制:

❌ Too Many Multi-Reference Fields

You requested 6 multi-reference fields.
Webflow limit: 5 per collection

Requested:
1. Tags
2. Categories
3. Related Products
4. Features
5. Certifications
6. Compatible Products ← Exceeds limit

Choose 5 to keep, or convert one to Reference field.
阶段 9:高级场景

自引用集合:

Example: Categories with parent categories

Collection: Categories
Fields:
├── name (PlainText, required)
├── slug (PlainText, required)
├── parent-category (Reference → Categories)
└── level (Number) - 1, 2, 3 for hierarchy

Implementation:
{
  "type": "Reference",
  "displayName": "Parent Category",
  "isRequired": false,
  "metadata": {
    "collectionId": "[same-collection-id]"
  }
}

Note: Must create collection first, then add self-reference field

多集合设置:

When creating multiple related collections:

1. Identify dependencies:
   - Which collections reference others?
   - What's the creation order?

2. Create in order:
   - Independent collections first
   - Dependent collections after

3. Show overall progress:
   [1/4] Creating Categories...
   [2/4] Creating Brands...
   [3/4] Creating Tags...
   [4/4] Creating Products...

4. Report collectively:
   All 4 collections created successfully!

复杂选项字段:

For complex dropdowns:

User: "Create status field with Draft, In Review, Approved, Published, Archived"

Option field with 5 choices:
{
  "type": "Option",
  "displayName": "Status",
  "isRequired": true,
  "metadata": {
    "options": [
      {"name": "Draft"},
      {"name": "In Review"},
      {"name": "Approved"},
      {"name": "Published"},
      {"name": "Archived"}
    ]
  }
}

Tip: Use workflow order for options

生产检查清单

在确认集合设置完成前:

✅ 探索
  • 已选择并确认站点
  • 已检查套餐限制
  • 已列出现有集合
  • 没有名称冲突
  • 用户拥有适当权限
✅ 需求
  • 已收集显示名称
  • 已收集单数名称
  • 已定义所有字段及其类型
  • 已注明必填项与可选项
  • 已识别关联关系
✅ 验证
  • 所有字段类型均有效
  • 多重引用数量 ≤ 5
  • 引用的集合已存在或已排队
  • 无循环依赖
  • 字段名称符合规范
  • 符合套餐限制
✅ 预览
  • 显示完整架构
  • 列出所有字段及其属性
  • 显示关联关系
  • 显示验证结果
  • 已获得用户确认
✅ 创建
  • 集合已成功创建
  • 已记录集合 ID
  • 已创建所有字段
  • 已处理字段创建错误
  • 已向用户显示进度
✅ 验证确认
  • 已检索并验证集合
  • 所有字段均存在
  • 字段属性正确
  • 已配置关联关系
  • 已报告任何错误
✅ 报告
  • 已提供最终摘要
  • 已分享集合 ID
  • 已列出字段
  • 已报告失败情况(如有)
  • 已建议后续步骤
✅ 错误处理
  • 已处理集合冲突
  • 已检查套餐限制
  • 已捕获无效字段类型
  • 已检测缺失的引用
  • 已报告部分失败

评论

支持 Markdown