一键导入
cat-class-ingestors-schema
解释、生成和修改 Cat 项目的 `priv/config/class_ingestors_schema.yaml`。当任务涉及 class ingestor 的概念、YAML 语法,或 `steam`、`wikidata` 的 provider 配置时使用。手动调用触发。
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
解释、生成和修改 Cat 项目的 `priv/config/class_ingestors_schema.yaml`。当任务涉及 class ingestor 的概念、YAML 语法,或 `steam`、`wikidata` 的 provider 配置时使用。手动调用触发。
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
生成、解释和修改 Cat 项目的 `priv/config/catalog_schema.yaml`。当任务涉及 Catalog schema、Class / Property 定义、ClassProperty 绑定、Property.constraint、Class.subject_page_layout、claim_display、subject_explore_config,或需要为新领域生成可同步的 Catalog YAML 时使用。
使用 Cat 项目的 `mix cat.api_admin` 命令完成管理端操作任务。用于读取 `openapi/admin_openapi.yaml` 查找管理端接口,并调用管理端 API 查询列表、查看详情或执行管理端写操作。手动调用触发。
新增或修改 Cat 项目的管理端 API(`/api/admin/<context>/<action>`)。用于 `api_admin` 计划层、admin 列表/详情/写操作的后端实现。
Add and manage user-facing API endpoints in the Cat project using the CatApiSpec DSL. Use for the `api` plan layer, frontend/public APIs, schemas, generated request modules, and routes. For `/api/admin/...` endpoints use `manage-api-admin`.
创建和维护 Cat 项目的 PRD。用于按 domain 总览 + 粗粒度 feature 文档组织 docs/prds,包括 docs/prds/{domain}/overview.md、data_model.md、features/{feature_title}.md;也用于判断 feature 粒度、迁移旧版 aspect PRD,或生成可按 feature 复制到其他系统的产品规格。
Create, modify, or remove admin UI pages for the Cat project. Use when adding/editing/removing admin pages, admin list/detail views, admin management features, or when the user mentions admin UI, admin frontend, 管理端界面.
| name | cat-class-ingestors-schema |
| description | 解释、生成和修改 Cat 项目的 `priv/config/class_ingestors_schema.yaml`。当任务涉及 class ingestor 的概念、YAML 语法,或 `steam`、`wikidata` 的 provider 配置时使用。手动调用触发。 |
| disable-model-invocation | true |
这个 skill 只服务一个目标:正确理解和生成 priv/config/class_ingestors_schema.yaml。
它是一份 class -> provider 配置文件,描述某个 class 是否开放某个抓取型导入入口,以及该入口的 provider 配置。
生成这份 YAML 时,必须以 priv/config/catalog_schema.yaml 为前置输入。class_ingestors_schema 不能脱离 catalog_schema 单独设计。
开始生成前,先阅读 priv/config/catalog_schema.yaml。只有先读这份文件,才能知道当前系统里:
steamwikidatawikidata 提供语言回退和 claim mapping 配置form 手动表单入口如果 YAML 里需要引用的 class 或 property 还不存在,应该先处理 priv/config/catalog_schema.yaml,再生成 class_ingestors_schema。
class_ingestorssteam、wikidataform 不在这个 schema 里catalog_schema 的关系class_ingestors_schema 依赖 priv/config/catalog_schema.yaml 中已经定义好的:
classespropertiesclasses[].properties 绑定关系也就是说,ingestors 的生成不是“从 provider 倒推 schema”,而是“在既有 catalog schema 之上补充 provider 配置”。
原因:
class_idname 必须能命中已有 classwikidata 配置里的 property 必须已经绑定到当前 classsteam 也会检查当前 class 是否满足最小约束生成时应先看 priv/config/catalog_schema.yaml,再决定某个 class 能不能写 steam / wikidata。不先读这份文件,就无法知道当前系统中到底有什么属性可用。
priv/config/catalog_schema.yaml 基础语法这份文件本身也是一份 YAML object,当前最重要的根字段是:
classesproperties可以先把它理解成两层信息:
classes 负责定义“系统里有哪些 class,以及每个 class 绑定了哪些 property”properties 负责定义“这些 property 自己的全局数据结构和 datatype”基础结构示意:
classes:
- idname: 游戏
label: 游戏
properties:
- idname: SteamAppID
correction_mode: disabled
vote_threshold: 3
- idname: 官网URL
correction_mode: report
vote_threshold: 3
subject_explore_config:
filter_rows: []
show_keyword_search: false
subject_page_layout:
main_extra_modules: []
version: 1
properties:
- idname: SteamAppID
label: SteamAppID
datatype: identifier
- idname: 官网URL
label: 官网URL
datatype: string
classesclasses 是 listclasses[].idname例如:
classes[].idname=游戏 表示当前系统里存在 游戏 这个 classclass_ingestors_schema 里才可以写 class_idname: 游戏classes[].propertiesclasses[].properties 也是 listclasses[].properties[].idname例如:
游戏 的 properties 里有 SteamAppIDSteamAppID 已经绑定到 游戏steam 或 wikidata 的配置能不能成立这里要注意:classes[].properties 说的是“绑定关系”,不是 property 的完整定义。
propertiesproperties 是全局 property 定义列表properties[].idname 和 properties[].datatype例如:
properties[].idname=官网URLproperties[].datatype=string这才说明 官网URL 这个 property 存在,并且它的 datatype 是 string。
生成 class_ingestors_schema 时,至少要先从 catalog_schema 读出这几类信息:
classes[].idnameclasses[].properties[].idnameproperties[].idnameproperties[].datatype其他字段如:
labeldescriptionsubject_explore_configsubject_page_layoutmark_config它们属于 catalog 自身的展示或行为配置,通常不是生成 ingestor YAML 的核心判断依据。
顶层必须是 object,并且只允许一个根字段:
class_ingestors:
- class_idname: 游戏
provider: steam
enabled: true
config: {}
每个条目必须是 object,允许字段只有:
class_idnameproviderenabledconfig字段规则:
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
class_idname | string | 是 | 必须命中已有 class |
provider | string | 是 | 当前只允许 steam、wikidata |
enabled | boolean | 是 | 是否开放该入口 |
config | object | 是 | provider 专属配置;可以为空对象 |
补充规则:
{class_idname, provider} 不能重复steam最小写法:
class_ingestors:
- class_idname: 游戏
provider: steam
enabled: true
config: {}
当前实现约束:
steam 只允许配置到 class_idname=游戏SteamAppIDconfig 允许为空对象如果用户要求把 steam 开到别的 class,不要硬写 YAML;先说明当前代码不支持。
wikidata最小推荐写法:
class_ingestors:
- class_idname: 疾病
provider: wikidata
enabled: true
config:
identifier_property_idname: WikidataID
label_languages: [zh-hans, zh, en]
description_languages: [zh-hans, zh, en]
claim_mappings: []
config 允许字段:
identifier_property_idnamelabel_languagesdescription_languagesrequired_sitelink_site_keysclaim_mappingsacceptance默认语义:
identifier_property_idname 缺省时回落到 WikidataIDlabel_languages 缺省时回落到 [zh-hans, zh, en]description_languages 缺省时回落到 [zh-hans, zh, en]required_sitelink_site_keys 缺省时表示不额外要求 sitelinkclaim_mappings 必须是 listacceptance 缺省时表示不做条目准入过滤required_sitelink_site_keys 语法用于限制“条目必须具备哪些 sitelink site key 才允许导入”。
基础写法:
required_sitelink_site_keys: [zhwiki]
语义:
sitelinks 中存在[zhwiki] 表示“只接受带 zhwiki sitelink 的条目”acceptance 语法用于限制“哪些 Wikidata Item 允许导入到当前 class”。
基础写法:
acceptance:
mode: any
rules:
- wikidata_property_id: P279
operator: has_entity_id
entity_id: Q11422
- wikidata_property_id: P571
operator: year_between
min_year: 1980
max_year: 1999
允许字段:
moderulesmode 允许值:
allanyrules 必须是非空 list,每个条目允许字段:
wikidata_property_idoperatorentity_idmin_yearmax_year当前支持的 operator:
has_entity_idyear_between校验规则:
wikidata_property_id 必须是合法 PIDoperator=has_entity_id 时必须提供合法 entity_idoperator=year_between 时必须提供整数 min_year / max_yearoperator=year_between 时 max_year >= min_yearmode=all 表示所有规则都要命中mode=any 表示任一规则命中即可导入claim_mappings 语法基础写法:
claim_mappings:
- wikidata_property_id: P856
target_property_idname: 官网URL
transform: url
允许字段:
wikidata_property_idtarget_property_idnametarget_subject_fieldtransformrelated_class_idnamerelated_identifier_property_idname当前支持的 transform:
urltimecommons_mediaentity_to_related_subjecturl -> target_property_idname 必须绑定 stringtime -> target_property_idname 必须绑定 stringcommons_media -> target_property_idname 必须绑定 image,或 target_subject_field: cover_file_identity_to_related_subject -> target_property_idname 必须绑定 subjecttarget_property_idname 与 target_subject_field 只能填写一个。
target_subject_field 当前只支持 cover_file_id,用于把 Wikidata Commons 图片下载后写入 Subject 固有字段 subjects.cover_file_id,不会生成 claim。YAML 推荐写规范值 cover_file_id;subject.cover_file_id / subjects.cover_file_id 会被规范化为 cover_file_id。
claim_mappings:
- wikidata_property_id: P18
target_subject_field: cover_file_id
transform: commons_media
wikidata_property_id 必须是合法 PID,例如 P856。
entity_to_related_subject这种 transform 需要额外字段:
claim_mappings:
- wikidata_property_id: P50
target_property_idname: 作者
transform: entity_to_related_subject
related_class_idname: 人物
related_identifier_property_idname: WikidataID
额外校验点:
related_class_idname 必须存在related_identifier_property_idname 必须是该 related class 已绑定的 identifier propertytarget_property_idname 的 subject.allowed_class_idnames 必须包含 related_class_idnametarget_property_idname 的 subject.allowed_value_types 必须包含 id生成 class_ingestors_schema 前,先从 priv/config/catalog_schema.yaml 提取三件事:
只有这三件事明确后,才开始写 ingestor 条目。
以下情况属于改 class_ingestors_schema:
steamwikidataacceptance)claim_mappings以下情况不属于改 class_ingestors_schema:
WikidataID、SteamAppID 这类 property这些应先处理 catalog_schema。
priv/config/catalog_schema.yaml,不要跳过它直接写 provider 配置priv/config/catalog_schema.yaml,不要开始写 class_ingestors_schemawikidata 的 mappingidentifier_property_idnamelabel_languagesdescription_languagesclaim_mappings: []