All skills
bamzc avatar

/amis-builder

@b06da4d

amis 低代码框架专家和知识库。**严格触发条件**:用户必须明确提到 'amis'、'低代码'、'百度 amis' 等关键词。**核心能力**:(1) 回答 amis 使用问题(组件用法、属性配置、表达式、事件等),(2) 生成 amis JSON schema(CRUD、表单、卡片、对话框等),(3) 生成 amis 静态 HTML 预览页面(仅当用户明确要求 amis + 预览/静态HTML 时),(4) 调试和优化 amis 配置。**严格禁止触发**:(1) 用户未提及 amis 或低代码,(2) 用户明确要求其他框架(React、Vue、Angular、Vite 等工程化项目),(3) 用户只说'生成表单'但没提 amis。**关键词**:amis、低代码、百度 amis、aisuda、amis schema、amis 组件、amis 预览。

Use this Skill: https://skilld.dev/gh/bamzc/claude-skills-frontend/amis-builder

This session only. Nothing lands on disk.

referencesfield-types.md

≈1.5k tokens on demand. Your agent reads this file only when SKILL.md points to it.

amis 字段类型配置

字段类型映射表

根据 fieldType 和 fieldAttribute 生成对应的 amis 组件配置。

fieldType fieldAttribute 组件类型 说明
1 input-text input-text 文本输入
2 input-number input-number 数字输入
3 textarea textarea 多行文本
4 select select 下拉选择
5 input-date input-date 日期选择
6 input-image input-image 图片上传
7 input-file input-file 文件上传
8 switch switch 开关
9 input-city input-city 城市选择
10 input-color input-color 颜色选择
11 input-datetime input-datetime 日期时间选择
12 input-date-range input-date-range 日期范围
13 input-datetime-range input-datetime-range 日期时间范围
14 tree-select tree-select 树形选择
15 input-rich-text input-rich-text 富文本编辑器
16 input-formula input-formula 公式编辑器
17 json-editor json-editor JSON编辑器

组件配置模板

input-text (文本输入)

{
  "type": "input-text",
  "name": "username",
  "label": "用户名",
  "placeholder": "请输入内容",
  "required": false
}

input-number (数字输入)

{
  "type": "input-number",
  "name": "age",
  "label": "年龄",
  "placeholder": "请输入内容",
  "min": 0,
  "max": 120
}

textarea (多行文本)

{
  "type": "textarea",
  "name": "description",
  "label": "描述",
  "minRows": 3,
  "maxRows": 10
}

input-rich-text (富文本)

{
  "type": "input-rich-text",
  "name": "content",
  "label": "内容",
  "receiver": "/api/upload",
  "vendor": "tinymce"
}

input-date (日期选择)

{
  "type": "input-date",
  "name": "birthday",
  "label": "生日",
  "format": "YYYY-MM-DD",
  "inputFormat": "YYYY-MM-DD",
  "placeholder": "请选择日期"
}

input-datetime (日期时间选择)

{
  "type": "input-datetime",
  "name": "createdAt",
  "label": "创建时间",
  "format": "YYYY-MM-DD HH:mm:ss",
  "inputFormat": "YYYY-MM-DD HH:mm:ss",
  "placeholder": "请选择日期时间"
}

input-date-range (日期范围)

{
  "type": "input-date-range",
  "name": "dateRange",
  "label": "日期范围",
  "format": "YYYY-MM-DD",
  "inputFormat": "YYYY-MM-DD",
  "placeholder": "请选择日期范围",
  "clearable": true
}

input-datetime-range (日期时间范围)

{
  "type": "input-datetime-range",
  "name": "datetimeRange",
  "label": "日期时间范围",
  "format": "YYYY-MM-DD HH:mm:ss",
  "inputFormat": "YYYY-MM-DD HH:mm:ss",
  "placeholder": "请选择日期时间范围",
  "ranges": [
    "yesterday",
    "7daysago",
    "prevweek",
    "thismonth",
    "prevmonth",
    "prevquarter"
  ]
}

select (下拉选择)

{
  "type": "select",
  "name": "category",
  "label": "分类",
  "placeholder": "请选择",
  "searchable": true,
  "options": [
    {"label": "选项1", "value": "1"},
    {"label": "选项2", "value": "2"}
  ]
}

select (下拉选择 - 接口数据源)

{
  "type": "select",
  "name": "category",
  "label": "分类",
  "placeholder": "请选择",
  "searchable": true,
  "source": {
    "method": "get",
    "url": "/api/options"
  }
}

tree-select (树形选择)

{
  "type": "tree-select",
  "name": "department",
  "label": "部门",
  "placeholder": "请选择",
  "searchable": true,
  "multiple": false,
  "enableNodePath": false,
  "showIcon": true,
  "initiallyOpen": true,
  "source": {
    "method": "get",
    "url": "/api/departments"
  }
}

switch (开关)

{
  "type": "switch",
  "name": "enabled",
  "label": "启用",
  "option": "启用"
}

input-city (城市选择)

{
  "type": "input-city",
  "name": "city",
  "label": "城市",
  "placeholder": "请选择城市"
}

input-color (颜色选择)

{
  "type": "input-color",
  "name": "color",
  "label": "颜色"
}

input-image (图片上传)

{
  "type": "input-image",
  "name": "avatar",
  "label": "头像",
  "autoUpload": true,
  "proxy": true,
  "uploadType": "fileReceptor",
  "imageClassName": "r w-full",
  "receiver": "/api/upload",
  "multiple": false,
  "hideUploadButton": false,
  "fixedSize": false,
  "accept": ".jpeg,.jpg,.png,.gif"
}

input-file (文件上传)

{
  "type": "input-file",
  "name": "file",
  "label": "文件",
  "accept": "*",
  "btnLabel": "请选择文件",
  "receiver": "/api/upload",
  "maxLength": 1,
  "maxSize": 3145728,
  "hideUploadButton": false
}

input-formula (公式编辑器)

{
  "type": "input-formula",
  "name": "formula",
  "label": "公式",
  "variableMode": "tree",
  "evalMode": true,
  "variables": "${variables}",
  "required": false
}

json-editor (JSON 编辑器)

{
  "type": "json-editor",
  "name": "config",
  "label": "配置"
}

字段渲染逻辑

基础字段处理

const commonObj = {
  name: fields.name,
  label: fields.displayName,
  required: !!fields.isRequired
}

根据 fieldType 选择组件

// 根据 fieldAttribute 选择对应的组件类型
const formItemObj = formType[fields.fieldAttribute]
  ? formType[fields.fieldAttribute]
  : formType['input-text']

return { ...formItemObj, ...commonObj }

完整示例

输入字段:

{
  "name": "username",
  "displayName": "用户名",
  "fieldType": 1,
  "fieldAttribute": "input-text",
  "isRequired": 1
}

输出配置:

{
  "type": "input-text",
  "name": "username",
  "label": "用户名",
  "required": true,
  "placeholder": "请输入内容"
}

Source: SKILL.md on GitHub

No alerts6mo4 checks · Risk SAFE
  • Gen Agent Trust Hub7mo

    This skill serves as an expert for the amis low-code framework, providing documentation lookups and JSON schema generation. It utilizes a Python script to fetch official documentation from the Baidu GitHub repository and can generate HTML files to preview amis pages. All external interactions target well-known, trusted technology sources, and no malicious patterns or safety bypasses were found.

  • Socket6mo

    No alerts

  • Snyk7mo

    Risk: LOW · No issues

  • Runlayer7mo

    7 files scanned · No issues

Signed by skilld at b06da4d. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 months ago.

Dormantupdated 8 months ago

README badge

README badge for bamzc/claude-skills-frontend/amis-builder