在 Manus 中运行任何 Skill
一键导入
一键导入
一键在 Manus 中运行任何 Skill
开始使用add-composite-type
星标0
分支1
更新时间2026年3月19日 08:02
Guidelines for adding a new Composite Type.
安装
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
SKILL.md
readonly菜单
Guidelines for adding a new Composite Type.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | add-composite-type |
| description | Guidelines for adding a new Composite Type. |
Composite Types in Forman are types which could be represented by a different structure, compound of multiple other, more primitive building blocks.
For example, when having a field of type udtspec,
{
"type": "udtspec",
"name": "customType"
}
it's a wrapper around a more primitive structure, which looks like this:
{
"type": "array",
"name": "customType",
"spec": [
{
"name": "name",
"label": "Name",
"placeholder": "Enter name",
"type": "text",
"required": true
},
{
"name": "label",
"label": "Label",
"help": "Display name for better readability.",
"type": "text",
"advanced": true
},
{
"name": "help",
"label": "Description",
"type": "text",
"multiline": true,
"required": false,
"placeholder": "Enter description"
},
{
"name": "type",
"label": "Type",
"type": "udttype",
"required": true,
"default": "text"
}
]
}
src/compositesudtspec it's array), add this to the type conversion map in both, validator and forman filessrc/composites/${compositeType}.ts. Each composite must export four functions:
${compositeType}Expand — morphs the composite field into its expanded primitive structure. Accepts and mutates the field definition, setting spec, type, etc. Returns the mutated field.${compositeType}ExtractInner — extracts the inner structural fragment from the fully converted JSON Schema to store in $defs. This fragment must NOT contain field-specific title/description. (e.g. for udtspec: returns schema.items; for udttype: returns schema minus title/description)${compositeType}WrapRef — builds a per-usage wrapper that references the $defs fragment via $ref and carries field-specific title/description/default. (e.g. for udtspec: { type: 'array', title, description, items: { $ref } }; for udttype: { allOf: [{ $ref }], title, description, default } — uses allOf for draft-07 compliance where siblings of $ref are ignored)${compositeType}Collapse — reverse conversion from JSON Schema to Forman (see below)compositeHandlers config in src/forman.ts:
const compositeHandlers = {
mytype: { expand: mytypeExpand, extractInner: mytypeExtractInner, wrapRef: mytypeWrapRef },
};
compositeHandlers block in toJSONSchemaInternal handles all composites uniformly:
x-composite marker is set via Object.defineProperty on both the inner fragment in $defs and on every wrapper — this is important for backward conversion$ref/$defs recursion prevention works:
ConversionContext has a defs?: Record<string, JSONSchema7> property for collecting definitions$defs stores only the inner structural fragment (no title/description). Title/description stay on each usage's wrapper.context.defs[type], expand (with label/help stripped), convert, extract inner via extractInner, store in $defs, then return wrapper via wrapRefwrapRef — each usage retains its own field-specific metadatadefs when the composite is actually used (lazy) — don't pre-populate $defs with unused definitionstoJSONSchema wrapper in index.ts attaches collected context.defs as $defs on the root output, but only if non-emptyx-composite property, and if it's equal to the composite type you're adding, then morph the field back to the composite structure and don't expand it further
${compositeType}Collapse, which will accept the expanded field definition, and will return the composite one, by basically doing the opposite of what ${compositeType}Expand doestest/composites folder