wp-php-architecture

wp-php-architecture is a skill for Claude Code, Codex 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 CodeCodex

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

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.

agentmods
npx agentmods add skills/xonack/wp-php-architecture-claude-skill/wp-php-architecture
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, Codex.

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.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.svg" alt="Measured on agentmods" 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. Scan, not verified.
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 $0.00023 $0.02925
Sonnet 5 $0.00009 $0.01170
Haiku 4.5 $0.00005 $0.00585

Measured 5d ago against content hash dc49380447d0, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, 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 5d 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. 5d 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 7mo ago), licensed MIT. It adds 45 tokens to every session and 5,850 once invoked, about $0.0002 per session on Opus 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

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

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 · 327 tokens

craft-php-guidelines

Craft CMS 5 PHP coding standards and conventions. ALWAYS load when writing, editing, reviewing, or discussing any PHP in a Craft plugin or module — even small edits. Also when running ECS, PHPStan, or scaffolding with ddev craft make. Covers: PHPDoc blocks (@author, @since, @throws chains), section headers…

michtio/craftcms-claude-skills · 336 tokens

craft-pest

Testing Craft CMS 5 plugins and modules with Pest — test isolation, database safety, and the markhuot/craft-pest-core harness. ALWAYS load when writing, running, fixing, or reviewing tests for a Craft plugin or module, and whenever a suite touches a real Craft install. Covers why rollback is opt-in, tests/Pest.php +…

michtio/craftcms-claude-skills · 353 tokens

codex-agent-collaboration

Delegate coding tasks to Codex AI for implementation, analysis, and alternative solutions. Use when you need a second AI perspective, want to explore different approaches, or need specialized Codex capabilities for complex coding tasks.

ForteScarlet/codex-kkp · 49 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