wordpress-performance

A set of practices for making WordPress sites and plugins use fewer resources and respond faster. It covers database queries, caching, metadata loading, and when WordPress work should run.

In plain words
What is it for?
Use it to optimize WordPress queries, audit plugin performance, inspect autoloaded options, profile hooks, add caching, or investigate slow pages.
Why use it?
It helps prevent slow pages, excessive database work, and memory problems caused by unlimited queries, repeated lookups, or work performed on every request.

Skill for Claude CodeCodex

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/iwritec0de/wp-dev/wordpress-performance
Any agent
npx skills add iwritec0de/wp-dev --skill wordpress-performance
Clone the repo
git clone --depth 1 https://github.com/iwritec0de/wp-dev

Made for: Claude Code, Codex.

Per session 134 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,353 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 $0.00134 $0.02353
Opus 5 $0.00067 $0.01177
Sonnet 5 $0.00027 $0.00471
Haiku 4.5 $0.00013 $0.00235

Measured yesterday against content hash 79aeeed55047, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

wordpress-performance 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 yesterday.

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/wordpress-performance/SKILL.md · 253 lines

How it starts

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

WordPress Performance

Performance optimization patterns for WordPress plugins, themes, and live sites.

Critical Rules

  1. Never query without limitsposts_per_page => -1 and unbounded $wpdb queries are the most common cause of memory exhaustion on production sites.
  2. Cache expensive queries — any query that runs on every page load and doesn't change per-request must be cached with transients or the object cache.
  3. Use no_found_rows — set 'no_found_rows' => true on any WP_Query that doesn't need pagination; this skips SQL_CALC_FOUND_ROWS which is expensive on large tables.
  4. Avoid meta queries on unindexed keysmeta_query on wp_postmeta performs full table scans unless you add custom indexes. Consider a custom table for heavily queried data.
  5. Defer heavy work — operations on init run on every request. Use admin_init for admin-only work, rest_api_init for REST-only, and wp_loaded or later hooks when possible.
  6. Prime caches, don't loop-query — use update_post_meta_cache(), update_post_caches(), or _prime_post_caches() to batch-load metadata instead of calling get_post_meta() in a loop.

Query Performance Patterns

Efficient WP_Query

// Good — limited, cache-friendly, no unnecessary data:
$query = new WP_Query( [
    'post_type'              => 'product',
    'posts_per_page'         => 20,
    'no_found_rows'          => true,   // Skip pagination count query.
    'update_post_meta_cache' => false,  // Skip if not reading meta.
    'update_post_term_cache' => false,  // Skip if not reading terms.
    'fields'                 => 'ids',  // Return only IDs when full objects aren't needed.
] );

// Bad — unbounded, forces full table scan:
$query = new WP_Query( [
    'post_type'      => 'product',
    'posts_per_page' => -1,  // Never do this.
] );

N+1 Query Prevention

// Bad — N+1 pattern (1 query per post in the loop):
foreach ( $posts as $post ) {
    $price = get_post_meta( $post->ID, '_price', true );  // Query per iteration.
}

// Good — prime the cache first, then loop reads from cache:
$post_ids = wp_list_pluck( $posts, 'ID' );
update_meta_cache( 'post', $post_ids );  // Single query loads all meta.

foreach ( $posts as $post ) {
    $price = get_post_meta( $post->ID, '_price', true );  // Reads from cache.
}

Read the full file on GitHub · 253 lines

Files

What ships with it

2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. yesterday First seen · 253 lines · 134 tokens per session scan A 79aeeed55047

Subscribe to this mod's changes

wordpress-performance is a skill published in the GitHub repository iwritec0de/wp-dev (1 stars, last pushed 4mo ago), licensed MIT. It adds 134 tokens to every session and 2,353 once invoked, about $0.0007 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

systematic-debugging

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.

obra/superpowers · 21 tokens

next-cache-components-adoption

Turn on Cache Components in a Next.js app and resolve the blocking routes it surfaces. Use when the user wants to enable, adopt, or migrate to Cache Components, flip the cacheComponents flag, work through a flood of blocking-prerender / instant validation errors, run the cache-components-instant-false codemod, or…

vercel/next.js · 95 tokens

babysit-pr

Babysit a GitHub pull request after creation by continuously polling review comments, CI checks/workflow runs, and mergeability state until the PR is merged/closed or user help is required. Diagnose failures, retry likely flaky failures up to 3 times, auto-fix/push branch-related issues when appropriate, and keep…

openai/codex · 114 tokens

imagegen

Generate or edit raster images when the task benefits from AI-created bitmap visuals such as photos, illustrations, textures, sprites, mockups, or transparent-background cutouts. Use when Codex should create a brand-new image, transform an existing image, or derive visual variants from references, and the output…

openai/codex · 113 tokens

cpu-profile-analysis

Analyze V8/Chrome CPU profiles (.cpuprofile) and DevTools trace files (Trace-.json). Use when: profiling performance, investigating slow functions, comparing code paths, finding bottlenecks, analyzing timeToRequest, understanding call trees from sampling profiler data, analyzing layout/paint/rendering, investigating…

microsoft/vscode · 71 tokens

next-cache-components-optimizer

Drive a Next.js route to instant navigation by setting up an agentic loop, under Cache Components / PPR, on initial load (hard navigation) and client-side navigation (soft navigation). Encode the goal as a failing @next/playwright instant() e2e and work it to green, one verified route at a time; the shipped test then…

vercel/next.js · 170 tokens