Bitrix Service Locator logo

Bitrix Service Locator

Community
bxmaximum
bitrix-service-locator

Используй для DI Битрикса: ServiceLocator, services в .settings.php, привязки интерфейсов, фабрики и автосборка. Переопределение сервисов, контекст вызова и версия ядра.

Overview

Publisherbxmaximum
Repositorybitrix-framework-skills
Skill namebitrix-service-locator
Stars
56
Forks
6
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by bxmaximum on GitHub. Read the source before you install it.

Installation

Install the Bitrix Service Locator AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/bxmaximum/bitrix-framework-skills/tree/main/skills/bitrix-service-locator
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/bxmaximum/bitrix-framework-skills.git /tmp/bitrix-framework-skills
mkdir -p .claude/skills
cp -r /tmp/bitrix-framework-skills/skills/bitrix-service-locator .claude/skills/bitrix-service-locator
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Bitrix Service Locator in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Bitrix Service Locator on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Bitrix Service Locator is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

ServiceLocator и внедрение зависимостей

Baseline: main 23.0+ · Verified: main 26.1000.0

Перед PHP-кодом прочитай bitrix-framework, если ещё не читал его в этой задаче.

Границы DI задаёт bitrix-framework: сервисы и получатели Messenger поддерживают конструктор; контроллеры — параметры действий; CLI — конструктор Since main 26.900. Классы предметной области не обращаются к контейнеру.

Как разрешается get($id) (Since main 26.250*)

КлючРезультат
Уже создан или передан в addInstance()Тот же экземпляр
Не зарегистрирован, класс существуетАвтосборка: параметр конструктора = get(<его тип>); при наличии значения по умолчанию берётся оно
Зарегистрирован интерфейс / абстрактный классclassName → реализация с автосборкой (constructorParams игнорируется); замыкание constructor вызывается с аргументами constructorParams
Зарегистрирован конкретный класс или строковый IDclassName → new $class(...array_values(constructorParams)), без автосборки; замыкание constructor вызывается без аргументов
  • Экземпляры кешируются на время процесса, кроме записей с 'singleton' => false.
  • Цикл вызывает CircularDependencyException. Нетипизированный, объединённый или скалярный параметр без значения по умолчанию вызывает ServiceNotFoundException.
  • До 26.250 зарегистрированный ключ создаётся через new $class(...constructorParams) или constructor(). Незарегистрированные классы собираются, только если все параметры конструктора — конкретные классы (без интерфейсов; значения по умолчанию игнорируются). Параметра singleton нет. На таком ядре привязывай реализации с зависимостями через замыкание constructor.

Регистрация

Секция services в /local/modules/vendor.module/.settings.php регистрируется при Loader::includeModule(); также доступна в глобальных настройках:

php
<?php
return [
    'services' => [
        'value' => [
            // интерфейс → реализация (автосборка с 26.250*)
            \Vendor\Blog\Domain\PostRepositoryInterface::class => [
                'className' => \Vendor\Blog\Infrastructure\OrmPostRepository::class,
            ],
            // скалярные аргументы → фабрика
            \Vendor\Blog\Infrastructure\TelegramClient::class => [
                'constructor' => static fn () => new \Vendor\Blog\Infrastructure\TelegramClient(
                    (string)getenv('TELEGRAM_BOT_TOKEN'),
                ),
            ],
            // позиционные аргументы; замыкание вычисляется при первом get()
            'vendor.blog.mailer' => [
                'className' => \Vendor\Blog\Infrastructure\Mailer::class,
                'constructorParams' => static fn () => ['noreply@example.com'],
            ],
        ],
        'readonly' => true,
    ],
];
  • Не регистрируй конкретный класс, которому нужны только другие классы. get(PostService::class) соберёт зависимости, а один [ 'className' => PostService::class ] приведёт к new PostService() → ArgumentCountError.
  • Предпочитай ключи FQCN. Строковые ID (main.validation.service) — соглашение ядра.
  • Ядро регистрирует Application, Routing\Router, DB\Connection, Data\Cache, Data\ManagedCache, Data\TaggedCache, EventManager, Data\ConnectionPool, \CUserTypeManager (Since main 26.250*) и Data\Storage\PersistentStorageInterface (Since main 25.1100, bitrix-storage). Передавай их в конструктор вместо вызовов Application::getInstance()->….

Переопределения

  • Побеждает первая регистрация: registerByModuleSettings() пропускает существующие ключи. Последующий модуль не переопределяет предыдущий.
  • Переопределяй привязку модуля в глобальной секции services файла /local/.settings_extra.php (регистрируется при старте до модулей) или во время выполнения (init.php, тесты): ServiceLocator::getInstance()->addInstance($id, $object) / addInstanceLazy($id, ['className' => …]).

Получение сервисов

  • Сервисы: параметры конструктора.
  • Действия контроллеров: конкретный класс в типе параметра. Интерфейсы в параметрах действий не разрешаются (bitrix-controllers).
  • Получатели Messenger создаются через get(FQCN) с автосборкой. Команды CLI поддерживают её Since main 26.900; на старом ядре получай сервис в execute(). Обработчики событий получают сервис внутри обработчика.
  • has($id) возвращает true только для зарегистрированных или созданных ID, а не для любых классов, доступных автосборке.

Правила

  • Сервисы — одиночки на время процесса: не храни в свойствах состояние запроса. Долгоживущие потребители сохраняют экземпляры между сообщениями.
  • Не создавай new Service() в контроллере/команде, если контейнер может его собрать. В предметной области вызовов контейнера нет.
  • Конфигурация передаётся типизированным объектом или скалярами через фабрику, а не сервисом с произвольным массивом.
  • Флаги возможностей: Bitrix\Main\Config\Feature (Since main 26.700, bitrix-storage), а не самодельный сервис флагов.

Frequently asked questions

What does the Bitrix Service Locator AI skill do?

Используй для DI Битрикса: ServiceLocator, services в .settings.php, привязки интерфейсов, фабрики и автосборка. Переопределение сервисов, контекст вызова и версия ядра.

Why use Bitrix Service Locator on TypingMind?

Because you install it once and use it with any model. Bitrix Service Locator is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Bitrix Service Locator in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/bxmaximum/bitrix-framework-skills/tree/main/skills/bitrix-service-locator. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Bitrix Service Locator?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Bitrix Service Locator?

As many as you like. As long as a model supports skills, you can use Bitrix Service Locator with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Bitrix Service Locator AI skill free?

Yes. It is published on GitHub by bxmaximum under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇