ワンクリックで
api-design
For designing and reviewing the public API of 1C subsystems
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
For designing and reviewing the public API of 1C subsystems
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
| name | api-design |
| description | For designing and reviewing the public API of 1C subsystems |
Based on the Infostart article "API Base": https://infostart.ru/1c/articles/2683808/.
1C in enterprise solutions is a modular monolith: libraries consist of functional subsystems, and subsystems communicate through declared interfaces. An arbitrary call across subsystem boundaries is an architectural defect, not a convenient technique. This skill teaches the agent to classify export methods correctly, determine whether changes are allowed, and design APIs with compatibility in mind.
| Trigger | Action |
|---|---|
| Designing a new common module or export method | Apply the interface classification (5 categories), document the contract |
| Changing the signature of an existing export method | Check backward compatibility using the table below |
| Adding a parameter to an export method | Determine whether it is required or optional; assess the impact on the version |
| Deleting or renaming an export method | Create a deprecated wrapper in УстаревшиеПроцедурыИФункции |
| Code review: calling a method from another subsystem | Check the category of the called method (is the call allowed?) |
| Code review: behavior change without a signature change | Check whether this violates the contract (ПрограммныйИнтерфейс) |
| Question about a version bump when releasing changes | Apply the versioning rules (section "Versioning") |
Every export method must belong to exactly one of the 5 categories. For categories 1, 2, 4, and 5, the category is determined by the module #Область containing the method. The exception is category 3: it is determined by the fact that the method is located in an overridable module (*Переопределяемый), not in a separate region - inside such a module, methods are in the ordinary #Область ПрограммныйИнтерфейс.
#Область ПрограммныйИнтерфейсPublic contract for external consumers - other libraries, application solutions, integrations.
#Область ПрограммныйИнтерфейс
// Returns the exchange rate on the specified date.
//
// Parameters:
// Валюта - СправочникСсылка.Валюты - the currency whose rate must be retrieved.
// ДатаКурса - Дата - the date for which the rate is needed.
// If not specified, the current session date is used.
//
// Return value:
// Число - the exchange rate. 0 if the rate is not found.
//
Функция КурсВалюты(Валюта, ДатаКурса = Неопределено) Экспорт
Возврат РаботаСВалютами.КурсВалюты(Валюта, ДатаКурса);
КонецФункции
#КонецОбласти
#Область СлужебныйПрограммныйИнтерфейсContract for calls from other modules within the same library (not for external consumers).
#Область СлужебныйПрограммныйИнтерфейс
// Updates the exchange rate cache when data changes.
// Called only from the subscription to the РаботаСВалютамиОбновлениеКурсов event.
//
Процедура ОбновитьКэшКурсовВалют() Экспорт
// ...
КонецПроцедуры
#КонецОбласти
*Переопределяемый)Extension point: the library calls a consumer method through a module with the Переопределяемый suffix (for example, РаботаСФайламиПереопределяемый). There is no ПереопределяемыйИнтерфейс region - "overridability" is a property of the module itself (its role in the БСП architecture), not a region inside it; methods in such modules are in the ordinary #Область ПрограммныйИнтерфейс.
// Module: РаботаСФайламиПереопределяемый
#Область ПрограммныйИнтерфейс
// Defines attached file storage settings.
//
// Parameters:
// НастройкиХранения - Структура - settings to be populated.
//
Процедура ОпределитьНастройкиХраненияФайлов(НастройкиХранения) Экспорт
// You must either call the Base implementation or fill the structure yourself.
КонецПроцедуры
#КонецОбласти
#Область ДляВызоваИзДругихПодсистемStable integration zone between subsystems of the same solution.
#Область СлужебныеПроцедурыИФункцииInternal implementation of one functional subsystem. Not exported.
Экспорт or move it to the appropriate category.| Change | Condition |
|---|---|
| Adding an optional parameter | Old calls work without it |
Adding a new method to ПрограммныйИнтерфейс | Does not conflict with consumer names |
| Changing the implementation without changing behavior | The contract is not violated |
| Fixing a bug in the implementation | Documented in the changelog |
| Change | Requirement |
|---|---|
| Adding a required parameter | Preserve the old signature as deprecated, new method - a new name or overload |
Removing a method from ПрограммныйИнтерфейс | Deprecated wrapper in УстаревшиеПроцедурыИФункции + migration path |
| Renaming a method | Deprecated wrapper with the old name |
| Changing the parameter type (incompatible) | Deprecated wrapper, new parameter - via optional parameter or overload |
| Changing the meaning of a parameter (behavior break) | New parameter name or documentation of the breaking change |
| Direct access to another subsystem's data | Prohibited without an explicit API |
Backward compatibility requirements override cosmetic standards. You cannot rename a public method "for the sake of correct style" without a deprecated wrapper.
When a method becomes obsolete:
#Область УстаревшиеПроцедурыИФункции.// Устарела. Используйте <НовыйМетод>().#Область УстаревшиеПроцедурыИФункции
// Устарела. Используйте КурсВалютыНаДату().
// Будет удалена в версии 4.0.
//
// Параметры:
// Валюта - СправочникСсылка.Валюты
// ДатаКурса - Дата
//
// Возвращаемое значение:
// Число
//
Функция ПолучитьКурсВалюты(Валюта, ДатаКурса) Экспорт
Возврат КурсВалютыНаДату(Валюта, ДатаКурса);
КонецФункции
#КонецОбласти
| Change type | Bump |
|---|---|
| Bug fix without changing API behavior | build (x.x.x.N) |
| New optional parameter, new method in the public interface | minor (x.N.0.0) |
| Breaking change with a deprecated wrapper | minor + documentation |
| Removal of a deprecated method, incompatible type | major (N.0.0.0) |
Prohibited: introducing a public API extension (new methods, new parameters) in a release with only a build bump. Build is for bug fixes only.
Use code-navigation (grep over sources) to search for:
#Область УстаревшиеПроцедурыИФункции - check for deprecated wrappers.// Search for the method declaration
// grep: "Функция КурсВалюты" or "Процедура КурсВалюты"
// Search for calls
// grep: "РаботаСВалютами.КурсВалюты"
// Search for the deprecated area
// grep: "Устаревшие процедуры и функции"
Determine which category the method belongs to, and choose from the table below:
| Change type | Method category | Requirement |
|---|---|---|
| New method | Any | Place it in the correct #Область |
| New optional parameter | ПрограммныйИнтерфейс | Allowed, version bump |
| New required parameter | ПрограммныйИнтерфейс | Deprecated wrapper required |
| Method removal | ПрограммныйИнтерфейс | Deprecated wrapper required |
| Behavior change | ПрограммныйИнтерфейс | Considered a breaking change |
| Any change | СлужебныеПроцедурыИФункции | Free (within the subsystem) |
| New required parameter | Overridable modules (*Переопределяемый) | Prohibited |
syntax-checkingAfter changing the signature:
Every method from #Область ПрограммныйИнтерфейс - including methods of overridable modules (*Переопределяемый) - must have:
Context: developer asks to add the function ПолучитьОстатокТоваров() to the common module УправлениеЗапасами.
Steps:
#Область ПрограммныйИнтерфейс.СлужебныеПроцедурыИФункции).Context: reviewer receives a PR where a new required parameter ИсточникКурса has been added to РаботаСВалютами.КурсВалюты().
Steps:
code-navigation: find all calls to РаботаСВалютами.КурсВалюты( - assess the number of consumers.ПрограммныйИнтерфейс, then this is a breaking change.УстаревшиеПроцедурыИФункции with a call to the new method.КурсВалютыИзИсточника) or the parameter should be made optional.Context: architect is designing a new extension point for a notification mechanism.
Steps:
ИмяПодсистемыПереопределяемый), in its ordinary #Область ПрограммныйИнтерфейс - not in a special region.Context: reviewer notices a call to ЧастнаяПодсистема.ВнутреннийМетод() from another module.
Steps:
СлужебныеПроцедурыИФункции, this is a defect, and it should be recorded in the review comment.ДляВызоваИзДругихПодсистем or ПрограммныйИнтерфейс.СлужебныйПрограммныйИнтерфейс and the call is from another library, request an explicit agreement or a refactoring.| Mistake | Consequence | How to avoid |
|---|---|---|
Calling СлужебныеПроцедурыИФункции from another subsystem | Fragile integration, break during refactoring | Check #Область before calling |
| Adding a required parameter without a deprecated wrapper | Breaks all calls in CI | Always create an adapter in УстаревшиеПроцедурыИФункции |
| API expansion in a build-only release | Versioning violation, confusion for consumers | Build is for bug fixes only |
A method in an overridable module (*Переопределяемый) with a new required parameter | Errors in all existing implementations | Only optional parameters are allowed in overridable modules |
| Changing the meaning of a parameter without documenting it | Silent behavioral break | Document it in the changelog, consider a version bump |
| Suppressing BSL LS warnings without a reason | Hidden breaking changes | Always document the reason for suppression |
| Direct access to another subsystem's data tables | Tight coupling, architectural debt | Use only the documented API |
Before implementing a new API:
https://infostart.ru/1c/articles/2683808/depends_on:
When writing or reviewing BSL, apply 1C standards
При написании или ревью BSL применять стандарты 1С
Orchestrator: routing work and agent phases
Оркестратор: маршрутизация работы и фаз агентов
BSL LSP navigation: definitions, refs, call graph
Rules for using RLM tools for project search and navigation in 1C/BSL