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.

referencesamis-templates.md

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

amis 页面模板参考

核心模板方法

提供常用的 amis 页面生成模式和最佳实践。

1. CRUD 页面模板

新增按钮模板

{
  "type": "button",
  "label": "新增",
  "icon": "fa fa-plus-circle",
  "className": "inline-block text-primary",
  "onEvent": {
    "click": {
      "actions": [
        {
          "actionType": "dialog",
          "dialog": {
            "type": "dialog",
            "title": "新增",
            "size": "lg",
            "closeOnEsc": false,
            "closeOnOutside": false,
            "showCloseButton": true,
            "resizable": true,
            "body": [
              {
                "type": "form",
                "api": {
                  "method": "post",
                  "url": "/api/create"
                },
                "body": [
                  // 表单字段
                ]
              }
            ]
          }
        }
      ]
    }
  }
}

编辑按钮模板

{
  "type": "button",
  "label": "编辑",
  "level": "link",
  "onEvent": {
    "click": {
      "actions": [
        {
          "actionType": "dialog",
          "dialog": {
            "type": "dialog",
            "title": "编辑",
            "size": "lg",
            "body": [
              {
                "type": "form",
                "initApi": {
                  "method": "get",
                  "url": "/api/get?id=${id}"
                },
                "api": {
                  "method": "put",
                  "url": "/api/update"
                },
                "body": [
                  // 表单字段
                ]
              }
            ]
          }
        }
      ]
    }
  }
}

删除按钮模板

{
  "type": "button",
  "label": "删除",
  "level": "link",
  "className": "text-danger",
  "confirmText": "确认删除?",
  "onEvent": {
    "click": {
      "actions": [
        {
          "actionType": "ajax",
          "api": {
            "method": "delete",
            "url": "/api/delete?id=${id}"
          }
        }
      ]
    }
  }
}

完整 CRUD 页面模板

{
  "type": "page",
  "body": [
    {
      "type": "crud",
      "api": {
        "method": "get",
        "url": "/api/list"
      },
      "headerToolbar": [
        {
          "type": "button",
          "label": "新增",
          "icon": "fa fa-plus-circle",
          "actionType": "dialog",
          "dialog": {
            "title": "新增",
            "size": "lg",
            "body": {
              "type": "form",
              "api": "/api/create",
              "body": []
            }
          }
        },
        "bulkActions",
        "filter-toggler",
        "reload"
      ],
      "columns": [
        {
          "name": "id",
          "label": "ID",
          "sortable": true
        },
        {
          "type": "operation",
          "label": "操作",
          "buttons": [
            {
              "type": "button",
              "label": "编辑",
              "level": "link",
              "actionType": "dialog",
              "dialog": {
                "title": "编辑",
                "body": {
                  "type": "form",
                  "initApi": "/api/get?id=${id}",
                  "api": "/api/update",
                  "body": []
                }
              }
            },
            {
              "type": "button",
              "label": "删除",
              "level": "link",
              "className": "text-danger",
              "confirmText": "确认删除?",
              "actionType": "ajax",
              "api": "delete:/api/delete?id=${id}"
            }
          ]
        }
      ]
    }
  ]
}

2. 表单模板

基础表单模板

{
  "type": "form",
  "mode": "horizontal",
  "labelWidth": 112,
  "columnCount": 2,
  "api": {
    "method": "post",
    "url": "/api/create"
  },
  "body": [
    // 表单字段
  ]
}

带初始化数据的表单

{
  "type": "form",
  "mode": "horizontal",
  "labelWidth": 112,
  "columnCount": 2,
  "initApi": {
    "method": "get",
    "url": "/api/get?id=${id}"
  },
  "api": {
    "method": "put",
    "url": "/api/update"
  },
  "body": [
    // 表单字段
  ]
}

3. 卡片模板

卡片列表模板

{
  "type": "cards",
  "api": {
    "method": "get",
    "url": "/api/list"
  },
  "columnsCount": 3,
  "card": {
    "header": {
      "title": "${name}",
      "subTitle": "${description}"
    },
    "body": [
      {
        "label": "状态",
        "name": "status"
      }
    ],
    "actions": [
      {
        "type": "button",
        "label": "查看详情",
        "level": "link"
      }
    ]
  }
}

4. Tab 视图模板

Tab 页面模板

{
  "type": "tabs",
  "tabs": [
    {
      "title": "基本信息",
      "body": [
        {
          "type": "form",
          "body": []
        }
      ]
    },
    {
      "title": "详细信息",
      "body": [
        {
          "type": "form",
          "body": []
        }
      ]
    }
  ]
}

5. 关键配置说明

Dialog vs Drawer

  • Dialog(对话框):actionType: 'dialog'

    • 适合:简单表单、确认操作
    • 尺寸:size: "sm" | "md" | "lg" | "xl"
  • Drawer(抽屉):actionType: 'drawer'

    • 适合:复杂表单、详情展示
    • 位置:position: "left" | "right" | "top" | "bottom"

表单布局

  • 水平布局:mode: "horizontal"

    • 标签在左,输入框在右
    • 配合 labelWidth: 112 设置标签宽度
  • 多列布局:columnCount: 2

    • 字段分多列显示
    • 适合字段较多的表单

API 配置规范

{
  "api": {
    "method": "post",
    "url": "/api/create",
    "data": {
      // 额外参数
    }
  }
}

事件绑定

{
  "onEvent": {
    "click": {
      "actions": [
        {
          "actionType": "dialog",
          "dialog": {...}
        }
      ]
    }
  }
}

6. 常用模式总结

新增操作

  1. 按钮触发 Dialog/Drawer
  2. Dialog/Drawer 中包含 Form
  3. Form 的 api 指向 create 接口

编辑操作

  1. 按钮触发 Dialog/Drawer
  2. Form 的 initApi 获取数据
  3. Form 的 api 指向 update 接口

删除操作

  1. 按钮触发 ajax 请求
  2. 添加 confirmText 确认
  3. api 指向 delete 接口

列表操作

  1. CRUD 组件的 api 获取列表
  2. headerToolbar 配置顶部按钮
  3. columns 配置列和操作按钮

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