Agent Skillsumbraco/Umbraco-CMS › general-add-value-type

general-add-value-type

GitHub

向 UmbValueTypeMap 添加新的值类型常量,用于功能或属性编辑器声明值类型。

src/Umbraco.Web.UI.Client/.claude/skills/general-add-value-type/SKILL.md umbraco/Umbraco-CMS

Trigger Scenarios

需要为功能声明值类型 属性编辑器需暴露值类型

Install

npx skills add umbraco/Umbraco-CMS --skill general-add-value-type -g -y
More Options

Non-standard path

npx skills add https://github.com/umbraco/Umbraco-CMS/tree/main/src/Umbraco.Web.UI.Client/.claude/skills/general-add-value-type -g -y

Use without installing

npx skills use umbraco/Umbraco-CMS@general-add-value-type

指定 Agent (Claude Code)

npx skills add umbraco/Umbraco-CMS --skill general-add-value-type -a claude-code -g -y

安装 repo 全部 skill

npx skills add umbraco/Umbraco-CMS --all -g -y

预览 repo 内 skill

npx skills add umbraco/Umbraco-CMS --list

SKILL.md

Frontmatter
{
    "name": "general-add-value-type",
    "description": "Add a new value type — a named, typed string constant that extends UmbValueTypeMap. Use when a feature needs to declare what type of value it holds so it can be referenced in collection columns or value summary manifests. Also use when a property editor needs to expose its value type for use in collection views.",
    "allowed-tools": "Read, Write, Edit, Grep, Glob"
}

Add Value Type

Add a new value type constant to UmbValueTypeMap.

Foundational documentation

Read before proceeding:

  • Value Type — full reference, naming convention, rules

What you need from the user

  1. Feature name — kebab-case (e.g., color-picker, user-group)
  2. Package path — where the feature lives (e.g., src/packages/property-editors/color-picker/)
  3. Value type key — the string alias:
    • For a property editor: use the schema alias (e.g., 'Umbraco.ColorPicker')
    • For a domain type: use Umb.ValueType.{Entity}.{Shape} (e.g., 'Umb.ValueType.UserGroup.References')
  4. TypeScript type — the type of the raw value (e.g., string, boolean, UmbReferenceByUnique[])

Step 1: Create the constant file

File: {package-path}/value-type/constants.ts

export const UMB_{FEATURE}_VALUE_TYPE = '{value-type-key}' as const;

declare global {
	interface UmbValueTypeMap {
		[UMB_{FEATURE}_VALUE_TYPE]: {TValue};
	}
}

Rules:

  • The string value is always as const.
  • The declare global block is in the same file as the constant.
  • One constant per file — do not group multiple value types.

Property editor example

import type { UmbColorPickerPropertyEditorValue } from '../types.js';

export const UMB_COLOR_PICKER_VALUE_TYPE = 'Umbraco.ColorPicker' as const;

declare global {
	interface UmbValueTypeMap {
		[UMB_COLOR_PICKER_VALUE_TYPE]: UmbColorPickerPropertyEditorValue;
	}
}

Domain type example

import type { UmbReferenceByUnique } from '@umbraco-cms/backoffice/models';

export const UMB_USER_GROUP_REFERENCES_VALUE_TYPE = 'Umb.ValueType.UserGroup.References' as const;

declare global {
	interface UmbValueTypeMap {
		[UMB_USER_GROUP_REFERENCES_VALUE_TYPE]: UmbReferenceByUnique[];
	}
}

Step 2: Export from the package index

Add to the package index.ts:

export * from './value-type/constants.js';

Checklist

  • Constant declared with as const
  • declare global block extends UmbValueTypeMap in the same file
  • Key follows naming convention (schema alias for property editors, Umb.ValueType.{Entity}.{Shape} for domain types)
  • TypeScript type is the correct raw value type
  • One constant per file
  • Constant exported from package index.ts
  • Compiles: npm run compile

Version History

  • c1fa32e Current 2026-08-20 13:48

Same Skill Collection

.claude/skills/umb-bump-version/SKILL.md
.claude/skills/umb-release-notes/SKILL.md
src/Umbraco.Web.UI.Client/.claude/skills/core-add-module/SKILL.md
src/Umbraco.Web.UI.Client/.claude/skills/general-add-localization/SKILL.md
src/Umbraco.Web.UI.Client/.claude/skills/general-create-condition/SKILL.md
src/Umbraco.Web.UI.Client/.claude/skills/general-create-extension-type/SKILL.md
src/Umbraco.Web.UI.Client/.claude/skills/general-create-kind/SKILL.md
src/Umbraco.Web.UI.Client/.claude/skills/general-create-package/SKILL.md
src/Umbraco.Web.UI.Client/.claude/skills/general-create-repository/SKILL.md
src/Umbraco.Web.UI.Client/.claude/skills/general-create-workspace/SKILL.md
src/Umbraco.Web.UI.Client/.claude/skills/general-deprecate-api/SKILL.md
.claude/skills/umb-review/SKILL.md
.claude/skills/umb-update-openapi/SKILL.md
.claude/skills/umb-update-server-dependencies-for-minor/SKILL.md

Metadata

Files
0
Version
c1fa32e
Hash
79cebe53
Indexed
2026-08-20 13:48

- 위키
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-25 08:46
浙ICP备14020137号-1 $방문자$