Wp Patterns
WordPressOfficialPublished by WordPress
- Skill
- Tool integration
- Software development
- GPL-2.0-or-later
- No issues found
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
The wp-patterns skill provides a structured procedure for developers to build, update, and verify WordPress block patterns. It focuses on using native block markup, theme.json presets, and proper registration techniques to ensure patterns integrate correctly with WordPress themes and plugins. The skill includes design and technical checklists to maintain consistency and accessibility, and provides guidance on testing patterns within local WordPress environments.
What it does
- Generates block markup for WordPress patterns including sections, templates, and Query Loops.
- Validates pattern registration, block nesting, and metadata against WordPress standards.
- Enforces the use of theme.json presets for colors, typography, and spacing.
- Provides checklists for design quality and technical implementation.
- Offers guidance on testing patterns using WordPress Playground or local environments.
- Ensures proper internationalization and escaping for pattern text.
When to use it
- When creating new starter pages, templates, or reusable block patterns for a WordPress theme.
- When updating existing pattern files to ensure they remain compatible with current block markup standards.
- When verifying that a pattern correctly registers in the WordPress inserter.
- When auditing patterns for accessibility, correct heading hierarchy, and proper asset handling.
Advantages
- Promotes consistent design through the use of theme-defined presets.
- Reduces errors by enforcing valid block comment syntax and nesting rules.
- Ensures patterns are accessible and follow WordPress best practices for i18n.
- Provides a clear workflow from design planning to technical validation.
Usage examples
- “Create a new hero pattern for my theme using a dark background and a centered layout.”
- The agent will guide you through defining the design hierarchy, sketching the block structure, and generating the valid block markup using theme presets.
- “Review my existing pattern file for accessibility and technical errors.”
- The agent will audit the markup against the provided design and technical checklists, identifying issues like skipped headings or missing escaping.
Install
Download the skill as a ZIP:
https://autogineer.com/agent-skills/wordpress/wp-patterns/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip wp-patterns.zip -d .agents/skills
Documentation by WordPress
WordPress Block Patterns
Inputs required
Repo root and target theme/plugin directory.
Pattern type: section, starter page, template, template part, or manually registered plugin pattern.
Theme/plugin slug, pattern slug, and text domain.
Pattern title, categories, keywords, block types, template types, and inserter visibility.
Target WordPress version if it differs from this repo's compatibility contract.
Available
theme.jsonpresets for colors, typography, spacing, layout, and gradients.Asset paths for images/icons, including whether assets are decorative or informational.
Verification environment: WordPress Playground, wp-env, local WordPress, or manual Code Editor check.
If updating an existing pattern: current slug, current file path, and whether existing inserted content must remain compatible.
For child themes: child theme slug, text domain, and asset root; do not reuse the parent namespace unless explicitly intended.
Guardrails
Block markup only — express all visual design through block comment attributes and
presetslugs. No inline<style>tags, no custom CSS classes, no arbitrary HTML outside of block wrappers. Readreferences/design-with-tokens.mdfor the core principle.No JavaScript — patterns are static
block markup. For interactivity, use blocks that natively support it (Navigation, Search, Query Loop).Registration-time PHP — pattern files execute PHP once during registration, not at render. Read
references/pattern-registration.mdfor safe output functions, i18n, and functions to avoid.Valid nesting — read
references/block-markup-reference.mdfor comment syntax and nesting rules.Native blocks for behavior — use Query Loop, Search, Navigation, Social Icons, or an existing form block instead of custom PHP/HTML behavior. For newsletter, donation, payment, or map behavior, create a CTA/placeholder or use an existing block/plugin.
Local assets — use
get_theme_file_uri()withesc_url(); no external placeholder URLs unless the user approves. Readreferences/pattern-registration.mdandreferences/anti-patterns.mdfor examples.
Procedure
0) Triage and locate the pattern target
Run triage when working in a repository:
node skills/wp-project-triage/scripts/detect_wp_project.mjs
For block themes, locate the target theme root:
node skills/wp-block-themes/scripts/detect_block_themes.mjs
Confirm the pattern belongs in a theme
patterns/directory or needs manual plugin registration.If multiple themes/plugins exist, scope all changes to the requested target.
If the user did not provide required inputs, infer only low-risk defaults. Ask before inventing a theme slug, text domain, asset path, custom post type, taxonomy, event date field, or theme-specific preset. If theme.json is missing or presets cannot be verified, use conservative core presets or ask before using theme-specific slugs.
Done when: target theme/plugin root, pattern type, and registration path are confirmed.
1) Design thinking
Make five deliberate design decisions — purpose, tone, spatial composition, typography hierarchy, and color strategy — before writing block markup.
Read references/design-with-tokens.md for the decision framework and preset mapping.
For pattern-type metadata (starter pages, template patterns, template parts, query loops, forms/CTAs, comparison/pricing, social/navigation/search, 404), read references/pattern-categories-and-types.md — including the Query Loop patterns section when using core/query.
When the request calls for a visually distinctive composition, read references/visual-composition.md.
Done when: all five design decisions are made and recorded before markup.
2) Plan block structure
Sketch the nesting tree before writing markup. Example for a hero pattern:
Group (full-width, constrained layout, dark bg, vertical padding 80)
Group (constrained inner, flex vertical, center align)
Paragraph (uppercase label, small, letter-spacing, accent color)
Heading (h2, xx-large, heading font, tight line-height)
Paragraph (lead text, large, secondary color)
Buttons (flex, center)
Button (primary bg, base text)
Button (outline style)Done when: nesting tree is sketched and hierarchy is intentional before writing comment tags.
3) Write the pattern file
Assemble the PHP header and block markup. Read references/pattern-registration.md for header fields, PHP rules, manual registration, and file examples.
Use categories and template types from step 1. Read references/pattern-categories-and-types.md when header metadata was not decided in step 1.
Block markup body:
Follow the nesting tree from step 2
Use
presetslugs for colors, font sizes, spacingUse placeholder text that reflects real content — not "Lorem ipsum"
Done when: PHP header and block markup file are written.
4) Design quality check
Review against the Design Quality Checklist in references/anti-patterns.md. Every item must pass.
Done when: every Design Quality Checklist item passes.
5) Technical validation
Review against the Technical Validation Checklist in references/anti-patterns.md. Every item must pass.
Done when: every Technical Validation Checklist item passes.
Verification
Test the pattern in a real WordPress environment:
Using WordPress Playground (recommended):
npx @wp-playground/cli@latest server --auto-mountMount the theme directory and verify:
Pattern appears in inserter under specified categories
Pattern inserts without block validation errors
Layout renders correctly at desktop and mobile widths
Content is editable (text, images, buttons)
If
templateLockis used, locked elements resist editing
For template patterns, verify the Site Editor offers the pattern in the expected template replacement flow. If Inserter: no is used, confirm it is hidden from the general inserter but still available where intended.
Manual check:
Paste block markup into the Code Editor view in WordPress
Switch to Visual Editor — blocks should parse without "Attempt Block Recovery" prompts
If recovery is needed, the markup has syntax errors
Run the repo's existing lint, build, or test commands if the pattern change touches assets, generated files, or registration code.
When updating an existing pattern, remember that inserted pattern content is copied into posts/templates. Changing the pattern file does not retroactively update already inserted content, and changing block names or saved markup can create recovery prompts for newly inserted content.
For PR or package review, confirm the diff is scoped to the intended pattern files, references, scripts, and eval scenarios. Do not mix unrelated repo updates into a pattern change.
Failure modes / debugging
Start with references/block-markup-reference.md, references/pattern-registration.md, and references/anti-patterns.md.
Common failures:
Pattern missing from inserter: check required
Title,Slug, andCategoriesheaders; confirm the file is underpatterns/*.php; confirmInserter: nois not hiding it.Wrong pattern shown or overwritten: check for slug collisions and ensure the slug is namespaced as
theme-slug/pattern-nameorplugin-slug/pattern-name.Block recovery prompt appears: validate block comment nesting, JSON syntax, and closing comments.
Strings are not translated or escaped: replace raw text/PHP output with
esc_html_e(),esc_html__(),esc_attr_e(),esc_attr__(), oresc_url()as appropriate.Translations do not load: verify the text domain matches the target theme/plugin.
Dynamic content is stale or unavailable: remove query-dependent PHP (
get_posts(),the_title(),wp_get_current_user()) and use blocks such as Query Loop instead.Query Loop output is incomplete: check for
core/post-template, post title/excerpt/date/image blocks, pagination when needed, andcore/query-no-resultsfallback.Archive/search/category/author context is wrong: use inherited query context instead of hardcoded runtime PHP.
CPT or event listings are wrong: confirm post type slugs, taxonomy/date fields, and plugin-provided blocks before generating the pattern.
Styles do not match the theme: confirm
presetslugs exist intheme.json; avoid unsupported theme-specific slugs unless documented.Accessibility issues: fix skipped heading levels, empty alt text for informational images, low-contrast preset combinations, vague button/link text, social icon labels, search labels, and color-only emphasis.
Manual registration fails: confirm the code runs on
init, categories are registered before patterns, and pattern content remains static block markup.
Escalation
Stop and ask for help or consult canonical docs when:
Theme-specific
presetslugs, text domains, asset paths, or pattern categories cannot be verified.Color contrast, image meaning, or content hierarchy needs human design/accessibility judgment.
Behavior depends on a WordPress/Gutenberg version not covered by this repo's compatibility contract.
Example prompts
Read references/example-prompts.md.
Files
- ATTRIBUTION.mdAdded by AutoGineer886 B
- LICENSELicence file added by AutoGineer750 B
- SKILL.md9.6 KiB
- references/anti-patterns.md5.6 KiB
- references/block-markup-reference.md7.0 KiB
- references/design-with-tokens.md8.0 KiB
- references/example-prompts.md1.4 KiB
- references/pattern-categories-and-types.md4.9 KiB
- references/pattern-registration.md4.6 KiB
- references/visual-composition.md1.6 KiB
references/block-markup-reference.md
Block Markup Reference
Comment Syntax
WordPress blocks are serialized as HTML comments with JSON attributes.
<!-- wp:block-name {"attr":"value"} -->
<div class="wp-block-block-name">Inner content</div>
<!-- /wp:block-name -->
<!-- wp:block-name {"attr":"value"} /--> (self-closing, no inner content)Rules:
Opening tag:
<!-- wp:namespace/name {JSON} -->Core blocks omit namespace:
<!-- wp:heading -->(notcore/heading)JSON must be valid — no trailing commas, strings double-quoted
Self-closing blocks (spacer, separator, image with no caption): end with
/-->Every opening comment must have a matching closing comment
Most-Used Blocks in Patterns
Layout Blocks
Group — primary container, supports all layout types:
<!-- wp:group {"layout":{"type":"constrained"}} -->
<div class="wp-block-group">
<!-- inner blocks -->
</div>
<!-- /wp:group -->Layout types:
{"type":"constrained"}— centered with max-width (default for sections){"type":"constrained","contentSize":"800px","wideSize":"1200px"}— custom widths{"type":"flex","flexWrap":"nowrap"}— horizontal row{"type":"flex","orientation":"vertical"}— vertical stack{"type":"grid","columnCount":3}— CSS grid with fixed columns{"type":"grid","minimumColumnWidth":"250px"}— responsive auto-fill grid
Tag name override: {"tagName":"section"}, {"tagName":"header"}, {"tagName":"footer"}
Columns / Column:
<!-- wp:columns -->
<div class="wp-block-columns">
<!-- wp:column {"width":"66.66%"} -->
<div class="wp-block-column" style="flex-basis:66.66%">
<!-- inner blocks -->
</div>
<!-- /wp:column -->
<!-- wp:column {"width":"33.33%"} -->
<div class="wp-block-column" style="flex-basis:33.33%">
<!-- inner blocks -->
</div>
<!-- /wp:column -->
</div>
<!-- /wp:columns -->Content Blocks
Heading:
<!-- wp:heading {"level":2,"fontSize":"x-large"} -->
<h2 class="wp-block-heading has-x-large-font-size">Heading text</h2>
<!-- /wp:heading -->Paragraph:
<!-- wp:paragraph {"fontSize":"medium","textColor":"contrast"} -->
<p class="has-contrast-color has-text-color has-medium-font-size">Body text</p>
<!-- /wp:paragraph -->Image:
<!-- wp:image {"sizeSlug":"full","linkDestination":"none"} -->
<figure class="wp-block-image size-full">
<img src="https://example.com/image.jpg" alt="Descriptive alt text"/>
</figure>
<!-- /wp:image -->Cover:
<!-- wp:cover {"url":"https://example.com/bg.jpg","dimRatio":60,"overlayColor":"contrast","minHeight":500,"minHeightUnit":"px","layout":{"type":"constrained"}} -->
<div class="wp-block-cover" style="min-height:500px">
<span aria-hidden="true" class="wp-block-cover__background has-contrast-background-color has-background-dim-60 has-background-dim"></span>
<img class="wp-block-cover__image-background" alt="" src="https://example.com/bg.jpg" data-object-fit="cover"/>
<div class="wp-block-cover__inner-container">
<!-- inner blocks -->
</div>
</div>
<!-- /wp:cover -->Buttons / Button:
<!-- wp:buttons {"layout":{"type":"flex","justifyContent":"center"}} -->
<div class="wp-block-buttons">
<!-- wp:button {"backgroundColor":"primary","textColor":"base"} -->
<div class="wp-block-button"><a class="wp-block-button__link has-base-color has-primary-background-color has-text-color has-background wp-element-button">Click me</a></div>
<!-- /wp:button -->
<!-- wp:button {"className":"is-style-outline"} -->
<div class="wp-block-button is-style-outline"><a class="wp-block-button__link wp-element-button">Secondary</a></div>
<!-- /wp:button -->
</div>
<!-- /wp:buttons -->Spacer:
<!-- wp:spacer {"height":"var:preset|spacing|50"} -->
<div style="height:var(--wp--preset--spacing--50)" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->Separator:
<!-- wp:separator {"backgroundColor":"contrast","className":"is-style-wide"} -->
<hr class="wp-block-separator has-text-color has-contrast-color has-alpha-channel-opacity has-contrast-background-color has-background is-style-wide"/>
<!-- /wp:separator -->Media & Text:
<!-- wp:media-text {"mediaPosition":"right","mediaType":"image","mediaWidth":40} -->
<div class="wp-block-media-text has-media-on-the-right is-stacked-on-mobile" style="grid-template-columns:auto 40%">
<div class="wp-block-media-text__content">
<!-- inner blocks -->
</div>
<figure class="wp-block-media-text__media">
<img src="https://example.com/image.jpg" alt="Description"/>
</figure>
</div>
<!-- /wp:media-text -->Query Loop (post listing):
<!-- wp:query {"queryId":0,"query":{"perPage":3,"pages":0,"offset":0,"postType":"post","order":"desc","orderBy":"date","inherit":false}} -->
<div class="wp-block-query">
<!-- wp:post-template {"layout":{"type":"grid","columnCount":3}} -->
<!-- wp:post-featured-image {"isLink":true} /-->
<!-- wp:post-title {"isLink":true,"fontSize":"large"} /-->
<!-- wp:post-excerpt {"excerptLength":20} /-->
<!-- /wp:post-template -->
</div>
<!-- /wp:query -->Style Attribute Structure
The style attribute holds custom values (not preset slugs):
{
"style": {
"spacing": {
"padding": {"top":"var:preset|spacing|50","right":"var:preset|spacing|50","bottom":"var:preset|spacing|50","left":"var:preset|spacing|50"},
"margin": {"top":"0","bottom":"0"},
"blockGap": "var:preset|spacing|30"
},
"border": {
"radius": "8px",
"width": "1px",
"color": "var:preset|color|contrast",
"style": "solid"
},
"color": {
"background": "#1a1a2e",
"text": "#ffffff",
"gradient": "linear-gradient(135deg,rgb(6,147,227) 0%,rgb(155,81,224) 100%)"
},
"typography": {
"fontSize": "clamp(1rem, 2vw, 1.5rem)",
"lineHeight": "1.4",
"letterSpacing": "-0.02em"
}
}
}Preset reference syntax in style values: var:preset|{type}|{slug} (not CSS var())
Preset Class Naming Convention
When using preset slugs (not inline style), blocks get CSS classes:
"backgroundColor":"primary"→has-primary-background-color has-background"textColor":"contrast"→has-contrast-color has-text-color"fontSize":"large"→has-large-font-size"fontFamily":"heading"→has-heading-font-family"gradient":"vivid-cyan-blue-to-vivid-purple"→has-vivid-cyan-blue-to-vivid-purple-gradient-background has-background
Block Locking
Prevent users from modifying pattern structure:
{
"lock": {"move": true, "remove": true}
}On container blocks, templateLock constrains children:
"templateLock":"all"— no insert, move, or remove"templateLock":"insert"— no adding/removing, can move"templateLock":"contentOnly"— only text/media editable, structure locked
Block Alignment
Use align attribute for wide/full-width:
{"align":"wide"} <!-- respects wideSize -->
{"align":"full"} <!-- breaks out to viewport edge -->Requirements and compatibility
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Needs: Needs Node.js
The author says: Targets WordPress 7.0+ (PHP 7.4.0+). Filesystem-based agent with bash + node. Some workflows require WP-CLI.
Security
No issues found by our static scan· No issues found
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Published by
- WordPress
- Publisher
- WordPress (Official)
- Source
- WordPress/agent-skills · skills/wp-patterns · commit 7374e6f
- Licence
- GNU General Public License v2.0 or later (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
AutoGineer is not affiliated with or endorsed by WordPress or WordPress.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download wp-patterns.zip