magento-php-specialist — скилл для Claude Code: обзор и установка
Скилл magento-php-specialist для разработки под Magento 2 на PHP. Задаёт правила PSR-12, строгое оформление классов и базовые шаблоны платформы вроде репозиториев и плагинов.
MIT 263 установок ★ 33 обновлён 2026-01-24
npx skills add maxnorm/magento2-agent-skills --skill magento-php-specialist -a claude-codeЧто делает magento-php-specialist
Скилл инструктирует агента генерировать PHP-код по стандартам PSR-12 и Magento2 Coding Standard из vendor/magento/magento-coding-standard/Magento2. Во всех файлах требуется объявление declare(strict_types=1);, фигурные скобки классов и методов на отдельной строке, а также строгое сравнение через === и !==. Любые нестрогие проверки запрещены.
В правилах зафиксированы современные элементы языка: match-выражения вместо switch, union types и продвижение свойств в конструкторе с модификатором readonly. Скилл ориентирует архитектуру на композицию вместо наследования, сервисные контракты, фабрики и обсерверы. Для логирования задан интерфейс \Psr\Log\LoggerInterface.
Любое обращение к сервис-локаторам нарушает эти правила: скилл допускает только прямое внедрение зависимостей через конструктор.
Какие задачи решает
- написать сервис для Magento 2 со строгой типизацией PHP
- оформить внедрение зависимостей через конструктор без сервис-локатора
- реализовать паттерн репозитория или сервисный контракт по PSR-12
- заменить конструкции switch на match-выражения
Примеры запросов агенту
- Создай класс сервиса в модуле каталога с внедрением репозитория через конструктор
- Реализуй плагин для перехвата вызовов репозитория заказов с объявлением строгой типизации
- Перепиши бизнес-логику расчёта скидки с использованием match-выражений и union types
Как установить magento-php-specialist
1Через Skills CLI (Vercel)
npx skills add maxnorm/magento2-agent-skills --skill magento-php-specialist -a claude-code2Вручную: положить файлы
~/.claude/skills/magento-php-specialist/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/magento-php-specialist/
1Через Skills CLI (Vercel)
npx skills add maxnorm/magento2-agent-skills --skill magento-php-specialist -a codex2Вручную: положить файлы
.agents/skills/magento-php-specialist/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add maxnorm/magento2-agent-skills --skill magento-php-specialist -a cursor2Вручную: положить файлы
.cursor/skills/magento-php-specialist/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install maxnorm/magento2-agent-skills skills/magento-php-specialist2Вручную: положить файлы
.github/skills/magento-php-specialist/SKILL.md1Через Skills CLI (Vercel)
npx skills add maxnorm/magento2-agent-skills --skill magento-php-specialist -a gemini-cli2Командой платформы
gemini skills install https://github.com/maxnorm/magento2-agent-skills --path skills/magento-php-specialistВручную: положить файлы
.devin/skills/magento-php-specialist/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Через Skills CLI (Vercel)
npx skills add maxnorm/magento2-agent-skills --skill magento-php-specialist -a opencodeClaude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Вопросы о magento-php-specialist
Как установить magento-php-specialist в Claude Code?
Выполните команду npx skills add maxnorm/magento2-agent-skills --skill magento-php-specialist -a claude-code. Либо сохраните файл вручную по пути ~/.claude/skills/magento-php-specialist/SKILL.md.
Что делает magento-php-specialist?
Настраивает агента на разработку модулей Magento 2 по стандартам PSR-12 с обязательной строгой типизацией и документированием параметров в PHPDoc.
Как скилл требует внедрять зависимости?
Он предписывает внедрение зависимостей исключительно через параметры конструктора и запрещает вызов сервис-локаторов.
Исходный текст
SKILL.md · MIT
---
name: magento-php-specialist
description: Advanced PHP development for Magento 2 following PSR-12 and Magento coding standards. Use when writing PHP code, implementing business logic, or ensuring code quality. Masters modern PHP features, object-oriented programming, design patterns, and Magento-specific PHP practices.
---
# Magento 2 PHP Specialist
Expert specialist in leveraging advanced PHP techniques and modern practices to create high-performance, maintainable Magento 2 applications following enterprise development standards.
## When to Use
- Writing PHP code for Magento 2
- Implementing business logic
- Ensuring code quality and standards
- Working with modern PHP features
- Implementing design patterns
## PHP Standards (STRICT ENFORCEMENT)
### PSR-12 Compliance
- **PSR-12**: Strictly adhere to PSR-12 coding standards
- **Magento2 Coding Standard**: Follow standards in `vendor/magento/magento-coding-standard/Magento2`
- **Strict Types**: `declare(strict_types=1);` required
- **EditorConfig**: Check project's `.editorconfig` for indentation (4 spaces), line endings (LF), encoding (UTF-8)
### Code Structure Requirements
- **Opening Braces**: Classes and methods must have opening braces on their own line (PSR-12)
- **Constructor Property Promotion**: Use with `readonly` modifier where appropriate
- **Type Hinting**: All parameters and return types must be type-hinted
- **Strict Comparisons**: Always use `===` and `!==` (never `==` or `!=`)
- **Constructor PHPDoc**: Must include `@param` annotation for each parameter
### Modern PHP Features
- **Constructor Property Promotion**: Use constructor property promotion
- **Readonly Properties**: Use `readonly` modifier where appropriate
- **Union Types**: Use union types for flexible type hints
- **Match Expressions**: Use match expressions instead of switch when appropriate
- **Named Arguments**: Use named arguments for clarity
### Code Example
```php
<?php
/**
* Copyright © 2025 CompanyName. All rights reserved.
*/
declare(strict_types=1);
namespace CompanyName\ModuleName\Model;
use CompanyName\ModuleName\Api\ConfigInterface;
use CompanyName\ModuleName\Api\RepositoryInterface;
class Service
{
/**
* @param RepositoryInterface $repository
* @param ConfigInterface $config
*/
public function __construct(
private readonly RepositoryInterface $repository,
private readonly ConfigInterface $config
) {
}
/**
* @param int $id
* @return EntityInterface|null
*/
public function getById(int $id): ?EntityInterface
{
if ($id <= 0) {
return null;
}
return $this->repository->getById($id);
}
}
```
## Best Practices
### Object-Oriented Programming
- **Composition Over Inheritance**: Prefer composition patterns
- **Dependency Injection**: Constructor injection only - avoid service locators
- **Single Responsibility**: One purpose per class/method
- **Interface Segregation**: Use small, focused interfaces
- **SOLID Principles**: Follow SOLID principles
### Code Quality
- **Type Safety**: 100% type coverage - parameters, return types, properties
- **Error Handling**: Comprehensive exception handling
- **Logging**: Use `\Psr\Log\LoggerInterface` for logging
- **Documentation**: Minimal PHPDoc with `@param`, `@return`, `@throws`
- **Testing**: Write unit tests for business logic
### Magento-Specific Patterns
- **Service Contracts**: Use service contracts for APIs
- **Repository Pattern**: Implement repository pattern for data access
- **Factory Pattern**: Use factories for object creation
- **Plugin Pattern**: Use plugins to extend functionality
- **Observer Pattern**: Use observers for event-driven architecture
## References
- [PSR-12 Coding Standard](https://www.php-fig.org/psr/psr-12/)
- [Adobe Commerce PHP Development](https://developer.adobe.com/commerce/php/development/)
- [Coding Standards](https://developer.adobe.com/commerce/php/coding-standards/)
Focus on writing clean, maintainable PHP code that follows Magento best practices.
© maxnorm · MIT · maxnorm/magento2-agent-skills