Command Palette

Search for a command to run...

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

hyva-module-compatibility

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

Identify and fix Magento 2 module compatibility issues with Hyvä Themes. Covers block plugin bypasses, RequireJS/Knockout replacements, ViewModels, and…

ProxiBlueот ProxiBlue★ 17 звёзд на GitHub21 установка в других каталогах

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

Hyvä Module Compatibility Skill

Overview

This skill helps identify and fix Magento 2 module compatibility issues with Hyvä Themes. Hyvä uses Alpine.js and TailwindCSS instead of Luma's Knockout.js and RequireJS, which often breaks modules designed for the default Luma theme.

When to Use This Skill

  • A Magento 2 module works in admin but not on Hyvä frontend
  • Plugins targeting Magento blocks don't apply on frontend
  • JavaScript-based features are missing or broken
  • Custom rendering/UI components don't appear correctly

Common Hyvä Compatibility Issues

1. Block Plugins Don't Execute

Symptom: Plugins that modify block HTML output (e.g., after*Html() methods) don't apply on frontend.

Root Cause: Hyvä often uses custom ViewModels and templates that bypass standard Magento blocks.

Example from this project:

// ❌ This plugin doesn't work with Hyvä
class SelectPlugin {
    public function afterGetValuesHtml(Select $subject, string $result): string {
        // Modifies HTML - but Hyvä doesn't call getValuesHtml()
    }
}

Solution: Instead of plugins, use:

  • Template overrides in your theme
  • Custom ViewModels injected via ViewModelRegistry
  • Alpine.js for client-side rendering

2. RequireJS/Knockout Dependencies

Symptom: JavaScript features don't load; console errors about missing modules.

Root Cause: Hyvä doesn't include RequireJS or Knockout.js by default.

Solution:

  • Replace RequireJS modules with vanilla JavaScript or Alpine.js
  • Use <script> tags with modern ES6+ JavaScript
  • Leverage Hyvä's ViewModels for data injection

3. Layout XML Blocks Not Rendering

Symptom: Blocks defined in layout XML don't appear on frontend.

Root Cause: Hyvä templates may not include the block reference points.

Solution:

  • Check if Hyvä has an equivalent template
  • Override Hyvä templates in your theme to add missing blocks
  • Use $block->getChildHtml() in templates

Hyvä Compatibility Workflow

Step 1: Identify the Issue

# Test in admin first (should work)
# Then test on frontend with Hyvä theme

# Check browser console for errors
# Check var/log/system.log for PHP errors

# Verify theme is actually Hyvä
bin/magento theme:list

Step 2: Locate the Incompatible Code

Check for these patterns:

// ❌ Block HTML modification plugins
public function afterGetHtml(...) {}
public function afterToHtml(...) {}

// ❌ RequireJS dependencies
<script type="text/x-magento-init">
require(['jquery', 'mage/...'], function($) {});

// ❌ Knockout.js data-bind
<div data-bind="scope: 'component'">

Find Hyvä equivalents:

# Search Hyvä theme templates
find vendor/hyva-themes -name "*.phtml" | xargs grep -l "pattern"

# Check if Hyvä has a compatibility module
ls app/code/Hyva/*/

Step 3: Implement Hyvä-Compatible Solution

Pattern A: Template Override with ViewModel

File: app/design/frontend/YourVendor/your-theme/Module_Name/templates/your-template.phtml

<?php
use Hyva\Theme\Model\ViewModelRegistry;
use Your\Module\ViewModel\YourViewModel;

/** @var ViewModelRegistry $viewModels */
$viewModels = $viewModels ?? \Magento\Framework\App\ObjectManager::getInstance()
    ->get(ViewModelRegistry::class);

/** @var YourViewModel $customViewModel */
$customViewModel = $viewModels->require(YourViewModel::class);

// Get data from ViewModel
$data = $customViewModel->getData();
?>

<!-- Use Alpine.js for interactivity -->
<div x-data="{
    myData: <?= $escaper->escapeHtmlAttr(json_encode($data)) ?>,
    myMethod() {
        // Alpine.js method
    }
}" x-init="myMethod()">
    <span x-text="myData.someValue"></span>
</div>

Pattern B: Alpine.js Integration

When: You need client-side reactivity (dropdowns, filters, dynamic updates)

// In your template .phtml file
<script>
function initYourFeature() {
    return {
        // Data properties
        selectedValue: null,
        options: <?= /* @noEscape */ json_encode($options) ?>,

        // Initialization
        init() {
            this.$nextTick(() => {
                this.applyDefaults();
            });
        },

        // Methods
        applyDefaults() {
            // Set default values
            if (this.defaultValue) {
                this.selectedValue = this.defaultValue;
                // Update DOM
                const element = document.querySelector('#my-select');
                if (element) {
                    element.value = this.defaultValue;
                }
            }
        },

        // Event handlers
        handleChange($dispatch, value) {
            this.selectedValue = value;
            $dispatch('custom-event', { value });
        }
    }
}
</script>

<div x-data="initYourFeature()" x-init="init()">
    <select x-on:change="handleChange($dispatch, $event.target.value)">
        <template x-for="option in options">
            <option :value="option.value" x-text=
Полный SKILL.md на GitHub

Установить hyva-module-compatibility в Claude Code и Claude Desktop

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

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

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

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

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

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл hyva-module-compatibility?

Identify and fix Magento 2 module compatibility issues with Hyvä Themes. Covers block plugin bypasses, RequireJS/Knockout replacements, ViewModels, and Alpine.js integration for modules that work in admin but fail on Hyvä frontend.

Как установить скилл hyva-module-compatibility?

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

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

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

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

Сравнить hyva-module-compatibility с