How to install hyva-exec-shell-cmd
npx skills add https://github.com/hyva-themes/hyva-ai-tools --skill hyva-exec-shell-cmdFull instructions (SKILL.md)
Source of truth, from hyva-themes/hyva-ai-tools.
name: hyva-exec-shell-cmd description: Utility skill to detect Magento development environment and determine command wrapper. This skill should be used by other skills that need to execute shell commands in the Magento environment. It detects Warden, docker-magento, DDEV, and local environments and provides the appropriate command wrapper.
Execute Shell Commands in Magento Environment
This utility skill detects the Magento development environment and provides the appropriate command wrapper for executing shell commands.
Usage
Other skills should reference this skill when they need to execute commands in the Magento environment. The detected wrapper ensures commands run in the correct context (container or local).
Step 1: Detect Environment
Important: Execute this script from the Magento project root directory, or provide the path as an argument.
Run this detection once at the start of any skill that needs to execute shell commands:
<skill_path>/scripts/detect_env.sh [magento_root_path]
Where <skill_path> is the directory containing this SKILL.md file (e.g., .claude/skills/hyva-exec-shell-cmd).
The optional magento_root_path argument specifies the Magento installation directory. If omitted, the script uses the current working directory.
Output: warden, docker-magento, ddev, or local
Step 2: Apply Command Wrapper
Based on detected environment, wrap commands as follows:
| Environment | Command Wrapper | Description |
|---|---|---|
| Warden | warden env exec -T php-fpm bash -c "<command>" | Docker environment managed by Warden |
| docker-magento | bin/clinotty bash -c "<command>" | Mark Shust's docker-magento setup |
| DDEV | ddev exec <command> | DDEV containerized environment |
| Local | Run <command> directly | Native environment without containers |
Examples
Single command
# Warden
warden env exec -T php-fpm bash -c "bin/magento cache:clean"
# docker-magento
bin/clinotty bash -c "bin/magento cache:clean"
# DDEV
ddev exec bin/magento cache:clean
# Local
bin/magento cache:clean
Command with directory change
# Warden
warden env exec -T php-fpm bash -c "cd vendor/hyva-themes/magento2-default-theme/web/tailwind && npm run build"
# docker-magento
bin/clinotty bash -c "cd vendor/hyva-themes/magento2-default-theme/web/tailwind && npm run build"
# DDEV
ddev exec bash -c "vendor/hyva-themes/magento2-default-theme/web/tailwind && npm run build"
# Local
cd vendor/hyva-themes/magento2-default-theme/web/tailwind && npm run build
Commands That Do NOT Require Wrapping
Some commands run on the host system and should NOT be wrapped:
composercommands (runs on host, not in container)gitcommands- File operations on the host filesystem (
ls,find,cpfor files accessible from host) wardenCLI commandsddevCLI commands
Integration Pattern
Skills that need to execute commands should:
- Reference this skill: "Use the
hyva-exec-shell-cmdskill to determine the command wrapper" - Detect environment once using Step 1
- Store the wrapper pattern for use throughout the skill
- Apply the wrapper to all container commands per Step 2
Running a Bundled Skill Script Inside the Environment
Some skills ship a helper script (e.g. a PHP script under scripts/) that must run
through a PHP/Node interpreter. On a hardened host there is no local interpreter, and
a skill installed at user level (~/.../skills/...) is not inside the project, so the
container can't see it. Do not copy the script into the project tree: how files
reach the container differs across environments (bind mounts, Mutagen, named volumes)
and some paths are not synced at all (e.g. Warden serves var/, generated/,
pub/static, pub/media from separate volumes, so a host-written file there never
appears in the container).
Instead, stream the script into the interpreter over stdin — this is independent of the mount/sync strategy, needs no temp file, and needs no cleanup:
-
Detect the environment (Step 1) and resolve the wrapper (Step 2).
-
Containerized env — pipe the script to
php /dev/stdinthrough the wrapper (use the non-TTY-Texec so stdin is forwarded).<skill_path>is the directory containing the calling skill's SKILL.md:# Warden cat "<skill_path>/scripts/<script>.php" | warden env exec -T php-fpm bash -c "php /dev/stdin [args]" # docker-magento cat "<skill_path>/scripts/<script>.php" | bin/clinotty bash -c "php /dev/stdin [args]" # DDEV cat "<skill_path>/scripts/<script>.php" | ddev exec bash -c "php /dev/stdin [args]"The script runs with the container's working directory at the project root, so a script that locates the project via
getcwd()works unchanged. Capture stdout for the result.Script constraints for this method: the script must not also read from stdin (stdin carries the script itself), and must not rely on
__FILE__/__DIR__(it is/dev/stdin) — locate project files viagetcwd()instead. -
localenv: the host has no interpreter (removed during hardening). Do not attempt to run the script directly — report that a containerized dev environment (or a local interpreter) is required for this step.
Related skills
More from hyva-themes/hyva-ai-tools and the wider catalog.
hyva-alpine-component
Write CSP-compatible Alpine.js components for Hyvä themes in Magento 2. This skill should be used when the user wants to create Alpine components, add interactivity to Hyvä templates, write JavaScript for Hyvä themes, or needs help with Alpine.js patterns that work with Content Security Policy. Trigger phrases include "create alpine component", "add interactivity", "alpine for hyva", "x-data component", "csp compatibility", "csp compliant javascript".
hyva-child-theme
Create a Hyvä child theme in a Magento 2 project. This skill should be used when the user wants to create a new Hyvä child theme, set up a custom theme based on Hyvä, or initialize a new frontend theme directory structure. Trigger phrases include "create hyva child theme", "new hyva theme", "setup child theme", "create custom theme", "initialize theme".
hyva-compile-tailwind-css
Compile Tailwind CSS for Hyvä themes in Magento 2. Use when the user wants to build styles, generate CSS, compile Tailwind, run Tailwind, or create production/development stylesheets for a Hyvä theme. Also use when Tailwind classes are not taking effect or some styles appear missing after template changes — this typically means CSS needs to be recompiled. Triggers include "compile tailwind", "build styles", "generate css", "styles not working", "styles are missing", "styles not applied".
hyva-ui-component
Apply Hyva UI template-based components to a Hyvä theme. This skill should be used when the user wants to add, install, or apply a Hyva UI component (such as header, footer, gallery, menu, minicart, etc.) to their Hyvä theme. It lists available non-CMS components and their variants, displays component README instructions, and copies component files to the theme directory.
hyva-create-module
Create a new Magento 2 module in app/code/. This skill should be used when the user wants to create a module, scaffold a new module, generate module boilerplate, or set up a custom module. It handles registration.php, composer.json, module.xml generation with configurable dependencies. Trigger phrases include "create module", "new module", "scaffold module", "generate module".
hyva-render-media-image
Generate responsive image code for Hyvä Theme templates using the Media view model. This skill should be used when the user wants to render images in a Hyvä template, create responsive picture elements, add hero images, product images, or any image that needs responsive breakpoints. Trigger phrases include "render image", "add image to template", "responsive image", "picture element", "hero image", "responsive banner", "image for mobile and desktop", or "banner image".