Convert a WordPress website to a static site and deploy to Cloudflare Pages. Mirrors the rendered HTML via SSH, extracts only referenced assets (shrinks 1.5GB+ to ~25MB), fixes URLs, self-hosts fonts, strips WordPress cruft, and deploys. Use when migrating a WordPress site to static hosting.
数据来源:ClawHub。 在 ClawSkills 查看
选择你使用的 Agent
方法一:命令行安装(推荐)
推荐(无需提前安装 clawhub)
npx clawhub@latest --dir ~/.claude/skills install wp-to-static或使用 clawhub CLI(需提前安装)
clawhub --dir ~/.claude/skills install wp-to-static⚠️ 需要 Node.js 18+,没有 Node?请使用下方方法二直接下载 ZIP。 安装 Node.js →
方法二:手动下载安装(无需 Node)
下载 ZIP,解压后将文件夹放到以下路径,重启 Agent 即可:
安装路径
~/.claude/skills/wp-to-static/💡解压后将文件夹放到上方路径,重启 Agent 即可生效
--- name: wp-to-static description: Convert a WordPress website to a static site and deploy to Cloudflare Pages. Mirrors the rendered HTML via SSH, extracts only referenced assets (shrinks 1.5GB+ to ~25MB), fixes URLs, self-hosts fonts, strips WordPress cruft, and deploys. Use when migrating a WordPress site to static hosting. disable-model-invocation: true argument-hint: "[site-url]" allowed-tools: Bash, Read, Write, Edit, Grep, Glob, Task, WebFetch metadata: {"openclaw":{"requires":{"bins":["ssh","ssh-agent","rsync","curl","git","gh","wrangler"],"env":["WP_SSH_HOST","WP_SSH_USER","WP_SSH_PORT","WP_SSH_KEY","WP_SITE_URL","WP_SITE_NAME"]},"emoji":"🔄","os":["darwin","linux"]}} ---
Convert a WordPress website to a pixel-perfect static site and deploy it to Cloudflare Pages. Zero attack surface, zero hosting cost, instant load times.
Before running this skill, the user MUST have:
gh auth status to verify. If not logged in, run gh auth login first.wrangler whoami to verify. If not logged in, run wrangler login first.```bash eval "$(ssh-agent -s)" ssh-add ~/.ssh/your_wp_key ```
~/.ssh/known_hosts.Required (stop and ask if any are missing):
WP_SSH_HOST — SSH hostname (e.g., ssh.example.com)WP_SSH_USER — SSH usernameWP_SSH_PORT — SSH port (e.g., 18765)WP_SSH_KEY — Path to SSH private key file (e.g., ~/.ssh/wp_key). Key must have chmod 600 permissions.WP_SITE_URL — WordPress site URL (e.g., https://example.com)WP_SITE_NAME — Short project name (e.g., mysite)Optional:
CF_ACCOUNT_ID — Cloudflare account ID for Pages deploymentGH_REPO_VISIBILITY — private (default) or publicssh-agent — keys are loaded into the agent before running, so no passphrase is passed via environment variables or command argumentsStrictHostKeyChecking=no) — the server must already be in ~/.ssh/known_hostsssh, ssh-agent, rsync, curl, git, gh, wrangler.gh auth status succeeds. If not, tell user to run gh auth login.wrangler whoami succeeds (if CF_ACCOUNT_ID is set). If not, tell user to run wrangler login.chmod 600).Test the connection using the key from ssh-agent:
ssh -i $WP_SSH_KEY -p $WP_SSH_PORT $WP_SSH_USER@$WP_SSH_HOST "echo connected"
If the key requires a passphrase and ssh-agent is not loaded, tell the user:
Please add your SSH key to ssh-agent first:
eval "$(ssh-agent -s)"
ssh-add /path/to/your/key
Then re-run /wp-to-static
If the host key is not recognized, tell the user to connect manually once first to verify and accept the host key:
Please connect to the server once manually to verify the host key:
ssh -i $WP_SSH_KEY -p $WP_SSH_PORT $WP_SSH_USER@$WP_SSH_HOST
Accept the host key, then re-run /wp-to-static
Do NOT use StrictHostKeyChecking=no. Do NOT bypass host key verification.
SSH in and find the WordPress public_html directory. Common locations:
~/www/DOMAIN/public_html/~/public_html/~/htdocs//var/www/html/Confirm by finding wp-config.php. Store path as WP_ROOT.
Run wget --mirror on the server (not locally):
cd /tmp && rm -rf static_mirror && mkdir -p static_mirror && cd static_mirror && \
wget --mirror --convert-links --adjust-extension --page-requisites --no-parent \
--restrict-file-names=windows -e robots=off --timeout=30 --tries=3 --wait=0.5 \
--user-agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)" \
$WP_SITE_URL/ 2>&1 | tail -30
If wget is not available on the server, fall back to curl locally for rendered HTML.
Create ./build/site (NEVER use the project root as temp dir).
Exclude server-side code and sensitive files. Only static assets (images, CSS, JS, fonts) are needed. PHP files, config files, and other server-side code must NEVER be downloaded.
RSYNC_EXCLUDE="--exclude='*.php' --exclude='wp-config*' --exclude='.htaccess' --exclude='*.sql' --exclude='*.log' --exclude='debug.log' --exclude='error_log' --exclude='.env' --exclude='*.bak' --exclude='*.backup'"
rsync -avz $RSYNC_EXCLUDE server:/tmp/static_mirror/DOMAIN/ ./build/site/
rsync -avz $RSYNC_EXCLUDE server:$WP_ROOT/wp-content/uploads/ ./build/site/wp-content/uploads/
rsync -avz $RSYNC_EXCLUDE server:$WP_ROOT/wp-content/themes/ ./build/site/wp-content/themes/
rsync -avz $RSYNC_EXCLUDE server:$WP_ROOT/wp-content/plugins/ ./build/site/wp-content/plugins/
rsync -avz $RSYNC_EXCLUDE server:$WP_ROOT/wp-includes/ ./build/site/wp-includes/
After rsync, verify no PHP or config files were downloaded:
find ./build/site -name '*.php' -o -name 'wp-config*' -o -name '.htaccess' -o -name '.env' | head -20
If any are found, delete them before proceeding.
This is the key step. Parse all HTML and CSS files to find every referenced local file:
From HTML: src=, href=, data-src=, data-srcset=, srcset=, inline background-image: url()
From CSS: All url() references — resolve relative paths from CSS file location to site root.
Write the list to ./build/referenced-files.txt, then copy only those files to ./public/ preserving directory structure. This typically shrinks 1.5GB+ down to ~25MB.
In index.html and ALL CSS files:
$WP_SITE_URL/ → empty string (relative paths) - Download each .ttf to ./public/fonts/ - Update @font-face src: to fonts/filename.ttf
for Google Fonts domainsCSS path resolution is critical. If CSS is at wp-content/uploads/cache/file.css:
wp-content/uploads/ → ../../wp-content/themes/ → ../../themes/wp-includes/ → ../../../wp-includes/Remove:
(WordPress, WPBakery, Slider Revolution), (RSS, oEmbed), for fonts.googleapis.comwp-json root references in inline JSONKeep: Email addresses, (update to /)
Create ./public/_headers with aggressive caching for /fonts/, /wp-content/, /wp-includes/*.
Create ./public/_redirects redirecting /wp-admin/, /wp-login.php, /xmlrpc.php, /feed/ → / (302).
python3 -m http.server from ./public/...
安装 WordPress to Static Site 后,可以对 AI 说这些话来触发它
Help me get started with WordPress to Static Site
Explains what WordPress to Static Site does, walks through the setup, and runs a quick demo based on your current project
Use WordPress to Static Site to convert a WordPress website to a static site and deploy to Cloudfla...
Invokes WordPress to Static Site with the right parameters and returns the result directly in the conversation
What can I do with WordPress to Static Site in my developer & devops workflow?
Lists the top use cases for WordPress to Static Site, with example commands for each scenario
将技能文件夹放到 ~/.claude/skills/wp-to-static/ 目录(个人级,所有项目可用),或 .claude/skills/wp-to-static/(项目级)。重启 AI 客户端后,用 /wp-to-static 主动调用,或让 AI 根据上下文自动发现并使用。
WordPress to Static Site 支持 Claude、Cursor、OpenClaw,可与这些 AI 平台无缝集成,扩展其能力。
WordPress to Static Site 可免费安装使用。请查阅仓库了解许可证信息。
Convert a WordPress website to a static site and deploy to Cloudflare Pages. Mirrors the rendered HTML via SSH, extracts only referenced assets (shrinks 1.5GB+ to ~25MB), fixes URLs, self-hosts fonts, strips WordPress cruft, and deploys. Use when migrating a WordPress site to static hosting.
Automate my developer & devops tasks using WordPress to Static Site
Identifies repetitive steps in your workflow and sets up WordPress to Static Site to handle them automatically
WordPress to Static Site 属于「Developer & DevOps」分类,该分类的技能帮助 AI 智能体在此领域执行专业任务。