Skip to content
wp2next, home
Skip to the page

wp2next optimize

Runs review (performance, accessibility, SEO) and wp2next's own site-structure, redirect and content-model checks, then applies only safe or approved fixes on a branch, proven with Lighthouse before and after.

Your AI tool

Commands are shown for Claude desktop, the recommended tool. Pick another if you use a different one; this browser remembers.

Synopsiswp2next optimize [all | <area> | <skill>] [--report-only] [--override-gate] [--cache-components] (Claude desktop and Claude Code plugin: /wp2next:optimize; Codex: $wp2next optimize; Cursor: /wp2next optimize)
Changes codeYes, on branch wp2next/optimize-<date>, one approved fix per commit. Before parity sign-off it reports only by default
Touches outside servicesHosting changes ([infra] items such as Vercel settings) are listed with their exact setting and cost effect; each is a separate step with its own yes. It asks before pushing, before merging, and before adding Lighthouse tooling to the project
ReadsA local production build, wp2next.json, the migration's URL list and WordPress export, Search Console or analytics CSV exports if you provide them, Vercel production metrics (vercel area)
WritesCommits on the branch, reports in .wp2next/optimize/, Lighthouse runs in .wp2next/lighthouse/, optimize.lastRun and lighthouse.lastRun in wp2next.json, departure entries

What it does

Areas:

AreaUsesLooks at
reactReact best-practice companionsWaterfalls, server/client split, rerenders, component APIs
bundleNext bundle optimizerClient JavaScript on first load, duplicate dependencies, scripts that can wait
cachingVercel caching reviewRevalidate values, webhook coverage, static vs dynamic routes, headers
designWeb design guidelinesAccessibility, focus, forms, images, typography, motion
seoSanity's SEO/AEO skillMetadata, Open Graph, sitemap, robots, JSON-LD. Full WordPress-vs-Next checks belong to seo
vercelVercel optimizeCost and performance from production metrics (needs a deployed site with traffic)
iawp2nextClick depth, orphan, thin and duplicate pages, WordPress leftovers (date/author/attachment archives, tag sprawl, "Uncategorized"), nav vs traffic, slug hygiene
redirectswp2nextChains, loops, temporary redirects, missing old slugs, legacy WordPress URLs (?p=, feeds, uploads), Search Console 404s, trailing-slash and case variants
structurewp2nextRepeated content that should be proper Sanity documents: team, locations, services, testimonials, FAQs, pricing, events, jobs
allEvery area whose companion is installed, plus ia, redirects and structure

A missing is never a blocker: it says how to install it and carries on with the other areas. See Companion skills.

How a run goes:

  1. Checks a clean git tree and a passing lint, typecheck and build; creates the branch.
  2. Baseline on a local : screenshots of every page and a Lighthouse run.
  3. Reviews run on the side, read-only, one per area.
  4. Triage with you: one merged table, sorted by expected gain. Each item is tagged [safe] (nothing visible changes), [visual], [content], [model] (a Sanity model change that renders identically), [infra] (a hosting setting) or [conflict] (breaks a wp2next rule, so rejected). Rejected and deferred items are written down so later runs don't propose them again.
  5. Applies approved items, one per .
  6. Proves it: a screenshot diff against the baseline (must pass for [safe] items; any difference must match an approved [visual] item), the score against WordPress in pixel and faithful modes, and Lighthouse before and after. Any drop in Accessibility or SEO blocks the merge.
  7. Summary, then you choose: merge all, some or none.

The parity gate:

Site stateWhat optimize may do
Parity not signed offReport only. With --override-gate and your yes, [safe] fixes that pass the screenshot diff; never [visual]
Parity signed off (pixel or faithful)[safe] fixes after you OK the list; visible desktop changes are proposed departures, asked one by one
Facelift modeNo gate; visual findings are design decisions. Content, URL and metadata changes still need approval

migrate offers optimize once when parity is first signed off.

Arguments and options

ArgumentEffect
allEvery available area
<area>One of react, bundle, caching, design, seo, vercel, ia, redirects, structure
<skill>Run just that companion skill, for example web-design-guidelines
--report-onlyReport, change nothing (the default before parity sign-off)
--override-gateBefore sign-off, allow [safe] fixes (asks for an explicit yes)
--cache-componentsOpt into Next's Cache Components. A departure from wp2next's caching pattern: asked first, recorded, run with full upgrade-style checks, never part of all

Examples

For Claude desktop
Text
/wp2next:optimize all
  • wp2next optimize redirects: check old WordPress URLs and chains (you can add a Search Console "Not found" CSV export).
  • wp2next optimize ia: site structure and navigation vs traffic.
  • wp2next optimize structure: propose turning repeated content into Sanity documents.
  • wp2next optimize --report-only: a read-only look before sign-off.