---
name: new-theme-submission
description: Submit a WordPress theme to WordPress.org/themes/upload with validation reminders, repo sync, and automated form submission. Use when the user wants to submit a theme for review.
---

# WordPress Theme Submission Skill

When the user runs `/new-theme-submission [themeslug]`, follow these steps **in order**.

The `[themeslug]` argument is the folder name of the theme in the current repository.

## Step 1: Display Validation Reminders

Before proceeding, ask the user to confirm both of these:

1. "Have you run `/theme-review [themeslug]` to validate your theme?"
2. "Have you run the Theme Check plugin on your test site?"
   - Plugin: https://en-gb.wordpress.org/plugins/theme-check/

If they haven't completed both, stop and let them do so first.

## Step 2: Sync Local Repo with Trunk

Run these commands yourself:

```bash
git status --porcelain
```

- If there are uncommitted changes: stop and tell the user to commit or stash them first
- If the working tree is clean: run `git pull origin trunk`

Tell the user the result before continuing.

## Step 3: Get WordPress.org Credentials

The submission uses the **"automattic"** WordPress.org account. This account always has two-factor authentication enabled, so you need both the password and an OTP code.

Check for `WPORG_PASSWORD` and `WPORG_OTP` in the environment first. If either is not set, ask the user to provide them:

- Password is available at: https://mc.a8c.com/secret-store/?secret_id=6204
- OTP comes from the authenticator app — ask the user to open it and get the current code **right before running the script** (codes expire every 30 seconds)
- Treat both as sensitive — do not echo them back or log them

## Step 4: Run the Submission Script

Run the script, passing both credentials as environment variables:

```bash
cd .claude/skills/new-theme-submission && npm install --silent
WPORG_PASSWORD=<password> WPORG_OTP=<code> node submit.js <themeslug>
```

The script will:
- Validate the theme slug and confirm `style.css` exists
- Create a clean ZIP (excluding `.git`, `node_modules`, `.claude`, `.env`, etc.)
- Check the ZIP is under 10 MB
- Authenticate with WordPress.org via Puppeteer, including the 2FA challenge
- Submit the upload form
- Print the trac ticket URL as `TRAC_URL=https://...`

### If login fails (wrong password)

The script will exit with: `Error: Login failed. Please check your WPORG_PASSWORD.`

Ask the user for the password again and re-run. Allow up to 3 attempts before giving up.

### If the OTP code expired

The script will exit with: `Error: Two-factor authentication required. Re-run with WPORG_OTP=<your code>.`

Ask the user for a fresh OTP code and re-run immediately.

### Testing (Test Mode)

To test the full workflow without submitting to WordPress.org:

```bash
TEST_MODE=true node .claude/skills/new-theme-submission/submit.js <themeslug>
```

## Step 5: Show the Trac Ticket URL

Parse the `TRAC_URL=...` line from the script output and display it prominently to the user. Tell them they can track their theme review at that URL.

## Step 6: Manual Fallback

If the script fails for any reason other than a wrong password, guide the user to submit manually at https://wordpress.org/themes/upload/:

1. Log in as "automattic"
2. Upload the ZIP from `/tmp/[themeslug].zip` (if it still exists) or recreate it
3. Check all three checkboxes:
   - "I have permission to upload this theme..."
   - "The theme complies with all Theme Guidelines"
   - "The theme, and all included assets, are licenced as GPL..."
4. Click "Upload"
