用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/umbraco/Umbraco-CMS-Backoffice-Skills --skill umbraco-property-value-preset命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
Run tests from skill examples and generate a report (project)
Validate links and references in SKILL.md files using deterministic scripts
Umbraco backoffice extension customisation - complete working examples showing how extension types combine
基于 SOC 职业分类
正在显示 SKILL.md
| name | umbraco-property-value-preset |
| description | Implement property value presets in Umbraco backoffice using official docs |
| version | 1.0.0 |
| location | managed |
| allowed-tools | Read, Write, Edit, WebFetch |
Property Value Presets provide default values when users create new content. They use an API to supply preset values for specific property editors, enabling streamlined content creation with sensible defaults. Multiple presets can work together using the weight property to progressively modify values.
Always fetch the latest docs before implementing:
import type { ManifestPropertyValuePreset } from '@umbraco-cms/backoffice/extension-registry';
const manifest: ManifestPropertyValuePreset = {
type: 'propertyValuePreset',
alias: 'My.PropertyValuePreset.DefaultText',
name: 'Default Text Preset',
api: () => import('./default-text-preset.js'),
forPropertyEditorUiAlias: 'Umb.PropertyEditorUi.TextBox',
};
export const manifests = [manifest];
import type { UmbPropertyValuePresetApi } from '@umbraco-cms/backoffice/property';
export class DefaultTextPreset implements UmbPropertyValuePresetApi {
async processValue(value: unknown, config: unknown): Promise<unknown> {
// Return default if no value exists
return value ? value : 'Default text value';
}
destroy() {
// Cleanup if needed
}
}
export default DefaultTextPreset;
import type { UmbPropertyValuePresetApi, UmbPropertyEditorConfigCollection } from '@umbraco-cms/backoffice/property';
export class DynamicPreset implements UmbPropertyValuePresetApi {
async processValue(value: unknown, config: UmbPropertyEditorConfigCollection): Promise<unknown> {
if (value) return value;
// Use configuration to determine default
const defaultFromConfig = config?.getValueByAlias('defaultValue');
return defaultFromConfig || 'Fallback default';
}
destroy() {}
}
export default DynamicPreset;
import type { UmbPropertyValuePresetApi } from '@umbraco-cms/backoffice/property';
export class ApiPreset implements UmbPropertyValuePresetApi {
async processValue(value: unknown, config: unknown): Promise<unknown> {
if (value) return value;
// Fetch default from server
const response = await fetch('/api/defaults/text');
const data = await response.json();
return data.defaultValue;
}
destroy() {}
}
export default ApiPreset;
const manifest: ManifestPropertyValuePreset = {
type: 'propertyValuePreset',
alias: 'My.PropertyValuePreset.JsonDefault',
name: 'JSON Default Preset',
api: () => import('./json-preset.js'),
forPropertyEditorSchemaAlias: 'Umbraco.Plain.Json', // Target schema instead of UI
};
// First preset (runs first due to lower weight)
const basePreset: ManifestPropertyValuePreset = {
type: 'propertyValuePreset',
alias: 'My.PropertyValuePreset.Base',
name: 'Base Preset',
weight: 100,
api: () => import('./base-preset.js'),
forPropertyEditorUiAlias: 'Umb.PropertyEditorUi.TextBox',
};
// Second preset (runs after, can modify base value)
const enhancedPreset: ManifestPropertyValuePreset = {
type: 'propertyValuePreset',
alias: 'My.PropertyValuePreset.Enhanced',
name: 'Enhanced Preset',
weight: 200,
api: () => import('./enhanced-preset.js'),
forPropertyEditorUiAlias: 'Umb.PropertyEditorUi.TextBox',
};
export class TodayDatePreset implements UmbPropertyValuePresetApi {
async processValue(value: unknown, config: unknown): Promise<unknown> {
if (value) return value;
return new Date().toISOString().split('T')[0]; // Today's date
}
destroy() {}
}
export default TodayDatePreset;
That's it! Always fetch fresh docs, keep examples minimal, generate complete working code.