/flavian:block-pattern-creationfrom Flavian
Creates and registers WordPress block patterns in PHP or block.json, with categories, keywords, and InnerBlocks for reusable sections like heroes and CTAs.
Ships in Flavian. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Block patterns are pre-configured arrangements of blocks that users can insert as a starting point. Patterns enable rapid page building while maintaining design consistency and best practices.
Core Principle: Patterns are registered code (PHP or block.json), composed of block markup, with metadata for discovery. They must be accessible, flexible through InnerBlocks, and use theme.json tokens.
Use this skill when:
Symptoms that trigger this skill:
When NOT to use:
File: patterns/hero.php
<?php
/**
* Title: Hero Section
* Slug: mytheme/hero
* Categories: featured
* Keywords: hero, banner, header, call to action
* Description: A prominent hero section with heading, description, and call-to-action button.
* Viewport Width: 1200
*/
?>
<!-- wp:cover {"url":"<?php echo esc_url( get_template_directory_uri() ); ?>/assets/images/hero-bg.jpg","dimRatio":50,"overlayColor":"primary","align":"full"} -->
<div class="wp-block-cover alignfull">
<span aria-hidden="true" class="wp-block-cover__background has-primary-background-color has-background-dim"></span>
<img class="wp-block-cover__image-background" alt="" src="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/images/hero-bg.jpg" data-object-fit="cover"/>
<div class="wp-block-cover__inner-container">
<!-- wp:group {"layout":{"type":"constrained","contentSize":"800px"}} -->
<div class="wp-block-group">
<!-- wp:heading {"textAlign":"center","level":1,"fontSize":"x-large"} -->
<h1 class="has-text-align-center has-x-large-font-size">Welcome to Our Site</h1>
<!-- /wp:heading -->
<!-- wp:paragraph {"align":"center"} -->
<p class="has-text-align-center">Discover amazing content and transform your digital presence with our innovative solutions.</p>
<!-- /wp:paragraph -->
<!-- wp:buttons {"layout":{"type":"flex","justifyContent":"center"}} -->
<div class="wp-block-buttons">
<!-- wp:button {"backgroundColor":"secondary"} -->
<div class="wp-block-button">
<a class="wp-block-button__link has-secondary-background-color has-background wp-element-button">Get Started</a>
</div>
<!-- /wp:button -->
</div>
<!-- /wp:buttons -->
</div>
<!-- /wp:group -->
</div>
</div>
<!-- /wp:cover -->
File: functions.php
<?php
/**
* Register block patterns
*/
function mytheme_register_patterns() {
// Auto-register patterns from patterns/ directory
// WordPress 6.0+ automatically loads PHP files from patterns/ directory
// No additional code needed for basic registration
// Optional: Register pattern categories
register_block_pattern_category(
'mytheme-featured',
array(
'label' => __( 'Featured', 'mytheme' ),
'description' => __( 'Featured content patterns', 'mytheme' ),
)
);
}
add_action( 'init', 'mytheme_register_patterns' );
For more control over registration:
<?php
function mytheme_register_hero_pattern() {
register_block_pattern(
'mytheme/hero',
array(
'title' => __( 'Hero Section', 'mytheme' ),
'description' => __( 'A prominent hero section with heading and CTA.', 'mytheme' ),
'categories' => array( 'featured', 'call-to-action' ),
'keywords' => array( 'hero', 'banner', 'header', 'cta' ),
'viewportWidth' => 1200,
'content' => '<!-- Pattern markup here -->',
)
);
}
add_action( 'init', 'mytheme_register_hero_pattern' );
?>
File: patterns/hero/block.json
{
"name": "myplugin/hero",
"title": "Hero Section",
"description": "A prominent hero section with heading and CTA.",
"categories": ["featured"],
"keywords": ["hero", "banner", "header"],
"viewportWidth": 1200,
"content": "<!-- Pattern markup in separate file -->"
}
| Field | Required | Purpose | Example |
|---|---|---|---|
| Title | Yes | Display name in inserter | Hero Section |
| Slug | Yes | Unique identifier | mytheme/hero |
| Categories | No | Organize in inserter | featured, call-to-action |
| Keywords | No | Search terms | hero, banner, cta |
| Description | No | Explains purpose | A prominent hero section... |
| Viewport Width | No | Preview width | 1200 |
| Block Types | No | Suggest for specific blocks | core/post-content |
| Inserter | No | Show/hide in inserter | true (default) |
| Post Types | No | Limit to post types | page, post |
| Category | Use For |
|---|---|
featured | Hero sections, prominent content |
call-to-action | CTA buttons, conversion-focused sections |
text | Text-heavy layouts, article sections |
columns | Multi-column layouts |
gallery | Image galleries, portfolios |
header | Header sections |
footer | Footer sections |
query | Post query loops |
testimonials | Customer testimonials, reviews |
Allows users to customize content:
<?php
/**
* Title: Flexible Hero Section
* Slug: mytheme/hero-flexible
* Categories: featured
* Keywords: hero, customizable, flexible
*/
?>
<!-- wp:cover {"dimRatio":50,"overlayColor":"primary","align":"full","className":"hero-pattern"} -->
<div class="wp-block-cover alignfull hero-pattern">
<span aria-hidden="true" class="wp-block-cover__background has-primary-background-color has-background-dim"></span>
<div class="wp-block-cover__inner-container">
<!-- wp:group {"layout":{"type":"constrained","contentSize":"800px"}} -->
<div class="wp-block-group">
<!-- wp:heading {"textAlign":"center","level":1,"placeholder":"Add your heading..."} -->
<h1 class="has-text-align-center">Your Heading Here</h1>
<!-- /wp:heading -->
<!-- wp:paragraph {"align":"center","placeholder":"Add your description..."} -->
<p class="has-text-align-center">Add your description here.</p>
<!-- /wp:paragraph -->
<!-- wp:buttons {"layout":{"type":"flex","justifyContent":"center"}} -->
<div class="wp-block-buttons">
<!-- wp:button -->
<div class="wp-block-button">
<a class="wp-block-button__link wp-element-button">Button Text</a>
</div>
<!-- /wp:button -->
</div>
<!-- /wp:buttons -->
</div>
<!-- /wp:group -->
</div>
</div>
<!-- /wp:cover -->
<?php
/**
* Title: Two Column Features
* Slug: mytheme/features-two-column
* Categories: columns, featured
* Keywords: features, columns, benefits
*/
?>
<!-- wp:group {"align":"full","style":{"spacing":{"padding":{"top":"var(--wp--preset--spacing--large)","bottom":"var(--wp--preset--spacing--large)"}}},"backgroundColor":"background"} -->
<div class="wp-block-group alignfull has-background-background-color has-background" style="padding-top:var(--wp--preset--spacing--large);padding-bottom:var(--wp--preset--spacing--large)">
<!-- wp:heading {"textAlign":"center","level":2} -->
<h2 class="has-text-align-center">Our Features</h2>
<!-- /wp:heading -->
<!-- wp:columns {"align":"wide"} -->
<div class="wp-block-columns alignwide">
<!-- wp:column -->
<div class="wp-block-column">
<!-- wp:image {"sizeSlug":"large","linkDestination":"none"} -->
<figure class="wp-block-image size-large">
<img src="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/images/feature-1.jpg" alt=""/>
</figure>
<!-- /wp:image -->
<!-- wp:heading {"level":3} -->
<h3>Feature One</h3>
<!-- /wp:heading -->
<!-- wp:paragraph -->
<p>Description of your first amazing feature goes here.</p>
<!-- /wp:paragraph -->
</div>
<!-- /wp:column -->
<!-- wp:column -->
<div class="wp-block-column">
<!-- wp:image {"sizeSlug":"large","linkDestination":"none"} -->
<figure class="wp-block-image size-large">
<img src="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/images/feature-2.jpg" alt=""/>
</figure>
<!-- /wp:image -->
<!-- wp:heading {"level":3} -->
<h3>Feature Two</h3>
<!-- /wp:heading -->
<!-- wp:paragraph -->
<p>Description of your second amazing feature goes here.</p>
<!-- /wp:paragraph -->
</div>
<!-- /wp:column -->
</div>
<!-- /wp:columns -->
</div>
<!-- /wp:group -->
<?php
/**
* Title: Testimonial Quote
* Slug: mytheme/testimonial
* Categories: testimonials, text
* Keywords: testimonial, quote, review
*/
?>
<!-- wp:group {"style":{"spacing":{"padding":{"top":"var(--wp--preset--spacing--medium)","bottom":"var(--wp--preset--spacing--medium)","left":"var(--wp--preset--spacing--medium)","right":"var(--wp--preset--spacing--medium)"}},"border":{"left":{"color":"var(--wp--preset--color--primary)","width":"4px"}}},"backgroundColor":"background"} -->
<div class="wp-block-group has-background-background-color has-background" style="border-left-color:var(--wp--preset--color--primary);border-left-width:4px;padding-top:var(--wp--preset--spacing--medium);padding-right:var(--wp--preset--spacing--medium);padding-bottom:var(--wp--preset--spacing--medium);padding-left:var(--wp--preset--spacing--medium)">
<!-- wp:quote {"className":"is-style-plain"} -->
<blockquote class="wp-block-quote is-style-plain">
<!-- wp:paragraph {"fontSize":"large"} -->
<p class="has-large-font-size">"This product completely transformed how we work. Highly recommended!"</p>
<!-- /wp:paragraph -->
<cite>Jane Doe, CEO of Example Corp</cite>
</blockquote>
<!-- /wp:quote -->
</div>
<!-- /wp:group -->
<?php
/**
* Title: Call to Action
* Slug: mytheme/cta
* Categories: call-to-action
* Keywords: cta, call to action, conversion, button
*/
?>
<!-- wp:group {"align":"full","style":{"spacing":{"padding":{"top":"var(--wp--preset--spacing--large)","bottom":"var(--wp--preset--spacing--large)"}}},"backgroundColor":"primary","textColor":"background"} -->
<div class="wp-block-group alignfull has-background-color has-primary-background-color has-text-color has-background" style="padding-top:var(--wp--preset--spacing--large);padding-bottom:var(--wp--preset--spacing--large)">
<!-- wp:group {"layout":{"type":"constrained","contentSize":"600px"}} -->
<div class="wp-block-group">
<!-- wp:heading {"textAlign":"center","level":2,"textColor":"background"} -->
<h2 class="has-text-align-center has-background-color has-text-color">Ready to Get Started?</h2>
<!-- /wp:heading -->
<!-- wp:paragraph {"align":"center","textColor":"background"} -->
<p class="has-text-align-center has-background-color has-text-color">Join thousands of satisfied customers today.</p>
<!-- /wp:paragraph -->
<!-- wp:buttons {"layout":{"type":"flex","justifyContent":"center"}} -->
<div class="wp-block-buttons">
<!-- wp:button {"backgroundColor":"background","textColor":"primary","className":"is-style-fill"} -->
<div class="wp-block-button is-style-fill">
<a class="wp-block-button__link has-primary-color has-background-background-color has-text-color has-background wp-element-button">Start Free Trial</a>
</div>
<!-- /wp:button -->
</div>
<!-- /wp:buttons -->
</div>
<!-- /wp:group -->
</div>
<!-- /wp:group -->
WRONG:
<!-- wp:group {"style":{"spacing":{"padding":"4rem"},"color":{"background":"#0073aa"}}} -->
WHY THIS FAILS:
CORRECT:
<!-- wp:group {"style":{"spacing":{"padding":"var(--wp--preset--spacing--large)"}},"backgroundColor":"primary"} -->
WRONG:
<!-- wp:image -->
<figure class="wp-block-image">
<img src="image.jpg"/>
</figure>
<!-- /wp:image -->
WHY THIS FAILS:
CORRECT:
<!-- wp:image {"alt":"Person using laptop at modern workspace"} -->
<figure class="wp-block-image">
<img src="image.jpg" alt="Person using laptop at modern workspace"/>
</figure>
<!-- /wp:image -->
WRONG:
<!-- wp:heading -->
<h1></h1>
<!-- /wp:heading -->
WHY THIS FAILS:
CORRECT:
<!-- wp:heading {"placeholder":"Add your heading..."} -->
<h1>Your Heading Here</h1>
<!-- /wp:heading -->
WRONG: Creating patterns with all content hardcoded and no way to customize.
WHY THIS FAILS:
CORRECT: Use placeholder text, allow block customization, provide clear structure that's easy to modify.
WRONG: Categorizing a hero section as "text" category.
WHY THIS FAILS:
CORRECT: Use appropriate categories:
featured or headercall-to-actiontestimonialsWRONG:
/**
* Title: Hero Section
* Slug: mytheme/hero
*/
WHY THIS FAILS:
CORRECT:
/**
* Title: Hero Section
* Slug: mytheme/hero
* Keywords: hero, banner, header, call to action, cta, featured
*/
WRONG: Creating pattern without testing in block editor.
WHY THIS FAILS:
CORRECT: Test pattern insertion in:
| Rationalization | Reality | Correct Action |
|---|---|---|
| "Users will customize the hex codes" | Most users don't edit markup | Use theme.json color tokens |
| "Alt text is optional" | Screen readers need it, WCAG requires it | Add meaningful alt text |
| "Categories don't matter" | Users rely on categories to find patterns | Use appropriate categories |
| "Keywords are just for search" | Search is how users discover patterns | Add comprehensive keywords |
| "Testing takes too long" | Broken patterns waste user time | Test before registering |
| "Hardcoding is simpler" | Bypasses design system | Use CSS variables |
| "This pattern is obvious" | Users need placeholders | Add placeholder text |
NEVER skip these requirements:
theme-name/
└── patterns/
├── hero.php
├── hero-video.php
├── features-two-column.php
├── features-three-column.php
├── testimonial.php
├── testimonial-grid.php
├── cta.php
├── cta-boxed.php
├── gallery-masonry.php
└── footer-newsletter.php
component-variation.php (e.g., hero-video.php)themename/component-variation (e.g., mytheme/hero-video)This skill works with:
Complements:
Before registering a pattern:
Skill Version: 1.0.0 Last Updated: 2026-01-18 Tested Against: WordPress 6.7+ Testing Methodology: RED-GREEN-REFACTOR (TDD for documentation)
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
wordpress, block-patterns, gutenberg, innerblocks, theme-development
16 skills in this plugin
/canva-to-fse-autonomous-workflowUse when converting Canva HTML/CSS exports to WordPress FSE block themes. Orchestrates autonomous workflow from CSS token extraction through template generation. Keywords: Canva to WordPress, FSE conversion, HTML export, CSS design tokens, autonomous template generation/create-blog-articleCreate an SEO-optimized blog article for a Claude Code component with AI-generated cover image/figma-to-fse-autonomous-workflowUse when converting Figma designs to WordPress FSE block themes. Orchestrates autonomous workflow from design token extraction through pixel-perfect template generation. Keywords: Figma to WordPress, FSE conversion, design tokens, autonomous template generation, pixel-perfect FSE/fse-block-theme-developmentUse when creating FSE block themes, working with theme.json, creating templates or template parts, or building block patterns. Keywords: FSE, Full Site Editing, block theme, theme.json, templates, patterns, WordPress theme development/fse-pattern-first-architectureEnforces pattern-first architecture for WordPress FSE themes - use PHP patterns for images, not inline HTML. Auto-triggered when creating FSE templates with images./indesign-conversionUse when converting an Adobe InDesign document (.idml or PDF) into a WordPress FSE block theme. Covers prerequisites, the parse → map-tokens → generate pipeline, expected outputs, and gotchas (CMYK→sRGB shifts, missing fonts, oversized print images). Keywords: InDesign to WordPress, IDML, IDML to FSE, InDesign PDF, print to web, design tokens from InDesignnpx claudepluginhub pmdevsolutions/flavian --plugin flavianOther plugins' skills for the same job