跳到主内容
智客 ZICQ

技能库 智客分类:安全测试 hyva-alpine-component

Hyva Alpine Component

在 Magento 为 Hyvä 主题写 CSP 兼容的 Alpine.js 组件 2. 当用户想要创建高山元件,在Hyvä模板中添加交互功能,为Hyvä主题写出JavaScript,或需要与Content Security Policy合作的Alpine.js模式帮助时,应该使用这种技能. 触发短语包括"创建高山元件","添加交互","高山为hyva","x-数据元件","csp相容","csp符合javascript"等.

1154 安装量

官方网址:skills.sh

技能介绍

先看中文介绍;官方 description 原文单独保留,不改写 SKILL.md。

做什么

在 Magento 为 Hyvä 主题写 CSP 兼容的 Alpine.js 组件 2. 当用户想要创建高山元件,在Hyvä模板中添加交互功能,为Hyvä主题写出JavaScript,或需要与Content Security Policy合作的Alpine.js模式帮助时,应该使用这种技能. 触发短语包括"创建高山元件","添加交互","高山为hyva","x-数据元件","csp相容","csp符合javascript"等.

何时用

官方 description 未单独写出 Use when。按规范,代理会在用户任务与这段 description 的关键词匹配时激活本技能。

代理如何加载

按 Agent Skills 渐进披露:启动时只加载 name 与 description(约 100 token);任务匹配后才读入整份 SKILL.md 正文;scripts/、references/、assets/ 仅在需要时再读。 本文件正文结构:Hyvä Alpine Component、Overview、CSP Constraints Summary、Component Structure Pattern、Constructor Functions、Basic Registration。

文件分析

文件分析:这是一份仅含 SKILL.md 的指令型技能,代理激活后整份正文进入上下文。 正文约 677 行,超过规范建议的 500 行,激活时仍会整份载入。

官方 description(原文)

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".

Hyvä Alpine ComponentOverviewCSP Constraints SummaryComponent Structure PatternConstructor FunctionsBasic RegistrationComposing Multiple ObjectsProperty Access PatternsValue Properties with Dot NotationTransforming Values (Negation, Conditions)Negation Method ShorthandProperty Mutation Patterns

来源分类:skills.sh agent-skill

SKILL.md 与 Agent 调用

官方规范 ↗
name
hyva-alpine-component
description
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".
  1. 发现技能客户端向 Agent 提供名称与描述目录。
  2. 匹配与调用用户指定或任务匹配后,载入 SKILL.md 指令。
  3. 按需加载按步骤读取参考文档、使用脚本与素材。

具体调用语法与可用工具以目标 Agent 客户端为准。 查看调用机制说明 ↗

安装这个技能

Skills CLI ↗

先选择目标 Agent 和安装范围,保留技能包的附属文件,安装后检查客户端能否发现该技能。

交给 Agent 安装

复制安装指令给支持 Agent Skills 的代理,确认其中的目标目录与客户端匹配。

把 Agent Skill「hyva-alpine-component」安装到我的项目:SKILL.md 原文与官方 description 见 https://zicq.com/zh/skills/skl-f421d701ec196cd7-%E6%B5%B7%E7%93%A6%E9%AB%98%E5%B1%B1%E9%83%A8%E5%88%86.html
请存为 .cursor/skills/hyva-alpine-component/SKILL.md 或 .claude/skills/hyva-alpine-component/SKILL.md,frontmatter 的 name 与 description 保持原样,不要改写。

GitHub 完整包 ↗

终端安装 · Skills CLI

需要 Node.js 与 npx。先查看仓库技能列表,确认实际名称。

npx skills add 'https://github.com/hyva-themes/hyva-ai-tools' --list

npx skills add 'https://github.com/hyva-themes/hyva-ai-tools' --skill 'hyva-alpine-component'

CLI 会交互选择目标 Agent,默认安装到项目;用户级安装使用 -g。先通过查看命令核对仓库内容,再用 npx skills list 检查已安装技能。

阅读排版
--- name: hyva-alpine-component description: 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". --- # Hyvä Alpine Component ## Overview This skill provides guidance for writing CSP-compatible Alpine.js components in Hyvä themes. Alpine CSP is a specialized Alpine.js build that operates without the `unsafe-eval` CSP directive, which is required for PCI-DSS 4.0 compliance on payment-related pages (mandatory from April 1, 2025). **Key principle:** CSP-compatible code functions in both standard and Alpine CSP builds. Write all Alpine code using CSP patterns for future-proofing. ## CSP Constraints Summary | Capability | Standard Alpine | Alpine CSP | |------------|-----------------|------------| | Property reads | `x-show="open"` | Same | | Negation | `x-show="!open"` | Method: `x-show="isNotOpen"` | | Mutations | `@click="open = false"` | Method: `@click="close"` | | Method args | `@click="setTab('info')"` | Dataset: `@click="setTab" data-tab="info"` | | `x-model` | Available | **Not supported** - use `:value` + `@input` | | Range iteration | `x-for="i in 10"` | **Not supported** | ## Component Structure Pattern Every Alpine component in Hyvä follows this structure: ```html
registerInlineScript() ?> ``` **Critical requirements:** 1. Register constructor with `Alpine.data()` inside `alpine:init` event listener 2. Use `{once: true}` to prevent duplicate registrations 3. Call `$hyvaCsp->registerInlineScript()` after every ` registerInlineScript() ?> ``` ## References - Hyvä CSP Documentation: https://docs.hyva.io/hyva-themes/writing-code/csp/alpine-csp.html - Alpine.js Documentation: https://alpinejs.dev/ - Example components: `vendor/hyva-themes/magento2-default-theme-csp/` - Core utilities: `vendor/hyva-themes/magento2-theme-module/src/view/frontend/templates/page/js/hyva.phtml`

相关技能

安全测试

Skill Vetter

人工智能特工的安全第一技能审查。 在安装来自 ClawdHub, GitHub 或其他来源的任何技能之前使用 。 检查红旗,许可范围,可疑图案.

安全测试

Moltguard

MoltGuard——由OpenGuardrails担任OpenClaw保安. 安装 MoltGuard 以保护你和你的人类免受迅速注射、数据过滤和恶意命令的影响。 资料来源:https://github.com/openguardrails/openguardrails/tre…

安全测试

Security Auditor

用于审查安全漏洞代码,实施认证流,审计OWASP Top 10,配置CORS/CSP头,处理秘密,输入验证,SQL注射预防,XSS保护,或任何与安全相关的代码审查.

安全测试

Skill Vetter

安装任何AI代理技能前的安全审查协议. 红旗侦取入证盗取,疏通密码,放出. 风险分类:低/中/高/高。 编制结构化审查报告。 不先运行此功能, 绝不安装不信任的技能 .