hyva-create-module by hyva-themes/hyva-ai-tools
npx skills add https://github.com/hyva-themes/hyva-ai-tools --skill hyva-create-module此实用技能在 app/code/ 目录中创建新的 Magento 2 模块。它设计为由其他需要模块脚手架的技能调用。
命令执行: 对于需要在开发环境内运行的命令(例如 bin/magento),请使用 hyva-exec-shell-cmd 技能来检测环境并确定适当的命令包装器。
调用此技能时,调用方技能应提供:
| 参数 | 必需 | 描述 |
|---|---|---|
vendor | 是 | 供应商名称,使用 PascalCase 格式(例如 Acme) |
module |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
| 是 |
模块名称,使用 PascalCase 格式(例如 CustomFeature) |
description | 否 | 用于 composer.json 的模块描述(默认:"[Vendor] [Module] module") |
dependencies | 否 | 用于 module.xml 中 <sequence> 的模块依赖项数组 |
composer_require | 否 | composer 需求的对象(包名: 版本) |
app/code/{Vendor}/{Module} 目录是否已存在app/code/{Vendor}/{Module}/
├── registration.php
├── composer.json
└── etc/
└── module.xml
使用模板 assets/templates/registration.php.tpl:
{{VENDOR}} 替换为供应商名称{{MODULE}} 替换为模块名称使用模板 assets/templates/composer.json.tpl:
{{VENDOR}} 替换为供应商名称(PascalCase){{MODULE}} 替换为模块名称(PascalCase){{vendor_kebabcase}} 替换为 kebab-case 格式、带连字符的供应商名称{{module_kebabcase}} 替换为 kebab-case 格式、带连字符的模块名称{{DESCRIPTION}} 替换为描述composer_require 参数中的条目添加到 require 部分使用模板 assets/templates/module.xml.tpl:
{{VENDOR}} 替换为 PascalCase 格式的供应商名称{{MODULE}} 替换为 PascalCase 格式的模块名称{{SEQUENCE}} 替换为包含依赖项的 <sequence> 块,若无依赖项则为空字符串如果调用方技能请求,则使用 hyva-exec-shell-cmd 技能运行 bin/magento setup:upgrade,并选择适当的包装器。
当出现以下情况时,中止模块创建并向调用方技能报告错误:
| 条件 | 操作 |
|---|---|
| 供应商名称非 PascalCase 格式 | 报告:"无效的供应商名称 '{name}':必须以大写字母开头且仅包含字母数字字符" |
| 模块名称非 PascalCase 格式 | 报告:"无效的模块名称 '{name}':必须以大写字母开头且仅包含字母数字字符" |
| 目录已存在 | 报告:"模块已存在于 app/code/{Vendor}/{Module}" |
| 无法创建目录 | 报告:"无法创建目录 app/code/{Vendor}/{Module}: {error}" |
| 无法写入文件 | 报告:"无法写入 {filename}: {error}" |
如果在请求执行步骤 4 时 hyva-exec-shell-cmd 技能不可用,则跳过 setup:upgrade 步骤并报告:"已跳过 setup:upgrade - hyva-exec-shell-cmd 技能不可用。请手动运行:bin/magento setup:upgrade"
| 占位符 | 描述 | 示例 |
|---|---|---|
{{VENDOR}} | 供应商名称(PascalCase) | Acme |
{{MODULE}} | 模块名称(PascalCase) | CustomFeature |
{{vendor_kebabcase}} | 供应商名称(kebab-case,按大写字母拆分) | acme |
{{module_kebabcase}} | 模块名称(kebab-case,按大写字母拆分) | custom-feature |
{{DESCRIPTION}} | 模块描述 | Acme CustomFeature module |
{{SEQUENCE}} | 模块顺序 XML 或空值 | <sequence><module name="Magento_Catalog"/></sequence> |
通过在每个大写字母前插入连字符并转换为小写来转换模块名称:
| PascalCase | kebab-case |
|---|---|
CustomFeature | custom-feature |
ShoppingCartGraphQl | shopping-cart-graph-ql |
CmsComponents | cms-components |
MyModule | my-module |
技能应引用此技能来创建模块:
To create the module, use the `hyva-create-module` skill with:
- vendor: "Acme"
- module: "CmsComponents"
- dependencies: ["Hyva_CmsBase"]
- composer_require: {"hyva-themes/commerce-module-cms": "*"}
对于供应商 Acme,模块 CmsComponents,依赖 Hyva_CmsBase:
app/code/Acme/CmsComponents/registration.php:
<?php
declare(strict_types=1);
use Magento\Framework\Component\ComponentRegistrar;
ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Acme_CmsComponents', __DIR__);
app/code/Acme/CmsComponents/composer.json:
{
"name": "acme/module-cms-components",
"description": "Acme CmsComponents module",
"type": "magento2-module",
"require": {
"php": ">=8.1",
"hyva-themes/commerce-module-cms": "*"
},
"autoload": {
"files": ["registration.php"],
"psr-4": {
"Acme\\CmsComponents\\": ""
}
}
}
app/code/Acme/CmsComponents/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_CmsComponents">
<sequence>
<module name="Hyva_CmsBase"/>
</sequence>
</module>
</config>
每周安装量
157
代码仓库
GitHub 星标数
59
首次出现
2026年1月27日
安全审计
安装于
github-copilot155
opencode150
codex150
gemini-cli146
amp145
kimi-cli145
This utility skill creates new Magento 2 modules in app/code/. It is designed to be called by other skills that need module scaffolding.
Command execution: For commands that need to run inside the development environment (e.g., bin/magento), use the hyva-exec-shell-cmd skill to detect the environment and determine the appropriate command wrapper.
When invoking this skill, the calling skill should provide:
| Parameter | Required | Description |
|---|---|---|
vendor | Yes | Vendor name in PascalCase (e.g., Acme) |
module | Yes | Module name in PascalCase (e.g., CustomFeature) |
description | No | Module description for composer.json (default: "[Vendor] [Module] module") |
dependencies | No | Array of module dependencies for <sequence> in module.xml |
composer_require | No | Object of composer requirements (package: version) |
app/code/{Vendor}/{Module} does not already existapp/code/{Vendor}/{Module}/
├── registration.php
├── composer.json
└── etc/
└── module.xml
Use template assets/templates/registration.php.tpl:
{{VENDOR}} with vendor name{{MODULE}} with module nameUse template assets/templates/composer.json.tpl:
{{VENDOR}} with vendor name (PascalCase){{MODULE}} with module name (PascalCase){{vendor_kebabcase}} with kebab-case, hyphenated vendor name{{module_kebabcase}} with kebab-case, hyphenated module name{{DESCRIPTION}} with descriptioncomposer_require parameter to the require sectionUse template assets/templates/module.xml.tpl:
{{VENDOR}} with PascalCase vendor name{{MODULE}} with PascalCase module name{{SEQUENCE}} with <sequence> block containing dependencies, or empty string if noneIf the calling skill requests it, run bin/magento setup:upgrade using the hyva-exec-shell-cmd skill for the appropriate wrapper.
Abort module creation and report the error to the calling skill when:
| Condition | Action |
|---|---|
| Vendor name not PascalCase | Report: "Invalid vendor name '{name}': must start with uppercase letter and contain only alphanumeric characters" |
| Module name not PascalCase | Report: "Invalid module name '{name}': must start with uppercase letter and contain only alphanumeric characters" |
| Directory already exists | Report: "Module already exists at app/code/{Vendor}/{Module}" |
| Cannot create directory | Report: "Failed to create directory app/code/{Vendor}/{Module}: {error}" |
| Cannot write file | Report: "Failed to write {filename}: {error}" |
If hyva-exec-shell-cmd skill is unavailable when Step 4 is requested, skip the setup:upgrade step and report: "Skipped setup:upgrade - hyva-exec-shell-cmd skill not available. Run manually: bin/magento setup:upgrade"
| Placeholder | Description | Example |
|---|---|---|
{{VENDOR}} | Vendor name (PascalCase) | Acme |
{{MODULE}} | Module name (PascalCase) | CustomFeature |
{{vendor_kebabcase}} | Vendor name (kebab-case, split on capitals) | acme |
{{module_kebabcase}} |
Convert module names by inserting a hyphen before each capital letter and lowercasing:
| PascalCase | kebab-case |
|---|---|
CustomFeature | custom-feature |
ShoppingCartGraphQl | shopping-cart-graph-ql |
CmsComponents | cms-components |
MyModule | my-module |
Skills should reference this skill for module creation:
To create the module, use the `hyva-create-module` skill with:
- vendor: "Acme"
- module: "CmsComponents"
- dependencies: ["Hyva_CmsBase"]
- composer_require: {"hyva-themes/commerce-module-cms": "*"}
For vendor Acme, module CmsComponents, with Hyva_CmsBase dependency:
app/code/Acme/CmsComponents/registration.php:
<?php
declare(strict_types=1);
use Magento\Framework\Component\ComponentRegistrar;
ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Acme_CmsComponents', __DIR__);
app/code/Acme/CmsComponents/composer.json:
{
"name": "acme/module-cms-components",
"description": "Acme CmsComponents module",
"type": "magento2-module",
"require": {
"php": ">=8.1",
"hyva-themes/commerce-module-cms": "*"
},
"autoload": {
"files": ["registration.php"],
"psr-4": {
"Acme\\CmsComponents\\": ""
}
}
}
app/code/Acme/CmsComponents/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_CmsComponents">
<sequence>
<module name="Hyva_CmsBase"/>
</sequence>
</module>
</config>
Weekly Installs
157
Repository
GitHub Stars
59
First Seen
Jan 27, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
github-copilot155
opencode150
codex150
gemini-cli146
amp145
kimi-cli145
Skills CLI 使用指南:AI Agent 技能包管理器安装与管理教程
33,600 周安装
Oracle IDCS组织配置技能:解决登录后租户、角色与成员资格生效问题
2 周安装
Fastify Better Auth Bridge:集成Better Auth与Fastify 5的认证桥接解决方案
2 周安装
your-skill-name 技能详解:AI 助手功能、使用流程与最佳实践指南
2 周安装
AI求职申请优化器 - 智能定制简历、求职信,提升面试成功率 | 简历优化工具
154 周安装
OpenSpec 变更提案工具:一步生成提案、设计与任务文档
2 周安装
fibx CLI 配置管理 - 自定义区块链 RPC URL,解决速率限制与连接问题
2 周安装
| Module name (kebab-case, split on capitals) |
custom-feature |
{{DESCRIPTION}} | Module description | Acme CustomFeature module |
{{SEQUENCE}} | Module sequence XML or empty | <sequence><module name="Magento_Catalog"/></sequence> |