role-compile — Claude Code skill: generate 1C roles from JSON
role-compile generates 1C role files (Roles/Name.xml and Rights.xml) from a JSON permission spec. Supports presets, RLS, and granular rights on attributes.
MIT 45 installs ★ 811 updated 2026-10-23
/plugin marketplace add Nikolay-Shirokov/cc-1c-skills
/plugin install 1c-skills@cc-1c-skillsWhat role-compile does
The skill takes a JSON definition of rights — such as "Catalog.Nomenclature: @view" or a full object with RLS restrictions — and generates role metadata in the 1C configuration export structure. UUIDs are assigned automatically; the role is registered in Configuration.xml. Presets @view and @edit expand into standard permission sets (Read, View, Use for viewing; CRUD and Posting for editing). Rights on nested parts — attributes, HTTP service methods — use dot notation; denying an attribute overrides inherited permissions.
RLS templates live in the templates section; long conditions can be stored in a file (@path). The & character in conditions is escaped to XML automatically. For HTTP services, the shorthand "HTTPService.EDO: Use" expands to all methods of all URL templates, reading metadata from OutputDir.
The skill invokes the PowerShell script role-compile.ps1, which creates role files and updates Configuration.xml. If the spec contains an error (rights on an object type that carries none in the platform, a path to a non-existent attribute), no files are written. Commands /role-validate and /role-info check XML and visualize role structure.
What it helps with
- generate a 1C role with catalog and document permissions from JSON
- set up RLS for a role: restrict document reads by organization
- deny View on a specific catalog attribute in a role
- create a role with Use rights on all HTTP service methods
- automatically register the role in
Configuration.xmlwith UUID
Example prompts for the agent
- Create a role from
role-definition.json, export is insrc/Configuration - Generate a role called ReadNomenclature with @view rights on
Catalog.NomenclatureandCatalog.Counterparties - Add RLS to the role for
Document.SalesInvoice: read only own organization
How to install role-compile
1Plugin marketplace
/plugin marketplace add Nikolay-Shirokov/cc-1c-skills/plugin install 1c-skills@cc-1c-skillsThis installs the whole 1c-skills plugin with all its skills
2Skills CLI (Vercel)
npx skills add Nikolay-Shirokov/cc-1c-skills --skill role-compile -a claude-code3Manually: put the files in place
~/.claude/skills/role-compile/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/role-compile/
1Skills CLI (Vercel)
npx skills add Nikolay-Shirokov/cc-1c-skills --skill role-compile -a codex2Manually: put the files in place
.agents/skills/role-compile/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add Nikolay-Shirokov/cc-1c-skills --skill role-compile -a cursor2Manually: put the files in place
.cursor/skills/role-compile/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install Nikolay-Shirokov/cc-1c-skills .claude/skills/role-compile2Manually: put the files in place
.github/skills/role-compile/SKILL.md1Skills CLI (Vercel)
npx skills add Nikolay-Shirokov/cc-1c-skills --skill role-compile -a gemini-cli2Platform CLI
gemini skills install https://github.com/Nikolay-Shirokov/cc-1c-skills --path .claude/skills/role-compileManually: put the files in place
.devin/skills/role-compile/SKILL.mdThe legacy .windsurf/skills/ path still works
Claude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about role-compile
How do I install role-compile in Claude Code?
Two ways: via marketplace — /plugin marketplace add Nikolay-Shirokov/cc-1c-skills, then /plugin install 1c-skills@cc-1c-skills; or directly with npm — npx skills add Nikolay-Shirokov/cc-1c-skills --skill role-compile -a claude-code. The skill appears in ~/.claude/skills/role-compile/SKILL.md.
What does role-compile do?
It generates 1C role XML files from a JSON spec: creates Roles/Name.xml with metadata and Roles/Name/Ext/Rights.xml with object permissions. Automatically assigns UUIDs, registers the role in Configuration.xml, and expands @view and @edit presets into platform rights.
Can I set rights on a catalog attribute?
Yes, using dot notation: "Catalog.Counterparties.Attribute.TIN: View, Edit" or in object form with rights. To deny an inherited right, specify {"name": "Catalog.Goods.Attribute.Price", "rights": {"View": false}}.
Source text
SKILL.md · MIT
---
name: role-compile
description: Создание роли 1С из описания прав. Используй когда нужно создать новую роль с набором прав на объекты
argument-hint: <JsonPath> <OutputDir>
allowed-tools:
- Bash
- Read
- Write
- Glob
---
# /role-compile — генерация роли 1С из JSON DSL
Принимает JSON-определение роли → генерирует `Roles/Имя.xml` (метаданные) и `Roles/Имя/Ext/Rights.xml` (права). UUID автоматически.
## Параметры и команда
| Параметр | Описание |
|----------|----------|
| `JsonPath` | Путь к JSON-определению роли |
| `OutputDir` | Корень выгрузки конфигурации (где `Configuration.xml`, `Roles/` и т.д.) |
```powershell
powershell.exe -NoProfile -File "${CLAUDE_SKILL_DIR}/scripts/role-compile.ps1" -JsonPath "<json>" -OutputDir "<ConfigDir>"
```
Создаёт `{OutputDir}/Roles/Имя.xml` и `{OutputDir}/Roles/Имя/Ext/Rights.xml`. Регистрирует `<Role>` в `Configuration.xml`.
## JSON DSL
### Структура
```json
{ "name": "ИмяРоли", "synonym": "Отображаемое имя", "objects": [...], "templates": [...] }
```
Необязательные: `comment` (""), `setForNewObjects` (false), `setForAttributesByDefault` (true), `independentRightsOfChildObjects` (false).
### Shorthand-строки и объектная форма
```json
"objects": [
"Catalog.Номенклатура: @view",
"Document.Реализация: @edit",
"DataProcessor.Загрузка: @view",
"InformationRegister.Цены: Read, Update",
{ "name": "Document.Продажа", "preset": "view", "rls": {"Read": "#Шаблон(\"\")"} },
{ "name": "Catalog.Номенклатура.Attribute.Цена", "rights": {"View": false} }
]
```
- Shorthand: `"Тип.Имя: @пресет"` или `"Тип.Имя: Право1, Право2"`
- Объектная форма: `preset` + `rights` (точечные значения прав) + `rls` (ограничения)
### Пресеты
| Пресет | Действие |
|--------|----------|
| `@view` | Просмотр — Read, View (+InputByString для справочников/документов; Use+View для обработок/отчётов) |
| `@edit` | Полное редактирование — CRUD + Interactive* + Posting (документы) |
`@` обязателен в shorthand. В объектной форме — `"preset": "view"` без `@`.
### Сервисы
Право живёт на **вложенном объекте** сервиса — методе шаблона URL, операции, канале; на сервисе целиком его не бывает. Весь сервис — короткая запись, навык раскроет её по метаданным в `OutputDir`:
```json
"objects": ["HTTPService.ЭДО: Use"]
```
→ `HTTPService.ЭДО.URLTemplate.ЕстьНовыеДокументы.Method.POST: Use`, и так по каждому методу каждого шаблона.
Часть маршрутов — полным путём: `"HTTPService.ЭДО.URLTemplate.ЕстьНовыеДокументы.Method.POST: Use"`.
### Шаблоны RLS
```json
"templates": [{"name": "ДляОбъекта(Мод)", "condition": "ГДЕ Организация = &ТекОрг"}]
```
Ссылка в `rls`: `"#ДляОбъекта(\"\")"`. Символ `&` автоматически экранируется в XML.
Длинное условие держи в файле — в значении пишется `@путь`. Относительный путь ищется рядом
с JSON-описанием роли, затем в текущем каталоге:
```json
"objects": [{"name": "Document.Продажа", "preset": "view", "rls": {"Read": "@условие.txt"}}],
"templates": [{"name": "ДляОбъекта(Мод)", "condition": "@шаблон.txt"}]
```
## Примеры
### Простая роль
```json
{
"name": "ЧтениеНоменклатуры", "synonym": "Чтение номенклатуры",
"objects": ["Catalog.Номенклатура: @view", "Catalog.Контрагенты: @view", "DataProcessor.Загрузка: @view"]
}
```
### Роль с RLS
```json
{
"name": "ЧтениеДокументовПоОрганизации",
"synonym": "Чтение документов (ограничение по организации)",
"objects": [
"Catalog.Организации: @view",
{"name": "Document.РеализацияТоваровУслуг", "preset": "view", "rls": {"Read": "#ДляОбъекта(\"\")"}}
],
"templates": [{"name": "ДляОбъекта(Модификатор)", "condition": "ГДЕ Организация = &ТекущаяОрганизация"}]
}
```
## Что можно писать в `objects`
Прав не бывает у `Enum`, `CommonModule`, `DefinedType`, `CommonPicture`, `CommonTemplate`, `Language`, `FunctionalOption`, `EventSubscription`, `ScheduledJob`, `StyleItem`, `SettingsStorage` и подобных — в дереве редактора ролей их нет. Ошибка в описании — отказ до записи: файлы не создаются, `Configuration.xml` не меняется.
Права на части объекта задаются точечным путём: `Catalog.Контрагенты.Attribute.ИНН: View, Edit`, `WebService.Обмен.Operation.Загрузить: Use`, `HTTPService.ЭДО.URLTemplate.ЕстьНовыеДокументы.Method.POST: Use`.
Реквизиты, табличные части, измерения и ресурсы наследуют права своего объекта — им задают
запрет, чтобы закрыть унаследованное:
```json
{"name": "Catalog.Товары.Attribute.Цена", "rights": {"View": false}}
```
Роль расширения, включённая в основные (`DefaultRoles`), прав на заимствованные объекты давать не может — платформа это запрещает. Такие права выноси в отдельную роль вне основных.
Полные таблицы «тип → права», виды вложенности (включая внешние источники данных), список типов без прав, таблицы пресетов и дополнительные примеры — в `dsl-reference.md`.
## Верификация
```
/role-validate <RightsPath> — проверка корректности XML, прав, RLS
/role-info <RightsPath> — визуальная сводка структуры
```
© Nikolay Shirokov · MIT · Nikolay-Shirokov/cc-1c-skills