Logo von Hyva Cms Component

Hyva Cms Component

Organisation
hyva-themes
hyva-cms-component

Erstellen Sie eine benutzerdefinierte Hyvä-CMS-Komponente. Verwenden Sie diesen Skill, wenn Sie eine neue Hyvä-CMS-Komponente erstellen, eine Hyvä-Komponente entwickeln oder Hilfe zu components.json und PHTML-Templates für Hyvä CMS benötigen. Auslösephrasen sind unter anderem „create hyva cms component“, „add cms component“, „new hyva component“, „build page hyva cms element“ und „custom cms element“.

Add to TypingMind

Übersicht

Herausgeberhyva-themes
Repositoryhyva-ai-tools
Skill-Namehyva-cms-component
Sterne
84
Forks
16
Mitgelieferte Dateien
7
LizenzOSL-3.0
Links
  • Anweisungen in Markdown

    Eine SKILL.md-Datei, die das Modell bei Bedarf lädt. So werden nur dann Token verbraucht, wenn eine Anfrage tatsächlich dazu passt.

  • Funktioniert mit jedem LLM

    KI-Skills bestehen aus reinem Markdown, nicht aus anbieterspezifischem Code. Daher funktionieren sie mit GPT, Claude, Gemini, Grok oder einem lokalen Modell.

  • Mitgelieferte Dateien: 7

    Skripte, Vorlagen und Referenzmaterial, die das Modell bei der Arbeit lesen kann. Die Dateien sind schreibgeschützt und werden niemals ausgeführt.

  • Open Source

    Von hyva-themes auf GitHub veröffentlicht. Prüfen Sie vor der Installation die Quelldateien.

Installation

Installieren Sie den KI-Skill Hyva Cms Component in TypingMind, um ihn mit jedem LLM zu nutzen, oder fügen Sie ihn einem anderen Agenten hinzu, der SKILL.md lesen kann.

1

In TypingMind installieren

TypingMind installiert einen Skill direkt aus seinem GitHub-Ordner. Dabei liest die App SKILL.md, bündelt die Ressourcendateien und speichert das Ergebnis lokal.

  1. Öffnen Sie die App und gehen Sie zu Plugins → Skills.
  2. Wählen Sie „Von GitHub installieren“.
  3. Fügen Sie die unten angegebene URL des Skill-Ordners ein und bestätigen Sie.
    https://github.com/hyva-themes/hyva-ai-tools/tree/main/skills/hyva-cms-component
  4. Aktivieren Sie den Skill in jedem Chat, in dem er verfügbar sein soll.
Plugins → Skills → Skill hinzufügen → Über GitHub-URL. Fügen Sie dann die Ordner-URL ein und klicken Sie auf „Weiter“.
2

In einem anderen Agenten installieren

Jeder Agent, der das Agent-Skills-Format unterstützt, kann diesen Skill nutzen. Kopieren Sie den Ordner in das Skill-Verzeichnis des jeweiligen Agenten.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/hyva-themes/hyva-ai-tools.git /tmp/hyva-ai-tools
mkdir -p .claude/skills
cp -r /tmp/hyva-ai-tools/skills/hyva-cms-component .claude/skills/hyva-cms-component
Starten Sie Claude Code nach dem Kopieren neu, damit der neue Skill erkannt wird.

In TypingMind verwenden

Aktivieren Sie Hyva Cms Component in einem beliebigen Chat in TypingMind. Den Rest übernimmt das Modell. Name und Beschreibung des Skills stehen im System-Prompt. Sobald eine Anfrage passt, lädt das Modell selbstständig die vollständigen Anweisungen — Sie müssen den Skill nie manuell aufrufen, und er verbraucht erst Token, wenn er tatsächlich genutzt wird.

Das Modell lädt Hyva Cms Component automatisch, sobald eine passende Anfrage gestellt wird.

Funktioniert mit jedem KI-Modell

KI-Skills bestehen aus reinen Markdown-Anweisungen statt aus anbieterspezifischem Code. Daher ist Hyva Cms Component nicht an das Modell gebunden, für das der Skill geschrieben wurde. Installieren Sie ihn einmal in TypingMind und nutzen Sie ihn mit GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder einem selbst betriebenen lokalen Modell — alles mit Ihren eigenen API-Schlüsseln.

  • Wird nur bei Bedarf geladen

    Der System-Prompt enthält nur den Namen und die Beschreibung. Die Anweisungen werden bei der ersten passenden Anfrage geladen. Ein ungenutzter Skill verursacht daher keine Kosten.

  • Modell im laufenden Chat wechseln

    Da der Skill aus Anweisungen statt aus Code besteht, funktioniert er auch nach einem Modellwechsel — das nächste Modell liest dieselbe SKILL.md-Datei.

Skill-Anweisungen

Dies ist der Inhalt von SKILL.md, den das Modell lädt. Lesen Sie ihn vor der Installation — ein Skill besteht aus Anweisungen, denen Ihr Modell folgt.

Hyvä CMS Component Creator

Overview

This skill guides the interactive creation of custom Hyvä CMS components for Magento 2. It supports creating components in new or existing modules, with field presets for common patterns and automatic setup:upgrade execution.

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.

Workflow

Step 1: Module Selection

If not already specified in the prompt, ask the user where to create the component:

Option A: New Module

Ask for both values (do not assume defaults without asking):

  1. Vendor name (e.g., Acme) - Required, no default. Do not suggest a Vendor name, prompt for user input.
  2. Module name - Suggest CmsComponents as default so user can press Enter to accept

Then use the hyva-create-module skill with:

  • dependencies: ["Hyva_CmsBase"]
  • composer_require: {"hyva-themes/commerce-module-cms": "^1.0"}

Option B: Existing Module

  • Request the module path (can be in app/code/, vendor/, or custom location)
  • Verify the module has Hyva_CmsBase as a dependency in etc/module.xml. If not present, add it.
  • Verify the module has hyva-themes/commerce-module-cms as a dependency in composer.json. If not present, add it.

Step 2: Component Details

Gather component information:

  1. Component name (snake_case, e.g., feature_card)

  2. Label (display name in editor, e.g., "Feature Card")

  3. Category (Layout, Elements, Media, Content, or Other)

  4. Icon - Automatically select an appropriate icon:

    Step 4a: Identify icons already in use Use the hyva-cms-components-dump skill to dump all current CMS components. Extract all icon values from the output to build a list of icons already in use by existing components.

    Step 4b: Find available lucide icons List the SVG files in vendor/hyva-themes/magento2-theme-module/src/view/base/web/svg/lucide/ to get the full set of available icons.

    Step 4c: Select the best fitting icon From the available lucide icons that are NOT already in use by another component:

    • Choose the icon whose name best matches the purpose/meaning of the new component
    • Consider semantic meaning (e.g., shopping-cart.svg for cart-related, image.svg for image-related, layout-grid.svg for grid layouts)
    • Format the selected icon as Hyva_Theme::svg/lucide/[icon-name].svg

    If no suitable unused icon can be found, or if the lucide directory doesn't exist, leave the icon property unset.

Step 3: Field Selection

Offer field presets or custom field creation. See references/field-types.md "Field Presets" section for available presets (Basic Card, Image Card, CTA Block, Text Block, Feature Item, Testimonial, Accordion Item) or allow custom field definition.

Authoritative field types: prefer the project's live list when available — run bin/magento hyva:cms:list-fields (core + custom field types) via the hyva-exec-shell-cmd wrapper. Fall back to references/field-types.md only when the command is unavailable.

For custom fields, iterate through each field asking:

  1. Field name (snake_case)
  2. Field type (see references/field-types.md)
  3. Label
  4. Default value (optional)
  5. Required? (yes/no) - Note: This will be added as attributes.required, NOT as a direct field property
  6. Any additional attributes (these go in the attributes object)

Step 4: Variant Support

Ask if the component needs template variants:

  • If yes: Gather variant names and labels (e.g., default, compact, wide). See references/variant-support.md for configuration details.
  • If no: Use single template

Step 5: Generate Files

Create the required files:

For New Modules

The hyva-create-module skill creates the base module structure. Then add the CMS-specific directories:

app/code/[Vendor]/[Module]/
├── registration.php          # Created by hyva-create-module
├── composer.json             # Created by hyva-create-module
├── etc/
│   ├── module.xml            # Created by hyva-create-module
│   └── hyva_cms/
│       └── components.json   # Create this
└── view/
    └── frontend/
        └── templates/
            └── elements/
                └── [component-name].phtml (or [component-name]/ for variants)
For Existing Modules

Create or update:

  • etc/hyva_cms/components.json (merge with existing if present)
  • view/frontend/templates/elements/[component-name].phtml

Step 6: Run Setup

After creating files, run bin/magento setup:upgrade using the appropriate command wrapper detected by the hyva-exec-shell-cmd skill.

File Generation Details

components.json Structure

json
{
    "[component_name]": {
        "label": "[Label]",
        "category": "[Category]",
        "template": "[Vendor]_[Module]::elements/[component-name].phtml",
        "content": {
            // Generated fields
        },
        "design": {
            "includes": [
                "Hyva_CmsBase::etc/hyva_cms/default_design.json",
                "Hyva_CmsBase::etc/hyva_cms/default_design_typography.json"
            ]
        },
        "advanced": {
            "includes": [
                "Hyva_CmsBase::etc/hyva_cms/default_advanced.json"
            ]
        }
    }
}

Valid Component Properties

IMPORTANT: Only specific properties are allowed at the component level. See references/component-schema.md for the complete schema reference.

Key properties: label (required), category, template, icon, children, require_parent, content, design, advanced, disabled, custom_properties.

Invalid properties that will cause schema errors:

  • hidden - Does not exist. Use require_parent: true for child-only components, or disabled: true
  • Any property not listed in the schema reference

Children Configuration (CRITICAL)

IMPORTANT: children is a ROOT-LEVEL component property, NOT a field type within content, design, or advanced.

INCORRECT ❌:

json
{
    "my_component": {
        "content": {
            "items": {
                "type": "children",
                "label": "Items"
            }
        }
    }
}

CORRECT ✅:

json
{
    "my_component": {
        "label": "My Component",
        "children": {
            "config": {
                "accepts": ["child_component"],
                "max_children": 10
            }
        },
        "content": {
            "title": {
                "type": "text",
                "label": "Title"
            }
        }
    }
}

In templates, access children via $block->getData('children'), NOT via a custom field name.

Field Validation (CRITICAL)

IMPORTANT: Field validation attributes like required must be placed in the attributes object, NOT as direct field properties.

INCORRECT ❌:

json
{
    "title": {
        "type": "text",
        "label": "Title",
        "required": true
    }
}

CORRECT ✅:

json
{
    "title": {
        "type": "text",
        "label": "Title",
        "attributes": {
            "required": true
        }
    }
}

Other validation attributes that go in attributes:

  • required (boolean)
  • minlength / maxlength (string)
  • min / max (for numbers)
  • pattern (regex string)
  • placeholder (string)
  • comment (help text)
  • Custom data attributes for validation messages

Child-Only Components

For components that should only be used as children of other components (like list items), use require_parent: true:

json
{
    "my_list_item": {
        "label": "My List Item",
        "category": "Elements",
        "require_parent": true,
        "template": false,
        "content": {
            "title": {"type": "text", "label": "Title"}
        }
    },
    "my_list": {
        "label": "My List",
        "category": "Elements",
        "template": "Vendor_Module::elements/my-list.phtml",
        "children": {
            "config": {
                "accepts": ["my_list_item"]
            }
        }
    }
}

When template: false, the parent component renders the child data directly (NOT using $block->createChildHtml()). See "Rendering Children with template: false" below.

PHTML Template Structure

Every template must start with this header:

php
<?php
declare(strict_types=1);

use Hyva\CmsLiveviewEditor\Block\Element;
use Hyva\Theme\Model\ViewModelRegistry;
use Magento\Framework\Escaper;

/** @var Element $block */
/** @var Escaper $escaper */
/** @var ViewModelRegistry $viewModels */

Additional requirements:

  1. $block->getEditorAttrs() on root element
  2. $block->getEditorAttrs('field_name') on editable elements
  3. Proper escaping with $escaper->escapeHtml() and $escaper->escapeHtmlAttr()

Template Patterns by Field Type

Text fields:

php
$title = $block->getData('title');
// In template:
<?php if ($title): ?>
    <h2 <?= /** @noEscape */ $block->getEditorAttrs('title') ?>>
        <?= $escaper->escapeHtml($title) ?>
    </h2>
<?php endif; ?>

Richtext/HTML fields:

php
$content = $block->getData('content');
// In template (no escaping for richtext):
<?php if ($content): ?>
    <div <?= /** @noEscape */ $block->getEditorAttrs('content') ?>>
        <?= /** @noEscape */ $content ?>
    </div>
<?php endif; ?>

Image fields:

Use the hyva-render-media-image skill for rendering images. It provides the complete API reference and code patterns for the \Hyva\Theme\ViewModel\Media view model.

Add these imports when rendering images:

php
// Additional imports for templates with images:
use Hyva\Theme\ViewModel\Media;

/** @var Media $mediaViewModel */
$mediaViewModel = $viewModels->require(Media::class);

The data from $block->getData('image') can be passed directly to getResponsivePictureHtml():

php
$image = $block->getData('image');

// In template:
<?php if ($image): ?>
    <?= /** @noEscape */ $mediaViewModel->getResponsivePictureHtml(
        $image,
        ['class' => 'w-full h-auto', 'loading' => 'lazy']
    ) ?>
<?php endif; ?>

For responsive images with separate desktop and mobile sources, see the hyva-render-media-image skill.

Link fields:

php
$link = $block->getData('link');
$linkData = $link ? $block->getLinkData($link) : null;
// In template:
<?php if ($linkData): ?>
    <a href="<?= $escaper->escapeUrl($linkData['url']) ?>"
       <?php if (!empty($linkData['target'])): ?>target="<?= $escaper->escapeHtmlAttr($linkData['target']) ?>"<?php endif; ?>>
        <?= $escaper->escapeHtml($linkData['title'] ?: 'Read more') ?>
    </a>
<?php endif; ?>

Boolean fields:

php
$showTitle = (bool) $block->getData('show_title');
// In template:
<?php if ($showTitle && $title): ?>
    <!-- title markup -->
<?php endif; ?>

Select fields:

php
$style = $block->getData('style') ?: 'default';
$styleClasses = match($style) {
    'primary' => 'bg-blue-600 text-white',
    'secondary' => 'bg-gray-200 text-gray-800',
    default => 'bg-white text-gray-600'
};

Children fields (with their own templates):

When child components have their own templates (default behavior), use $block->createChildHtml():

php
$children = $block->getData('children') ?: [];
// In template:
<?php foreach ($children as $index => $child): ?>
    <?= /** @noEscape */ $block->createChildHtml($child, 'child-' . $index) ?>
<?php endforeach; ?>

Rendering Children with template: false:

When child components have "template": false, the parent component renders them directly. Child data is flat - field values are directly on the child array, NOT nested under a content key.

php
$children = $block->getData('children') ?: [];

// In template - iterate and access child data directly:
<?php foreach ($children as $elementData): ?>
    <?php
    // Access fields directly on $elementData (NOT $elementData['content']['field'])
    $image = $elementData['image'] ?? null;
    $title = $elementData['title'] ?? '';
    $description = $elementData['description'] ?? '';

    // Each child has a 'uid' for editor attributes
    $childUid = $elementData['uid'];
    ?>
    <div <?= /** @noEscape */ $block->getEditorAttrs('', $childUid) ?>>
        <?php if (!empty($image['src'])): ?>
            <?php // For image rendering patterns, see the hyva-render-media-image skill ?>
            <?= /** @noEscape */ $mediaViewModel->getResponsivePictureHtml(
                [$block->getResponsiveImageData($image)],
                ['alt' => $image['alt'] ?? '', 'class' => 'w-full h-auto', 'loading' => 'lazy']
            ) ?>
        <?php endif; ?>
        <p <?= /** @noEscape */ $block->getEditorAttrs('title', $childUid) ?>>
            <?= $escaper->escapeHtml($title) ?>
        </p>
    </div>
<?php endforeach; ?>

Key points for template: false children:

  • Child field data is flat: use $elementData['field_name'], NOT $elementData['content']['field_name']
  • Each child has a uid property for editor attributes
  • Use $block->getEditorAttrs('field_name', $childUid) to enable live editing of child fields
  • Use $block->getEditorAttrs('', $childUid) on the child's root element
  • For images, check !empty($image['src']) and use $block->getResponsiveImageData($image) to process the image data
  • For advanced image rendering patterns (responsive breakpoints, etc.), see the hyva-render-media-image skill

Resources

references/critical-patterns.md

READ THIS FIRST - Essential patterns and common mistakes including:

  • Correct children configuration (root-level vs field type)
  • Proper field validation with attributes
  • Default value syntax
  • Quick checklist before generating components

Read this file before generating any component to avoid common errors.

references/example-component.md

Complete end-to-end example showing a Feature Card component with:

  • Full components.json definition
  • Matching PHTML template with all field types
  • Supporting module files (registration.php, module.xml, composer.json)
  • Directory structure overview

Read this file when you need a reference for how all the pieces fit together.

Component/field schema (read from the project, with a bundled fallback)

The Hyvä CMS schema is project-version-dependent. Prefer the live schema from the installed Hyvä Commerce package: if vendor/hyva-themes/commerce-module-cms/src/liveview-editor/etc/hyva_cms/jsonschema/ exists, read its JSON files directly (no interpreter needed) for this project's authoritative component and field declarations:

  • component-declaration.json — valid component-level properties
  • component-field-declaration.json — field declaration properties, field types, validation attributes

Only when Hyvä Commerce is not installed, fall back to the bundled references/component-schema.md. Read either source when validating component structure or when encountering schema validation errors.

The bundled references/component-schema.md is a fallback snapshot. To refresh it after a Hyvä CMS update, regenerate it by reading the jsonschema/*.json files above — no helper script is required.

references/field-types.md

Complete reference for all supported field types including:

  • Field configuration syntax
  • All available field types with examples
  • Validation attributes
  • Conditional visibility (show_if/hide_if)
  • Field presets for common patterns

Read this file when generating field configurations.

references/variant-support.md

Guide for implementing template variants including:

  • Directory structure for variant templates
  • Variant field configuration in components.json
  • Template implementation patterns
  • Common variant patterns and best practices

Read this file when the user wants multiple layout options for a component.

references/troubleshooting.md

Solutions for common issues including:

  • Schema validation errors
  • Component not visible in editor
  • Template not rendering
  • Live editor not working
  • Image display issues
  • Fallbacks when dependent skills are unavailable

Read this file when encountering errors during component creation or testing.

assets/templates/component/template.phtml.tpl

Base PHTML structure for CMS components.

Placeholders:

  • {{CONTENT_FIELDS}} - PHP variable declarations
  • {{TEMPLATE_BODY}} - HTML template content

Important Guidelines

  1. Always use getEditorAttrs() on the root element and on each editable field element
  2. Never use <script> tags in templates - use Alpine.js via alpine:init event
  3. Escape all user content with appropriate escaper methods
  4. Use meaningful default values for better merchant experience
  5. Include design/advanced sections via includes for consistency
  6. Validate component names are snake_case with only lowercase letters, numbers, and underscores
  7. CRITICAL: Use default_value key, NOT default - The correct JSON key for default values is default_value (with underscore), not default. Example: "default_value": "My Title" ✅, NOT "default": "My Title" ❌
  8. CRITICAL: children is a root-level property, NOT a field type - Never use "type": "children" in content/design/advanced. Declare children at component root level. Access via $block->getData('children') in templates.
  9. CRITICAL: Validation goes in attributes, NOT as direct properties - Use "attributes": {"required": true} ✅, NOT "required": true ❌. All HTML5 validation attributes (required, minlength, maxlength, pattern, min, max) must be inside the attributes object.

Mitgelieferte Dateien

Das Modell liest diese Dateien bei Bedarf, während der Skill geladen ist. Sie werden als lesbare Dateien bereitgestellt und niemals ausgeführt.

Häufig gestellte Fragen

Was macht der KI-Skill Hyva Cms Component?

Erstellen Sie eine benutzerdefinierte Hyvä-CMS-Komponente. Verwenden Sie diesen Skill, wenn Sie eine neue Hyvä-CMS-Komponente erstellen, eine Hyvä-Komponente entwickeln oder Hilfe zu components.json und PHTML-Templates für Hyvä CMS benötigen. Auslösephrasen sind unter anderem „create hyva cms component“, „add cms component“, „new hyva component“, „build page hyva cms element“ und „custom cms element“.

Warum Hyva Cms Component in TypingMind nutzen?

Weil Sie den Skill einmal installieren und mit jedem Modell verwenden können. Hyva Cms Component besteht aus reinem Markdown statt aus anbieterspezifischem Code. So funktioniert derselbe Skill mit GPT-5, Claude, Gemini, Grok oder einem lokalen Modell – und Sie können das Modell mitten im Chat wechseln, ohne dass der Skill seine Funktion verliert. TypingMind verwendet Ihre eigenen API-Schlüssel. Sie bezahlen die Anbieter daher direkt statt über ein Abonnement pro Nutzerplatz, und Ihre Skills und Chats bleiben in Ihrem eigenen Speicher.

Wie installiere ich Hyva Cms Component in TypingMind?

Öffnen Sie in TypingMind Plugins → Skills → Von GitHub installieren und fügen Sie https://github.com/hyva-themes/hyva-ai-tools/tree/main/skills/hyva-cms-component ein. TypingMind liest die Datei SKILL.md, bündelt die zugehörigen Dateien und installiert alles als Skill, den Sie für jeden Chat einzeln aktivieren können.

Welche KI-Modelle können Hyva Cms Component nutzen?

Jedes Modell, das Sie mit TypingMind verbinden. KI-Skills bestehen aus reinen Markdown-Anweisungen statt aus anbieterspezifischem Code. Daher können GPT, Claude, Gemini, Grok und lokale Modelle diesen Skill laden, wenn eine Anfrage dazu passt.

Wie viele KI-Modelle kann ich mit Hyva Cms Component verwenden?

So viele Sie möchten. In TypingMind können Sie Hyva Cms Component mit jedem Modell verwenden, das Skills unterstützt, etwa mit GPT, Claude, Gemini, Grok, DeepSeek, Mistral oder Llama. Dabei nutzen Sie Ihre eigenen API-Schlüssel.

Ist der KI-Skill Hyva Cms Component kostenlos?

Ja. Der Skill wird von hyva-themes auf GitHub unter der Lizenz OSL-3.0 veröffentlicht. Sie bezahlen nur Ihren eigenen KI-Anbieter für die verwendeten Token.

Was sind KI-Skills?

Ein KI-Skill ist ein wiederverwendbares Anweisungspaket, das einem KI-Modell vermittelt, wie es eine bestimmte Aufgabe erledigt. Es folgt dem offenen Format Agent Skills: Die Datei SKILL.md enthält den Namen und die Beschreibung des Skills. Hinzu kommen bei Bedarf Skripte, Vorlagen oder Referenzdateien für das Modell. Das Modell liest die Anweisungen nur, wenn Ihre Anfrage zum Skill passt. Ein installierter Skill verursacht daher erst Kosten, wenn er verwendet wird.

Wie unterscheiden sich KI-Skills von Plugins oder MCP-Servern?

Ein Plugin oder MCP-Server stellt einem Modell neue aufrufbare Tools bereit – Code, der auf einem System ausgeführt wird und ein Ergebnis zurückgibt. Ein KI-Skill vermittelt dem Modell stattdessen Wissen und Vorgehensweisen: wie es eine Aufgabe angeht, welche Schritte es befolgt und wie eine gute Ausgabe aussieht. Skills bestehen aus reinem Markdown und kommen daher ohne Server, API-Schlüssel und Laufzeitumgebung aus. Sie funktionieren mit jedem Modell.

Alle anzeigen

Jetzt eigenen KI-Arbeitsbereich einrichten

Abonnieren Sie unseren Newsletter und erfahren Sie mehr über neue Funktionen und kommende Gewinnspiele 👇