modelscope.cn

questionnaire-config

问卷?

Installation

$ npx skills add https://modelscope.cn

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from modelscope.cn · top by installs.

npx skills add https://modelscope.cn

Browse all from modelscope.cn

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Skill metadata

Parsed from SKILL.md frontmatter.

Version1.0.0

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 5,317 B

History

  1. First recorded snapshot · 0 installs

SKILL.md

问卷配置生成技能

将自然语言描述的需求转换为问卷组件系统可导入的 JSON 配置文件。

详细属性说明请参阅 [REFERENCE.md](./REFERENCE.md)

适用场景

  • 用户提供问卷需求描述,需要生成对应的 JSON 配置
  • 用户需要根据已有的纸质表单或文档创建电子问卷配置
  • 用户需要修改、扩展现有问卷配置
  • 用户需要将一组表单字段需求转化为完整问卷结构

输出格式

始终输出新格式的导入配置 JSON,包含以下顶层结构:

{
  "schema": { "metadata": {}, "settings": {}, "sections": [] },
  "fieldsRegistry": [],
  "optionsRegistry": [],
  "exportedAt": ""
}

命名规范

ID 生成

所有 id 使用 10 位 NanoID 格式(字母+数字+-_组合):

  • 10 个字符长度
  • 示例:kczxEqdVT8nRkEjQLAeH

name 命名

所有字段和选项的 name 使用 蛇形命名法(snake_case)

  • 字段 name 示例:patientnamebloodpressurecurrent_medication
  • 选项 name 示例:gendermalesymptomcoughmedcategoryantifibrotic

选项注册表 name

使用蛇形命名 + options 后缀:genderoptionssymptomoptionsmmrcgrade_options

结构概览

schema.sections 组织方式

每个 section 通过 fieldGroups(字段组)和 subsections(子章节)组织内容。两者可同时存在,渲染顺序为 fieldGroups → subsections。

  • 字段较少(≤10):直接用 fieldGroups,可通过多个带 title 的 fieldGroup 分组
  • 字段较多且有子主题:使用 subsections 进一步分组,子主题支持独立折叠
  • 混合场景:section 顶部放几个通用字段的 fieldGroup,下方用 subsections 分区

section、subsection、fieldGroup 的完整属性表和示例见 [REFERENCE.md](./REFERENCE.md) 第 3-5 节

fieldsRegistry 字段注册表

集中存储所有字段定义,section 中通过字段 name(字符串)引用。

optionsRegistry 选项注册表

集中存储所有选项数据,字段通过注册名引用。支持多级嵌套(children)和条件显示选项(hasConditional)。

支持的字段类型

类型 说明 适用场景
text 单行文本 姓名、编号、简短输入
textarea 多行文本 病史描述、详细说明
number 数字输入 年龄、体重、血压值
radio 单选框组 性别、评分等级、是/否
checkbox 多选框组 症状、药物类别(可多选)
select 下拉选择 选项较多的单选/多选
date 日期选择 就诊日期、出生日期

每种字段类型的完整属性、特有参数和示例见 [REFERENCE.md](./REFERENCE.md) 第 6-7 节

validation 验证规则

基础结构:{ "required": true, "message": "错误提示" }

扩展能力:正则验证(pattern + presetKey)、长度限制(minLength/maxLength)、数值范围(min/max)

预设正则列表和详细用法见 [REFERENCE.md](./REFERENCE.md) 第 9 节

condition 条件显示

支持三种模式:简单条件、组合条件(AND/OR)、嵌套条件

操作符列表和条件配置示例见 [REFERENCE.md](./REFERENCE.md) 第 10 节

工作流程

步骤 1:理解需求

  • 确认问卷的目标受众和使用场景
  • 识别章节结构和字段分组
  • 梳理每个字段类型、验证规则、条件逻辑

步骤 2:规划结构

  1. 确定 metadata(标题、版本、描述)
  2. 划分 sections(章节)和 fieldGroups(字段组)
  3. 列出所有字段,确定类型和选项
  4. 识别条件显示关系

步骤 3:生成配置

按以下顺序构建 JSON:

  1. schema.metadata — 问卷基本信息
  2. schema.settings — 全局配置
  3. schema.sections — 章节结构(fields 用字符串引用)
  4. fieldsRegistry — 所有字段定义
  5. optionsRegistry — 所有选项定义
  6. exportedAt — 导出时间戳

步骤 4:校验检查

  • 所有 id 为 10 位 NanoID
  • 所有 name 使用蛇形命名
  • options 引用名与 optionsRegistry 中的 name 一致
  • sections 中 fields 引用与 fieldsRegistry 中 name 一致
  • condition 中的 fieldId 和 optionId 指向已存在的 id
  • validation 规则合理(如 number 字段的 min/max)
  • 字段特有参数正确(如 radio 的 direction/optionType)
  • 条件显示的字段放在与触发字段同一个 fieldGroup 中

注意事项

  • 不要猜测用户需求中没有提到的字段或选项
  • 带单位的数值字段(如身高、体重)使用 number 类型并设置 unit 属性
  • 需要用户自由输入的字段使用 text 或 textarea 类型
  • 选项较少(≤7个)且需要全部展示的使用 radio/checkbox,选项较多(>7个)的使用 select
  • 日期相关字段使用 date 类型,不要用 text 替代
  • 条件显示的字段放在与触发字段同一个 fieldGroup 中,确保条件引用能正确解析
  • 选项的 value 值使用有意义的英文标识,不要使用数字编号