agentleFS
bxmaximumbxmaximum/bitrix-framework-skills/skills/bitrix-validation/SKILL.md

bitrix-validation

Skill73 starsChanged 25 days agoMITView on GitHub

Используй для проверки ввода Битрикса: атрибуты NotEmpty/Length, DTO и ValidationService. Валидация параметров контроллера, сервисов и CLI, свои правила и ошибки.

The file

Files
SKILL.md

Валидация

Baseline: main 23.0+ · Verified: main 26.1000.0

Перед PHP-кодом прочитай bitrix-framework, если ещё не читал его в этой задаче. В таблице выбери только нужный rules/*.md; пути относительны каталогу скилла.

Всё пространство имён доступно Since main 24.300. Раньше проверяй ввод вручную в сервисе и возвращай ошибки Result (bitrix-result-and-errors).

ЗадачаЧитать
Атрибуты правил, DTO, вложенные объекты, коллекции, группы, ValidationServicerules/rules-dto.md
Ввод контроллера: правила на параметрах, DTO ValidationParameterrules/controller.md
Своё правило-атрибут, валидатор, коды ошибокrules/custom.md

Обязательные правила

  • Сервис: ServiceLocator::getInstance()->get('main.validation.service') либо тип ValidationService в конструкторе сервиса (без состояния).
  • Нет секции validation в .settings.php и атрибута #[ValidationParameter].
  • Имена: RegExp, не Regex; errorMessage, не message. Метода getField() у ошибки нет: путь свойства находится в getCode() (email, items.0.name).
  • Правила на параметрах действий, groups, #[Json], #[OnlyOneOfPropertyRequired] доступны Since main 26.250*. На 25.x правило параметра молча игнорируется: проверяй DTO.
  • ValidationResult наследует Result: передавай ошибки через Result сервиса, не исключением.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.