Token导航 LogoToken导航

Agent Skill · 研究检索

drupal-frontend(Drupal 前端)

用于辅助前端页面、组件、样式和交互逻辑的开发与维护。它适合让 Agent 生成或审查 React、Next.js、Vue、Tailwind、CSS 等相关代码,整理组件结构,或定位布局和性能问题。使用时需要结合项目现有设计系统、路由和构建方式,避免只生成孤立片段;涉及页面改动时,应配合本地预览和构建检查确认视觉效果。

drupal-frontend 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为操作浏览器;许可证信息还不明确,第三方扫描已通过,按安装量在研究检索类的 73,675 个 Skill 里排第 35,345。

总安装 2,101周安装 85GitHub Stars 19下载 660核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:drupal-frontend(Drupal 前端)
来源仓库:https://github.com/omedia/drupal-skill
仓库路径:skills/drupal-frontend
安装命令:
npx skills add https://github.com/omedia/drupal-skill --skill drupal-frontend
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/omedia/drupal-skill --skill drupal-frontend

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

该技能提供 Drupal 前端开发的全面指导,涵盖主题开发、Twig 模板和资产管理。适用于主题定制、模板预处理、响应式设计和 CSS/JS 库集成。支持 Drupal 8-11+ 版本,提供现代化前端开发最佳实践。安装需从 GitHub 仓库获取,使用前应确认项目主题结构和 asset 构建方式。

涉及页面改动时,应配合本地预览和构建检查,避免生成孤立代码片段。

来源仓库内路径:skills/drupal-frontend

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/omedia/drupal-skill --skill drupal-frontend;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要操作浏览器,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

drupal-frontend 怎么安装?

在终端执行 npx skills add https://github.com/omedia/drupal-skill --skill drupal-frontend。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

drupal-frontend 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

drupal-frontend 需要什么权限?

权限级别是操作浏览器。该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

drupal-frontend 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

drupal-frontend 用的人多吗?

公开数据是累计安装 2,101 次,近一周安装 85 次,下载 660 次,GitHub 19 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

drupal-frontend 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
drupal-frontend

Drupal 前端 · 本页

2,10119操作浏览器未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Drupal Front End Development

Overview

Enable expert-level Drupal front end development capabilities. Provide comprehensive guidance for theme development, Twig templating, preprocessing, responsive design, and asset management for Drupal 8, 9, 10, and 11+.

When to Use This Skill

Invoke this skill when working with:

  • Theme development: Creating or customizing Drupal themes
  • Twig templates: Writing or modifying.twig template files
  • Preprocessing: Implementing preprocess functions for templates
  • Template suggestions: Adding custom template naming patterns
  • CSS/JS libraries: Managing theme assets and dependencies
  • Responsive design: Implementing breakpoints and mobile-first design
  • Rendering system: Understanding Drupal's rendering pipeline
  • Theme hooks: Implementing theme-related hooks and alterations

Core Capabilities

1. Theme Development

Build complete, standards-compliant Drupal themes with proper structure:

Quick start workflow:

  1. Use theme template from assets/theme-template/ as starting point
  2. Replace THEMENAME with your theme's machine name
  3. Replace THEMELABEL with human-readable name
  4. Customize templates, CSS, JS, and libraries
  5. Enable theme and configure via Appearance UI

Theme components:

  • .info.yml - Theme metadata and configuration
  • .libraries.yml - CSS/JS library definitions
  • .theme - Preprocess functions and theme logic
  • .breakpoints.yml - Responsive breakpoints
  • templates/ - Twig template files
  • css/ - Stylesheets
  • js/ - JavaScript files

Reference documentation:

  • references/theming.md - Complete theming guide with examples

2. Twig Template System

Master Twig syntax and Drupal-specific extensions:

Twig fundamentals:

  • {{variable}} - Print variables
  • {% if/for/set %} - Control structures and logic
  • {# comment #} - Comments and documentation
  • {{var|filter}} - Apply filters to variables
  • {% extends %} - Template inheritance
  • {% block %} - Define overridable sections

Drupal-specific Twig:

  • {{'Text'|t}} - Translate strings
  • {{attach_library('theme/library')}} - Load CSS/JS
  • {{url('route.name')}} - Generate URLs
  • {{path('route.name')}} - Generate paths
  • {{file_url('public://image.jpg')}} - File URLs
  • {{content|without('field')}} - Exclude fields

Common templates:

  • page.html.twig - Page layout structure
  • node.html.twig - Node display
  • block.html.twig - Block rendering
  • field.html.twig - Field output
  • views-view.html.twig - Views output

3. Preprocessing Functions

Modify template variables before rendering:

Preprocess pattern:

function THEMENAME_preprocess_HOOK(&$variables) {
  // Add or modify variables
  // Access entities, services, configuration
  // Prepare data for templates
}

Common preprocess hooks:

  • hook_preprocess_page() - Page-level variables
  • hook_preprocess_node() - Node-specific data
  • hook_preprocess_block() - Block modifications
  • hook_preprocess_field() - Field alterations
  • hook_preprocess_html() - HTML document

Best practices:

  • Keep logic in preprocess, markup in templates
  • Use dependency injection when possible
  • Cache properly with cache contexts/tags
  • Document complex preprocessing

4. Template Suggestions

Provide specific templates for different contexts:

Suggestion patterns:

page--front.html.twig                  # Homepage
page--node--{nid}.html.twig            # Specific node
page--node--{type}.html.twig           # Content type
node--{type}--{viewmode}.html.twig     # Type + view mode
block--{plugin-id}.html.twig           # Specific block
field--{entity}--{field}.html.twig     # Specific field

Adding suggestions:

function THEMENAME_theme_suggestions_HOOK_alter(array &$suggestions, array $variables) {
  // Add custom suggestions
  $suggestions[] = 'custom__suggestion';
}

5. CSS & JavaScript Management

Organize and load theme assets efficiently:

Library definition:

# THEMENAME.libraries.yml
global-styling:
  version: 1.0
  css:
    base:
      css/base/reset.css: {}
    theme:
      css/theme/styles.css: {}
  js:
    js/custom.js: {}
  dependencies:
    - core/drupal

Loading libraries:

  • Global: Define in .info.yml
  • Conditional: Use attach_library() in templates
  • Preprocessed: Attach in preprocess functions

Best practices:

  • Separate CSS into layers (base, layout, component, theme)
  • Use CSS aggregation in production
  • Minimize JavaScript dependencies
  • Leverage Drupal's asset library system

6. Responsive Design

Implement mobile-first, accessible designs:

Breakpoints definition:

# THEMENAME.breakpoints.yml
THEMENAME.mobile:
  label: Mobile
  mediaQuery: 'screen and (min-width: 0px)'
  weight: 0

THEMENAME.tablet:
  label: Tablet
  mediaQuery: 'screen and (min-width: 768px)'
  weight: 1

THEMENAME.desktop:
  label: Desktop
  mediaQuery: 'screen and (min-width: 1024px)'
  weight: 2

Mobile-first approach:

  1. Design for smallest screens first
  2. Enhance for larger viewports
  3. Use responsive images
  4. Test across devices
  5. Follow accessibility standards (WCAG)

Development Workflow

Creating a New Theme

  1. Scaffold the theme: cp -r assets/theme-template/ /path/to/drupal/themes/custom/mytheme/ cd /path/to/drupal/themes/custom/mytheme/ # Rename files mv THEMENAME.info.yml mytheme.info.yml mv THEMENAME.libraries.yml mytheme.libraries.yml mv THEMENAME.theme mytheme.theme
  2. Update theme configuration:

- Edit mytheme.info.yml - Set name, regions, base theme - Edit mytheme.libraries.yml - Define CSS/JS libraries - Replace THEMENAME with your machine name - Replace THEMELABEL with your label

  1. Enable the theme: ddev drush cr # Enable via UI at /admin/appearance or: ddev drush config:set system.theme default mytheme -y
  2. Enable Twig debugging:

- Copy sites/default/default.services.yml to sites/default/services.yml - Set twig.config.debug: true - Set twig.config.auto_reload: true - Set twig.config.cache: false - Run ddev drush cr

  1. Develop and iterate:

- Modify templates in templates/ - Update CSS in css/ - Clear cache frequently: ddev drush cr - Check browser console for errors

Standard Development Workflow

  1. Enable development settings (Twig debug, disable CSS/JS aggregation)
  2. Create/modify templates based on suggestions from Twig debug
  3. Implement preprocessing in .theme file for complex data manipulation
  4. Add CSS/JS via libraries system
  5. Test across browsers and devices
  6. Clear cache after changes: ddev drush cr

Finding Template Names

With Twig debugging enabled, inspect HTML source:

<!-- FILE NAME SUGGESTIONS:
   * page--node--123.html.twig
   * page--node--article.html.twig
   * page--node.html.twig
   x page.html.twig
-->

The x indicates the active template. Others are suggestions you can create.

Common Patterns

Adding Custom Variables in Preprocess

function mytheme_preprocess_page(&$variables) {
  // Add site slogan
  $variables['site_slogan'] = \Drupal::config('system.site')->get('slogan');

  // Add current user
  $variables['is_logged_in'] = \Drupal::currentUser()->isAuthenticated();

  // Add custom class
  $variables['attributes']['class'][] = 'custom-page-class';
}

Template Inheritance

{# templates/page--article.html.twig #}
{% extends "page.html.twig" %}

{% block content %}
  <div class="article-wrapper">
    {{ parent() }}
  </div>
{% endblock %}

Conditional Library Loading

function mytheme_preprocess_node(&$variables) {
  if ($variables['node']->bundle() == 'article') {
    $variables['#attached']['library'][] = 'mytheme/article-styles';
  }
}

Accessing Field Values in Twig

{# Get field value #}
{{ node.field_custom.value }}

{# Check if field has value #}
{% if node.field_image|render %}
  {{ content.field_image }}
{% endif %}

{# Loop through multi-value field #}
{% for item in node.field_tags %}
  {{ item.entity.label }}
{% endfor %}

Best Practices

Theme Development

  1. Base theme: Choose appropriate base (Olivero, Claro, or none)
  2. Structure: Organize CSS logically (base, layout, components, theme)
  3. Naming: Use BEM or similar CSS methodology
  4. Comments: Document complex Twig logic and preprocessing
  5. Performance: Optimize images, minimize CSS/JS, lazy load when possible

Twig Templates

  1. Logic: Keep complex logic in preprocess, not templates
  2. Filters: Use appropriate filters (|t, |clean_class, |safe_join)
  3. Whitespace: Use {% spaceless %} to control output
  4. Debugging: Enable Twig debugging during development only
  5. Suggestions: Use specific templates only when needed

Preprocessing

  1. Services: Use dependency injection in theme service subscribers
  2. Caching: Add proper cache contexts and tags
  3. Performance: Avoid heavy operations in frequently-called preprocessors
  4. Organization: Group related preprocessing logically

CSS & JavaScript

  1. Libraries: Group related assets into logical libraries
  2. Dependencies: Declare all library dependencies
  3. Loading: Load globally only when necessary
  4. Aggregation: Enable in production for performance

Accessibility

  1. Semantic HTML: Use proper elements (header, nav, main, etc.)
  2. ARIA: Add labels and roles when needed
  3. Keyboard: Ensure keyboard navigation works
  4. Contrast: Meet WCAG color contrast requirements
  5. Alt text: Provide for all images

Responsive Design

  1. Mobile-first: Design for small screens, enhance for large
  2. Breakpoints: Define logical breakpoints
  3. Images: Use responsive image styles
  4. Testing: Test across devices and screen sizes
  5. Performance: Optimize for mobile networks

Troubleshooting

Template Changes Not Showing

  • Clear cache: ddev drush cr
  • Verify file location and naming
  • Check Twig debug for active template
  • Ensure library is properly defined

CSS/JS Not Loading

  • Check library definition in .libraries.yml
  • Verify file paths are correct
  • Ensure library is attached (globally or conditionally)
  • Clear cache and check browser console

Variables Not Available in Template

  • Check preprocess function naming
  • Verify variables are being set correctly
  • Use Twig debugging: {{dump()}}
  • Clear cache after preprocessing changes

Twig Debugging Not Working

  • Verify sites/default/services.yml exists
  • Check twig.config.debug: true is set
  • Clear cache: ddev drush cr
  • Check file permissions

Resources

Reference Documentation

  • references/theming.md - Comprehensive theming guide

- Twig syntax and filters - Template suggestions - Preprocessing patterns - Library management - Responsive design - Best practices

Asset Templates

  • assets/theme-template/ - Complete theme scaffold

- .info.yml with regions and configuration - .libraries.yml with CSS/JS examples - .theme with preprocess examples - Page template - CSS and JS starter files

Searching References

# Find specific Twig filter
grep -r "clean_class" references/

# Find preprocessing examples
grep -r "preprocess_node" references/

# Find library patterns
grep -r "libraries.yml" references/

Version Compatibility

Drupal 8 vs 9 vs 10 vs 11

  • Twig syntax: Consistent across all versions
  • Base themes: Some legacy themes removed in 10+
  • Libraries: Same structure across versions
  • jQuery: Drupal 9+ doesn't load jQuery by default
  • Claro: Admin theme standard in 9+
  • Olivero: Frontend theme standard in 10+

Migration Notes

  • When upgrading, check for deprecated base themes
  • Review jQuery dependencies
  • Test with current Twig version
  • Check for removed core templates

See Also

平台分布

Codex

35.04%
按下载量换算231

Claude

32.48%
按下载量换算214

Cursor

19.1%
按下载量换算126

Gemini CLI

9.32%
按下载量换算62

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

操作浏览器

该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills