mcpField
B
bitrix-framework

bitrix-framework

github.com/bxmaximumDevelopment4789 installsUpdated 2w ago
Repository

About bitrix-framework

A shared development canon for Bitrix Framework projects, intended for task-specific skills to follow. It consolidates version requirements, code organization, dependency-injection boundaries, security practices, and a pre-finish checklist.

Key features

  1. 01Document Bitrix version and feature requirements
  2. 02Set locations for custom code and routes
  3. 03Define layering and dependency-injection boundaries
  4. 04Specify input handling and output escaping
  5. 05Provide a pre-finish checklist

Use cases

  1. 01Choose APIs compatible with a Bitrix project version
  2. 02Plan service, controller, and data-access responsibilities
  3. 03Check code changes against security conventions

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/bxmaximum/bitrix-framework-skills --skill bitrix-framework

After installing, type/bitrix-frameworkin Claude Code to confirm it loaded.

Details

From the project README

Bitrix Framework canon

Baseline: main 23.0+ · Verified: main 26.800.0

Pick task skills by their descriptions; this file holds the rules they all assume.

Version policy

  • Check the project first: bitrix/modules/main/classes/general/version.php → SM_VERSION.
  • **Since main X.Y** — feature needs that version; each skill gives a fallback.
  • **Since main X.Y\*** — exact version unknown; verified present in X.Y and absent in main 25.100.500. It may exist a bit earlier. Same for modules (**Since rest 26.200\***): absent in the module version shipped with main 25.100.500.
  • Kernel sources: bitrix/modules/<module>/lib/. Since main 26.600 many lib/ dirs are PascalCase (lib/Data), older ones lower-case — search case-insensitively.
FeatureSince main
Routing (/local/routes)21.400
/local/.settings.php24.100
Validation (Bitrix\Main\Validation)24.300
Controller render helpers25.700
New make:* (service, entity, event, message, agent …)25.900
Persistent Storage25.1100
Controller filter attributes, rules on action params, LoggerFactory26.250*
Module installers on install/migrations (UpdateSystem\Migration)26.600*
#[ActionAccess]26.600*
Feature flags Config\Feature26.700

Hard canons

  • All custom code in /local/; never edit /bitrix/. A file in /local/ wins over the same path in /bitrix/.
  • D7 first; legacy (CIBlock*, CUser, $DB) only where no D7 API exists — say so in a comment.
  • Thin controllers, routes, components and event handlers; logic in services; data in ORM tablets.
  • Loader::includeModule() / requireModule() before any module class.
  • declare(strict_types=1), typed signatures, Result/Error across module boundaries instead of exceptions or magic arrays.
  • /local/.settings.php replaces /bitrix/.settings.php entirely — copy every section, not just the changed one.
  • Routes only in /local/routes/*.php (module routes are required from there). Never add new routes to urlrewrite.php.
  • Migrations: a module's own tables/events/agents go to its installer (install/migrations, bitrix-modules); project data and settings go to sprint.migration. If it is not installed, propose installing it — never invent a migration framework.

DI boundaries

ContextConstructor DIHow
Application serviceYesautowired by ServiceLocator::get(FQCN); register in services only for interfaces or scalar args
Controller actionYes, paramstype-hint a concrete class; interfaces in action params are not resolved
Controller constructorNoengine passes Request only
Console commandNoServiceLocator::getInstance()->get() in execute()
Event handlerNoresolve inside the handler
Messenger receiverYesautowired; register only for interfaces or scalar args

services entry with only className for a concrete class disables autowire (new $class() without args). Use constructor closure or constructorParams, or don't register it. Details: bitrix-service-locator.

Security defaults

  • Never read $_GET/$_POST/$_SESSION/$_COOKIE; use Context request and Application::getSession().
  • AJAX actions keep default prefilters (Authentication, HttpMethod, Csrf); add rights checks per action.
  • Escape output (htmlspecialcharsbx, Json::encode), cast input, whitelist anything that reaches ORM select/order/runtime/ExpressionField.
  • Secrets from env or .settings.php, never in code, options or migrations.

Before you finish

  • Code in /local/, modules loaded, strict types.
  • Every kernel class, method and named argument exists in the project's main version (check Since).
  • No DB access in controllers/components/templates; errors returned via Result.
  • Cache with tags where reads repeat; ORM cache cleared via cleanCache().
  • Events and agents registered on install and removed on uninstall.
  • exception_handling.debug is false on production.

Comments

Markdown supported