Agent SkillsAutomattic/studio › creating-blocks

creating-blocks

GitHub

提供从零开始创建WordPress区块的模板和指南,规范文件生成、命名及交互实现,确保区块正确注册与前后端行为一致。

packages/data-liberation-agent/skills/creating-blocks/SKILL.md Automattic/studio

Trigger Scenarios

创建新的WordPress区块 生成区块相关文件

Install

npx skills add Automattic/studio --skill creating-blocks -g -y
More Options

Non-standard path

npx skills add https://github.com/Automattic/studio/tree/trunk/packages/data-liberation-agent/skills/creating-blocks -g -y

Use without installing

npx skills use Automattic/studio@creating-blocks

指定 Agent (Claude Code)

npx skills add Automattic/studio --skill creating-blocks -a claude-code -g -y

安装 repo 全部 skill

npx skills add Automattic/studio --all -g -y

预览 repo 内 skill

npx skills add Automattic/studio --list

SKILL.md

Frontmatter
{
    "name": "creating-blocks",
    "description": "Templates and guidelines for creating new WordPress blocks from scratch — load this before generating block files",
    "disable-model-invocation": true
}

When to use me

Use this skill when creating a new block from scratch. Do not use this skill when modifying an existing block.

Generating Blocks Instructions

  • Always use the current folder to generate the block
  • Always remove space before the PHP opening tag, nor leave more than one empty new line at the end of any file
  • Always use block props to make sure the block is selectable in the canvas
  • Always use the lowercase for block name slugs
  • Never close the last PHP opening tag, you always leave it open
  • Never suggest or generate code outside the specification, such as REST controllers, PHP classes, or other code that is not part of a standard WordPress block
  • Prefer building blocks that have the same behaviour on the frontend and the backend, unless the user asks for a block that is specifically different on the frontend
  • Do not opt for placeholders in the editor
  • Be proactive in adding inspector or block toolbar controls that can make the block more interactive and customizable
  • Never redeclare functions in PHP and always guard with function_exists
  • Do not create additional markdown files with extense documentations or installation instructions
  • Make sure the block is registered correctly so that it renders on the front end
  • Use the InnerBlocks component from @wordpress/block-editor as much as possible.

Interactive Blocks

When the block requires frontend interactivity (clicks, toggles, accordions, modals, carousels, counters, tabs, search filters):

  • The block MUST also be dynamic (uses render.php, no save.js)
  • Use plain JavaScript with standard DOM APIs (querySelector, addEventListener, classList, etc.) in view.js — never use the WordPress Interactivity API
  • In block.json: use "viewScript": "file:./view.js" (not viewScriptModule)
  • In render.php: use standard HTML attributes and CSS classes that your JavaScript targets
  • Use data-* attributes on the block wrapper to pass server-side values to JavaScript

Reference Files

Before generating block files, read the relevant references from the references/ directory next to this skill file.

  • references/artefact-templates.md — REQUIRED: read this FIRST before generating any block files. Contains exact file templates with correct paths, asset references, and build pipeline details. You MUST follow these templates exactly.
  • references/file-templates.md — additional guidelines for each block file type
  • references/inner-blocks.md — read this if the block uses InnerBlocks or child blocks
  • references/dynamic-vs-static.md — read this if you need to decide between a dynamic, static, or interactive rendering approach
  • references/interactivity-api.md — read this when creating an interactive block that needs frontend JavaScript

Version History

  • 0d55cb5 Current 2026-08-20 12:16

Same Skill Collection

apps/cli/ai/skills/annotate/SKILL.md
apps/cli/ai/skills/block-content/SKILL.md
apps/cli/ai/skills/hosting-plans-helper/SKILL.md
apps/cli/ai/skills/liberate/SKILL.md
apps/cli/ai/skills/need-for-speed/SKILL.md
apps/cli/ai/skills/plugin-recommendations/SKILL.md
apps/cli/ai/skills/rank-me-up/SKILL.md
apps/cli/ai/skills/site-spec/SKILL.md
apps/cli/ai/skills/taxonomist/SKILL.md
apps/cli/ai/skills/visual-design/SKILL.md
apps/cli/ai/skills/visual-polish/SKILL.md
apps/cli/ai/skills/wpcom-remote-management/SKILL.md
packages/data-liberation-agent/skills/adapt/SKILL.md
packages/data-liberation-agent/skills/creating-themes/SKILL.md
packages/data-liberation-agent/skills/design-foundations/SKILL.md
packages/data-liberation-agent/skills/diagnose/SKILL.md
packages/data-liberation-agent/skills/editing-blocks/SKILL.md
packages/data-liberation-agent/skills/editing-themes/SKILL.md
packages/data-liberation-agent/skills/generating-patterns/SKILL.md
packages/data-liberation-agent/skills/migrate/SKILL.md
packages/data-liberation-agent/skills/model-local-data/SKILL.md
packages/data-liberation-agent/skills/qa/SKILL.md
packages/data-liberation-agent/skills/rebuild-section/SKILL.md
packages/data-liberation-agent/skills/testing-js/SKILL.md
packages/data-liberation-agent/skills/testing-php/SKILL.md
packages/data-liberation-agent/skills/testing-wp-runtime/SKILL.md
skills/studio-cli/SKILL.md
packages/data-liberation-agent/skills/compose-page-blocks/SKILL.md
packages/data-liberation-agent/skills/design-qa/SKILL.md
packages/data-liberation-agent/skills/match-page/SKILL.md
packages/data-liberation-agent/skills/match-section/SKILL.md
packages/data-liberation-agent/skills/replicate-theme/SKILL.md
packages/data-liberation-agent/skills/replicate-with-blocks/SKILL.md

Metadata

Files
0
Version
0d55cb5
Hash
74c4491f
Indexed
2026-08-20 12:16

- 위키
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-26 03:13
浙ICP备14020137号-1 $방문자$