Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

magento-module-development

БесплатноБез исполняемых скриптовНе проверен

Build custom Magento 2 modules using dependency injection, plugins, observers, and service contracts to extend core functionality cleanly

finsilabsот finsilabs★ 69 звёзд на GitHub

Об этом скилле

Magento 2 Module Development

Overview

Build custom Magento 2 modules using the module architecture, dependency injection (DI), service contracts (interfaces), plugins (interceptors), observers, and the repository pattern. This skill covers the Magento 2 module skeleton, XML-based configuration, the Object Manager and DI container, custom REST/GraphQL API endpoints, and database schema management with db_schema.xml (declarative schema).

When to Use This Skill

  • When building a custom module that adds new functionality to a Magento 2 store
  • When extending or overriding core Magento behavior using plugins or preferences
  • When creating custom REST API or GraphQL endpoints for headless integrations
  • When adding custom database tables with declarative schema
  • When implementing admin grids, forms, and system configuration

Core Instructions

  1. Create the module skeleton

    Every Magento 2 module lives in app/code/Vendor/Module and requires at minimum two files:

    app/code/Acme/CustomModule/
    ├── etc/
    │   └── module.xml
    ├── registration.php
    ├── Api/
    │   └── CustomRepositoryInterface.php
    ├── Model/
    │   ├── CustomRepository.php
    │   └── ResourceModel/
    ├── Controller/
    ├── Block/
    ├── view/
    │   ├── frontend/
    │   └── adminhtml/
    └── Setup/
        └── Patch/
            └── Data/
    
    // registration.php
    <?php
    declare(strict_types=1);
    
    use Magento\Framework\Component\ComponentRegistrar;
    
    ComponentRegistrar::register(
        ComponentRegistrar::MODULE,
        'Acme_CustomModule',
        __DIR__
    );
    
    <!-- etc/module.xml -->
    <?xml version="1.0"?>
    <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
        <module name="Acme_CustomModule" setup_version="1.0.0">
            <sequence>
                <module name="Magento_Catalog"/>
                <module name="Magento_Sales"/>
            </sequence>
        </module>
    </config>
    
  2. Define service contracts (interfaces) and implement them

    Service contracts ensure your module provides a stable API that other modules and integrations can rely on:

    // Api/Data/CustomEntityInterface.php
    <?php
    declare(strict_types=1);
    
    namespace Acme\CustomModule\Api\Data;
    
    interface CustomEntityInterface
    {
        const ENTITY_ID = 'entity_id';
        const NAME = 'name';
        const STATUS = 'status';
        const CREATED_AT = 'created_at';
    
        public function getEntityId(): ?int;
        public function getName(): string;
        public function setName(string $name): self;
        public function getStatus(): string;
        public function setStatus(string $status): self;
        public function getCreatedAt(): ?string;
    }
    
    // Api/CustomRepositoryInterface.php
    <?php
    declare(strict_types=1);
    
    namespace Acme\CustomModule\Api;
    
    use Acme\CustomModule\Api\Data\CustomEntityInterface;
    use Magento\Framework\Api\SearchCriteriaInterface;
    use Magento\Framework\Api\SearchResultsInterface;
    use Magento\Framework\Exception\NoSuchEntityException;
    
    interface CustomRepositoryInterface
    {
        /**
         * @throws NoSuchEntityException
         */
        public function getById(int $id): CustomEntityInterface;
    
        public function save(CustomEntityInterface $entity): CustomEntityInterface;
    
        public function delete(CustomEntityInterface $entity): bool;
    
        public function getList(SearchCriteriaInterface $searchCriteria): SearchResultsInterface;
    }
    
  3. Implement the Model, ResourceModel, and Repository

    // Model/CustomEntity.php
    <?php
    declare(strict_types=1);
    
    namespace Acme\CustomModule\Model;
    
    use Acme\CustomModule\Api\Data\CustomEntityInterface;
    use Magento\Framework\Model\AbstractModel;
    
    class CustomEntity extends AbstractModel implements CustomEntityInterface
    {
        protected function _construct(): void
        {
            $this->_init(\Acme\CustomModule\Model\ResourceModel\CustomEntity::class);
        }
    
        public function getEntityId(): ?int
        {
            return $this->getData(self::ENTITY_ID) ? (int) $this->getData(self::ENTITY_ID) : null;
        }
    
        public function getName(): string
        {
            return (string) $this->getData(self::NAME);
        }
    
        public function setName(string $name): CustomEntityInterface
        {
            return $this->setData(self::NAME, $name);
        }
    
        public function getStatus(): string
        {
            return (string) $this->getData(self::STATUS);
        }
    
        public function setStatus(string $status): CustomEntityInterface
        {
            return $this->setData(self::STATUS, $status);
        }
    
        public function getCreatedAt(): ?string
        {
            return $this->getData(self::CREATED_AT);
        }
    }
    
    // Model/ResourceMod
    
Полный SKILL.md на GitHub

Установить magento-module-development в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

claude-code
cursor
gemini-cli
copilot
codex-cli
kiro
opencode

Вложенные файлы

evals/declarative-schema-and-rest-api-endpoint/criteria.jsonevals/declarative-schema-and-rest-api-endpoint/task.mdevals/module-skeleton-service-contracts-and-di/criteria.jsonevals/module-skeleton-service-contracts-and-di/task.mdevals/plugins-observers-and-event-handling/criteria.jsonevals/plugins-observers-and-event-handling/task.mdtile.json

FAQ

Что делает скилл magento-module-development?

Build custom Magento 2 modules using dependency injection, plugins, observers, and service contracts to extend core functionality cleanly

Как установить скилл magento-module-development?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл magento-module-development запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить magento-module-development с