From 1c-skills
Generates .bsl interceptor files for method patching in 1C CFE extensions. Supports Before (&Перед), After (&После), and ModificationAndControl types for borrowed objects.
npx claudepluginhub nikolay-shirokov/cc-1c-skills --plugin 1c-skillsThis skill uses the workspace's default tool permissions.
---
Borrows objects from 1C configurations into CFE extensions. Use to intercept methods, modify forms, add attributes, or extend catalogs, documents, modules, and 44 object types.
Guides extending ([EXTEND]) or modifying ([MODIFY]) existing code: read full context, match naming/import/error patterns, preserve interfaces and signatures.
Implements Magento 2 plugins (interceptors) with before, after, and around methods to modify class behavior without inheritance. Use for extending core or third-party modules.
Share bugs, ideas, or general feedback.
Генерирует .bsl файл с декоратором перехвата для заимствованного объекта расширения. Создаёт файл или дописывает в существующий.
Объект должен быть заимствован в расширение (/cfe-borrow). Скрипт читает NamePrefix из Configuration.xml расширения для формирования имени процедуры.
| Параметр | Описание | По умолчанию |
|---|---|---|
ExtensionPath | Путь к расширению (обязат.) | — |
ModulePath | Путь к модулю (обязат.) | — |
MethodName | Имя перехватываемого метода (обязат.) | — |
InterceptorType | Before / After / ModificationAndControl (обязат.) | — |
Context | Директива контекста | НаСервере |
IsFunction | Метод — функция (добавит Возврат) | false |
| ModulePath | Файл |
|---|---|
Catalog.X.ObjectModule | Catalogs/X/Ext/ObjectModule.bsl |
Catalog.X.ManagerModule | Catalogs/X/Ext/ManagerModule.bsl |
Catalog.X.Form.Y | Catalogs/X/Forms/Y/Ext/Form/Module.bsl |
CommonModule.X | CommonModules/X/Ext/Module.bsl |
Document.X.ObjectModule | Documents/X/Ext/ObjectModule.bsl |
Document.X.Form.Y | Documents/X/Forms/Y/Ext/Form/Module.bsl |
Аналогично для Report, DataProcessor, InformationRegister и других типов.
| InterceptorType | Декоратор | Назначение |
|---|---|---|
Before | &Перед | Код до вызова оригинального метода |
After | &После | Код после вызова оригинального метода |
ModificationAndControl | &ИзменениеИКонтроль | Копия тела метода с маркерами #Вставка/#Удаление |
powershell.exe -NoProfile -File "${CLAUDE_SKILL_DIR}/scripts/cfe-patch-method.ps1" -ExtensionPath src -ModulePath "Catalog.Контрагенты.ObjectModule" -MethodName "ПриЗаписи" -InterceptorType Before
# Перехват &Перед на сервере
... -ExtensionPath src -ModulePath "Catalog.Контрагенты.ObjectModule" -MethodName "ПриЗаписи" -InterceptorType Before
# Перехват &После на клиенте
... -ExtensionPath src -ModulePath "Document.Заказ.Form.ФормаДокумента" -MethodName "ПослеЗаписиНаСервере" -InterceptorType After -Context "НаКлиенте"
# ИзменениеИКонтроль для функции
... -ExtensionPath src -ModulePath "CommonModule.ОбщийМодуль" -MethodName "ПолучитьДанные" -InterceptorType ModificationAndControl -IsFunction
&НаСервере
&Перед("ПриЗаписи")
Процедура Расш1_ПриЗаписи()
// TODO: код перед вызовом оригинального метода
КонецПроцедуры