wp-php-architecture

wp-php-architecture is a skill for Claude Code from xonack/wp-php-architecture-claude-skill. It costs 45 tokens per session (5,850 once invoked), scanned A, original, MIT.

A set of design patterns for organising PHP code in WordPress, the content-management system used to build websites.

In plain words
What is it for?
Use it when designing WordPress plugins, themes, custom post types, repositories, service layers, or domain-driven code. It also identifies common design mistakes.
Why use it?
It helps prevent database queries and business rules from becoming scattered and difficult to test or maintain.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the wp-php-architecture-claude-skill plugin — 1 skill shipped together

Good fit Use it when designing WordPress plugins, themes, custom post types, repositories, service layers, or domain-driven code. It also identifies common design mistakes.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/xonack/wp-php-architecture-claude-skill/wp-php-architecture
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add xonack/wp-php-architecture-claude-skill --skill wp-php-architecture
Clone the repo
git clone --depth 1 https://github.com/xonack/wp-php-architecture-claude-skill

Made for: Claude Code.

Or install wp-php-architecture-claude-skill, the plugin that ships this one along with the rest of its 1 skill.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for wp-php-architecture

README.md
[![agentmods](https://agentmods.dev/badge/skills/xonack/wp-php-architecture-claude-skill/wp-php-architecture/github.svg)](https://agentmods.dev/skills/xonack/wp-php-architecture-claude-skill/wp-php-architecture)
Your own site
<a href="https://agentmods.dev/skills/xonack/wp-php-architecture-claude-skill/wp-php-architecture"><img src="https://agentmods.dev/badge/skills/xonack/wp-php-architecture-claude-skill/wp-php-architecture/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for wp-php-architecture

Your own site · 80×15
<a href="https://agentmods.dev/skills/xonack/wp-php-architecture-claude-skill/wp-php-architecture"><img src="https://agentmods.dev/badge/skills/xonack/wp-php-architecture-claude-skill/wp-php-architecture.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 45 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 5,850 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00045 $0.05850
Opus 5.5 $0.00018 $0.02340
Sonnet 5.5 $0.00009 $0.01170
Haiku 4.5 $0.00005 $0.00585

Measured 1mo ago against content hash dc49380447d0, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

wp-php-architecture scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/wp-php-architecture/SKILL.md · 808 lines

How it starts

The opening of the file, as written. The whole thing — 808 lines — stays where its author put it; the contents beside it link to each section on GitHub.

WordPress PHP Architecture Patterns

This skill encodes battle-tested architecture patterns for WordPress PHP development. Every pattern is adapted to WordPress realities: global state, hook-driven execution, no native DI container, and the functions.php bootstrap model. Use these patterns to write WordPress code that is testable, maintainable, and scalable.


1. Repository Pattern for WordPress

Wrap all data access behind repository classes. Never scatter $wpdb calls or raw WP_Query usage across business logic.

Base Repository Interface

interface PostRepositoryInterface {
    public function find_by_id( int $id ): ?object;
    public function find_all( array $criteria = [] ): array;
    public function save( object $entity ): int;
    public function delete( int $id ): bool;
}

WP_Query Repository Implementation

class ProductRepository implements PostRepositoryInterface {
    private string $post_type = 'product';

    public function find_by_id( int $id ): ?Product {
        $post = get_post( $id );
        if ( ! $post || $post->post_type !== $this->post_type ) {
            return null;
        }
        return $this->hydrate( $post );
    }

    public function find_all( array $criteria = [] ): array {
        $defaults = [
            'post_type'      => $this->post_type,
            'posts_per_page' => 20,
            'post_status'    => 'publish',
        ];
        $query = new WP_Query( array_merge( $defaults, $criteria ) );
        return array_map( [ $this, 'hydrate' ], $query->posts );
    }

    public function save( object $entity ): int {
        $args = [
            'post_type'    => $this->post_type,
            'post_title'   => $entity->get_name(),
            'post_content' => $entity->get_description(),
            'post_status'  => 'publish',
        ];
        if ( $entity->get_id() ) {
            $args['ID'] = $entity->get_id();
            wp_update_post( $args );
            $id = $entity->get_id();
        } else {
            $id = wp_insert_post( $args );
        }
        update_post_meta( $id, '_product_price', $entity->get_price()->amount() );
        update_post_meta( $id, '_product_sku', $entity->get_sku() );
        return $id;
    }

    public function delete( int $id ): bool {
        return (bool) wp_delete_post( $id, true );
    }

    private function hydrate( WP_Post $post ): Product {
        return new Product(
            id:          $post->ID,
            name:        $post->post_title,
            description: $post->post_content,
            price:       new Money( (float) get_post_meta( $post->ID, '_product_price', true ) ),
            sku:         (string) get_post_meta( $post->ID, '_product_sku', true ),
        );
    }
}

Read the full file on GitHub · 808 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 808 lines · 45 tokens per session scan A dc49380447d0

Subscribe to this mod's changes

wp-php-architecture is a skill published in the GitHub repository xonack/wp-php-architecture-claude-skill (3 stars, last pushed 8mo ago), licensed MIT. It adds 45 tokens to every session and 5,850 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

craftcms

Craft CMS 5 plugin and module development — extending Craft with PHP. Covers elements, element queries, services, models, records, controllers, migrations, queue jobs, console commands, field types, native fields, events, behaviors, Twig extensions, widgets, filesystems, permissions, project config, GraphQL, testing…

michtio/craftcms-claude-skills · 70 tokens

laravel-13-expert

Comprehensive Laravel 13.x expert skill covering the entire framework — installation, configuration, routing, controllers, middleware, Blade views, Eloquent ORM, migrations, queues, jobs, events, mail, notifications, caching, Redis, scheduling, service container, service providers, authentication, authorization, AI…

Deixtra-Private-Limited/claude-laravel-13-skill · 105 tokens

wp-ux-design

WordPress UX and design enforcement — Core Web Vitals, mobile-first layout, typography, color systems, navigation, page builder patterns, image optimization, form UX, loading and error states, admin UX, and performance checklists with concrete CSS/HTML/PHP examples.

xonack/wp-ux-design-claude-skill · 59 tokens

emlog-app-dev

A development guide for Emlog, a PHP-based blogging and content-management system. It covers building and changing Emlog plugins, themes, templates, and related code.

emlog/emlog-app-dev-skill · 125 tokens

laravel-specialist

Build and configure Laravel 10+ applications, including creating Eloquent models and relationships, implementing Sanctum authentication, configuring Horizon queues, designing RESTful APIs with API resources, and building reactive interfaces with Livewire. Use when creating Laravel models, setting up queue workers…

Jeffallan/claude-skills · 86 tokens

php-pro

Use when building PHP applications with modern PHP 8.3+ features, Laravel, or Symfony frameworks. Invokes strict typing, PHPStan level 9, async patterns with Swoole, and PSR standards. Creates controllers, configures middleware, generates migrations, writes PHPUnit/Pest tests, defines typed DTOs and value objects…

Jeffallan/claude-skills · 107 tokens