Accepts a JSON definition of a data composition schema → generates Template.xml (DataCompositionSchema).
Parameters and command
| Parameter | Description |
|---|---|
DefinitionFile |
Path to the JSON file with the DCS definition (mutually exclusive with Value) |
Value |
JSON string with the DCS definition (mutually exclusive with DefinitionFile) |
OutputPath |
Path to the output Template.xml |
# Из файла
powershell.exe -NoProfile -File "${CLAUDE_SKILL_DIR}/scripts/skd-compile.ps1" -DefinitionFile "<json>" -OutputPath "<Template.xml>"
# Из строки (без промежуточного файла)
powershell.exe -NoProfile -File "${CLAUDE_SKILL_DIR}/scripts/skd-compile.ps1" -Value '<json-string>' -OutputPath "<Template.xml>"
JSON DSL — quick reference
Reference below. All examples are compilable as is.
Root structure
{
"dataSets": [...],
"calculatedFields": [...],
"totalFields": [...],
"parameters": [...],
"templates": [...],
"groupTemplates": [...],
"dataSetLinks": [...],
"settingsVariants": [...]
}
Defaults: dataSources → auto ИсточникДанных1/Local; settingsVariants → auto "Main" with details.
Data sets
Type by key: query → DataSetQuery, objectName → DataSetObject, items → DataSetUnion.
{ "name": "Продажи", "query": "ВЫБРАТЬ ...", "fields": [...] }
The query supports @file — a reference to an external .sql file instead of inline text: "query": "@queries/sales.sql". The path is resolved relative to the JSON file, then CWD.
DataSetObject — external data set (without a query source). Fields are described explicitly; data is passed as the second parameter ПроцессорКомпоновкиДанных.Инициализировать(Макет, Новый Структура("<objectName>", ТЗ), ...).
{ "name": "ЖурналОшибок", "objectName": "ЖурналОшибок", "fields": [
{ "field": "ТекстСообщения", "title": "Текст сообщения", "type": "string(150)" },
{ "field": "Расшифровка", "title": "Описание", "type": "CatalogRef.СтруктураПредприятия" }
]}
name — the name of the set in the schema, objectName — the key in the data transfer structure.
Fields — shorthand and object form
"Наименование" — просто имя
"Количество: decimal(15,2)" — имя + тип
"Организация: CatalogRef.Организации @dimension" — + роль
"Служебное: string #noFilter #noOrder" — + ограничения
Object form — when a title or other properties are needed:
{ "field": "ОстатокНаНачалоПериода", "title": "Остаток на начало периода" }
dataPath is automatically taken from fieldif not specified explicitly.
Multilingual title: "title": { "ru": "...", "en": "..." }. Applicable wherever title/presentation is accepted (fields, calculatedFields, parameters, settingsVariants, availableValues, etc.). The string is equivalent to { "ru": "..." }.
Types: string, string(N), decimal, decimal(D), decimal(D,F), boolean, date, dateTime, CatalogRef.X, DocumentRef.X, EnumRef.X, StandardPeriod. Reference types are emitted with inline namespace d5p1: (http://v8.1c.ru/8.1/data/enterprise/current-config). Building an EPF with reference types requires a base with the corresponding configuration.
decimal without parentheses = 10,2 (money by default), decimal(N) = N,0 (integer); ,nonneg at the end of the parentheses → AllowedSign=Nonnegative.
Composite type (several value types) — an array in object form: "type": ["CatalogRef.A", "CatalogRef.B"]. Qualifiers ((N), (D,F)) apply to each element.
Roles (shorthand or object):
@-flags:@dimension,@account,@balance,@period,@required,@autoOrder,@ignoreNullValues- KV:
balanceGroupName,balanceType(OpeningBalance/ClosingBalance),parentDimension,accountTypeExpression,expression,orderType(Asc/Desc),periodNumber,periodType
"Сумма: decimal(15,2) @balance balanceGroupName=Сумма balanceType=OpeningBalance"
Restrictions: #noField, #noFilter, #noGroup, #noOrder.
In object form: "useRestriction": { "field": true, "condition": true, "group": true, "order": true } or "restrict": ["noField", "noFilter"].
Additional object-form keys:
"presentationExpression": "<выражение>"— what to display instead of the field value. The original value remains "under the hood" for navigation/decryption."appearance": { "<параметр>": "<значение>" }— default column formatting (applies in all settings variants). Keys are platform parameters (ГоризонтальноеПоложение,МинимальнаяШирина,Формат,Тексти т.п.)."orderExpression": { "expression": "<выражение>", "orderType": "Asc"/"Desc", "autoOrder": true/false }— sorting the field by expression (e.g.ЕстьNULL(Поле.Порядок, 10000)).
{ "field": "Сумма", "title": "Сумма продажи", "type": "decimal(15,2)",
"appearance": { "ГоризонтальноеПоложение": "Right", "МинимальнаяШирина": "80" } }
Calculated fields (calculatedFields)
Shorthand: "Имя [Заголовок]: тип = Выражение #noField #noFilter #noGroup #noOrder" — all parts except the name are optional.
"calculatedFields": [
"Маржа = Цена - Закупка",
"Наценка [Наценка, %]: decimal(10,2) = Маржа / Закупка * 100",
"Служебное: string = \"\" #noField #noFilter #noGroup #noOrder"
]
Object form — when you need appearance:
{ "name": "Маржа", "title": "Маржа", "expression": "Цена - Закупка", "type": "decimal(15,2)", "useRestriction": "#noField #noFilter" }
Totals (shorthand)
"totalFields": ["Количество: Сумма", "Стоимость: Сумма(Кол * Цена)"]
Parameters (shorthand + @autoDates)
"parameters": [
"Период [Отчетный период]: StandardPeriod = LastMonth @autoDates"
]
Shorthand: "Имя [Заголовок]: тип = значение @флаги". [Заголовок] optional — adds <title> (LocalStringType).
Shorthand flags:
@autoDates— adds to the StandardPeriod parameter a pair of datesНачалоПериода/КонецПериода, calculated from it. Use them in the query text as&НачалоПериода/&КонецПериода; the user selects only the period itself. By default the parameter itself getsuse=AlwaysиdenyIncompleteValues=true(so that the derived dates are always filled in); in object form it can be explicitly overridden.@valueList—<valueListAllowed>true</valueListAllowed>— allows passing a list of values (with a list value, it is implied automatically below)@hidden— hidden parameter:availableAsField=false+ excluded from"dataParameters": "auto"
Object form: title, hidden: true, valueListAllowed: true, availableAsField: false, denyIncompleteValues: true, use: "Always".
List value: multiple default values separated by commas in значение (for a comma inside a value, use quotes '...'). In object form — an array in value.
"parameters": [
"Виды: ChartOfCharacteristicTypesRef.ВидыСубконтоХозрасчетные = ПланВидовХарактеристик.ВидыСубконтоХозрасчетные.Контрагенты, ПланВидовХарактеристик.ВидыСубконтоХозрасчетные.Договоры"
]
If there is no default value — omit = in shorthand or specify "value": null in object form.
List of allowed values (availableValues):
{
"name": "ПорядокОкругления",
"type": "EnumRef.Округления",
"value": "Перечисление.Округления.Окр1_00",
"use": "Always",
"denyIncompleteValues": true,
"availableValues": [
{"value": "Перечисление.Округления.Окр1_00", "presentation": "руб. коп"},
{"value": "Перечисление.Округления.Окр1", "presentation": "руб."},
{"value": "Перечисление.Округления.Окр1000", "presentation": "тыс. руб"}
]
}
In the settings variant "dataParameters": "auto" outputs all non-hidden parameters with userSettingID. Default values are inherited and remain active; parameters without a default value are disabled (the user will enable them in the settings).
Filters — shorthand
"filter": [
"Организация = _ @off @user",
"Дата >= 2024-01-01T00:00:00",
"Статус filled"
]
Format: "Поле оператор значение @флаги". Value _ = empty (placeholder). Flags: @off (use=false), @user (userSettingID=auto), @quickAccess, @normal, @inaccessible.
Available in object form: viewMode, userSettingID, userSettingPresentation.
Filter groups (Or/And/Not):
{ "group": "Or", "items": [
{ "group": "And", "items": [
{ "field": "Статус", "op": "=", "value": "Активен" },
{ "field": "Сумма", "op": ">", "value": 1000 }
]},
{ "field": "Количество", "op": "filled" }
]}
Data parameters — shorthand
"dataParameters": [
"Период = LastMonth @user",
"Организация @off @user"
]
Format: "Имя [= значение] @флаги". For StandardPeriod, variants (LastMonth, ThisYear, etc.) are recognized automatically.
Structure — string shorthand
"structure": "Организация > details"
"structure": "Организация > Номенклатура > details"
> separates grouping levels. details (or детали) = detail records. selection и order by default ["Auto"] at each level.
Object form — for complex cases (named groupings, selection/filter at the grouping level, tables, charts):
"structure": [
{
"name": "ПоОрганизациям",
"groupFields": ["Организация"],
"selection": ["Организация", "Сумма", "Auto"],
"children": [{ "groupFields": [] }]
}
]
type by default "group" (may be omitted). groupFields — alias for groupBy. Support for name, selection, order, filter, outputParameters, recursive children.
Settings variants
"settingsVariants": [{
"name": "Основной",
"title": "Продажи по организациям",
"settings": {
"selection": ["Номенклатура", "Количество", "Auto"],
"filter": ["Организация = _ @off @user"],
"order": ["Количество desc", "Auto"],
"conditionalAppearance": [
{
"filter": ["Просрочено = true"],
"appearance": { "ЦветТекста": "style:ПросроченныеДанныеЦвет" },
"presentation": "Выделять просроченные",
"viewMode": "Normal",
"userSettingID": "auto"
}
],
"outputParameters": { "Заголовок": "Мой отчёт" },
"dataParameters": ["Период = LastMonth @user"],
"structure": "Организация > details"
}
}]
Conditional appearance (conditionalAppearance)
"conditionalAppearance": [
{
"selection": ["Поле1"],
"filter": ["Поле1 notFilled"],
"appearance": { "Текст": "Не указано", "ЦветТекста": "style:XXX" },
"presentation": "Описание",
"viewMode": "Normal",
"userSettingID": "auto"
}
]
Value types of appearance: style:XXX/web:XXX/win:XXX → Color, true/false → Boolean, parameter Формат/Текст/Заголовок → LocalStringType, otherwise → String.
Filter value types: Перечисление.*/Справочник.*/ПланСчетов.*/Документ.* → DesignTimeValue (auto-detect).
OrGroup in filter: {"group": "Or", "items": ["условие1", "условие2"]}.
Folder в selection: {"folder": "Поступление", "items": ["ПолеА", "ПолеБ"]} → SelectedItemFolder с lwsTitle и placement=Auto.
Totals bound to groupings
"totalFields": [
{ "dataPath": "Кол", "expression": "Сумма(Кол)", "group": ["Группа1", "Группа1 Иерархия", "ОбщийИтог"] }
]
Output templates — compact DSL
Instead of raw XML (template) — tabular description via rows + named style style:
"templates": [
{
"name": "Макет1",
"style": "header",
"widths": [36, 33, 16, 17],
"minHeight": 24.75,
"rows": [
["Виды кассы", "Валюта", "Остаток на начало\nпериода", "Остаток на\nконец периода"],
["|", "|", "|", "|"],
["К1", "К2", "К3", "К4"]
]
},
{
"name": "Макет2",
"style": "data",
"widths": [36, 33, 16, 17],
"rows": [["{ВидКассы}", "{Валюта}", "{Остаток}", "{ОстатокКонец}"]],
"parameters": [
{ "name": "ВидКассы", "expression": "Представление(Счет)" },
{ "name": "Остаток", "expression": "ОстатокНаНачалоПериода" }
]
}
]
Cell syntax: "текст" — static, "{Имя}" — parameter, "|" — merge with the cell above, ">" — merge with the cell to the left, null — empty.
Two-level header with horizontal merge:
"rows": [
["Вид актива", "Остаток начало", "Поступление", ">", ">", ">", "Выбытие", ">", ">", "Остаток конец"],
["|", "|", "из произв.", "из п/ф", "со сч.40", "прочее", "Реализ.", "отгруж.", "прочее", "|"],
["К1", "К2", "К3", "К4", "К5", "К6", "К7", "К8", "К9", "К10"]
]
Built-in styles: header (background, center, wrap), data (group background), subheader (no background, center), total (no background). All — Arial 10, Solid 1px borders, colors via platform styles.
Custom styles: file skd-styles.json next to the JSON definition, in the current directory, or in presets/skills/skd/skd-styles.json (search upward from OutputPath). The first file found wins. All valid keys and the color format — in examples/skd-styles.json.
Raw XML ("template": "<...>") remains as fallback. Detection: if there is rows — DSL, otherwise — raw.
Drilldown in template parameters
Key drilldown in the template parameter automatically generates DetailsAreaTemplateParameter and the binding Расшифровка in the cell appearance:
"parameters": [
{ "name": "Сырье", "expression": "ПоступлениеСырья", "drilldown": "ПоступлениеСырья" }
]
Generates: ExpressionAreaTemplateParameter (regular) + DetailsAreaTemplateParameter with the name Расшифровка_ПоступлениеСырья, fieldExpression by field ИмяРесурса, mainAction=DrillDown. Cells {Сырье} automatically get appearance Расшифровка = Расшифровка_ПоступлениеСырья.
Binding layouts to groupings
"groupTemplates": [
{ "groupName": "ДанныеОтчета", "templateType": "GroupHeader", "template": "Макет1" },
{ "groupField": "Счет", "templateType": "Header", "template": "Макет2" },
{ "groupField": "Счет", "templateType": "OverallHeader", "template": "Макет3" }
]
groupField — binding to a grouping field, groupName — to a named grouping in the variant structure.
templateType: Header (data rows) → <groupTemplate>, OverallHeader (totals) → <groupTemplate>, GroupHeader (header) → <groupHeaderTemplate>.
Examples
Minimal
{
"dataSets": [{
"query": "ВЫБРАТЬ Номенклатура.Наименование КАК Наименование ИЗ Справочник.Номенклатура КАК Номенклатура",
"fields": ["Наименование"]
}]
}
With a query from an external file (@file)
{
"dataSets": [{
"query": "@queries/sales.sql",
"fields": ["Номенклатура: СправочникСсылка.Номенклатура @dimension", "Количество: число(15,3)", "Сумма: число(15,2)"]
}]
}
With resources, parameters, and @autoDates
{
"dataSets": [{
"query": "ВЫБРАТЬ Продажи.Организация, Продажи.Номенклатура, Продажи.КоличествоОборот КАК Количество, Продажи.СуммаОборот КАК Сумма ИЗ РегистрНакопления.Продажи.Обороты(&НачалоПериода, &КонецПериода) КАК Продажи",
"fields": [
"Организация: СправочникСсылка.Организации @dimension",
"Номенклатура: СправочникСсылка.Номенклатура @dimension",
"Количество: число(15,3)",
"Сумма: число(15,2)"
]
}],
"totalFields": ["Количество: Сумма", "Сумма: Сумма"],
"parameters": ["Период: СтандартныйПериод = LastMonth @autoDates"],
"settingsVariants": [{
"name": "Основной",
"settings": {
"selection": ["Организация", "Номенклатура", "Количество", "Сумма"],
"filter": ["Организация = _ @off @user"],
"dataParameters": "auto",
"structure": "Организация > details"
}
}]
}
Verification
/skd-validate <OutputPath> — валидация структуры XML
/skd-info <OutputPath> — визуальная сводка
/skd-info <OutputPath> -Mode variant -Name 1 — проверка варианта настроек