Ghost (ghost.org). Use this skill for ANY Ghost request — reading, creating, and updating data. Whenever a task involves Ghost, use this skill instead of cal...
浏览器
ghost-publishing-pro
试用通过 Ghost Admin API,在 AI 工作流中发布、更新并审计 Ghost CMS 内容。
它能做什么
基于 curl 与 Node.js 直接调用 Ghost Admin API 的发布技能 — 无需浏览器,无需登录后台。共 17 个工作流,涵盖单次调用同时发布文章与发送邮件、草稿、定时发布、必须携带 updated_at 的安全更新、图片上传、批量操作、Squarespace / WordPress / Substack 迁移、站点元数据审计、邮件表现报表(打开率、点击率、CTO)、批量摘要推送,以及 Google Search Console 索引修复。凭据保存在 ~/.openclaw/credentials/ghost-admin.json,JWT 每次调用前重新生成(5 分钟过期)。员工管理、站点设置/代码注入、重定向对集成令牌一律返回 403 — 属于 Ghost 平台限制,不在本技能覆盖范围内。
什么时候用它
- 通过一次 API 调用完成文章发布并向订阅者发送邮件
- 将 Squarespace、WordPress 或 Substack 博客迁移到 Ghost
- 审计全站缺失的封面图、摘要与元描述
- 修复 Ghost URL 在 Google Search Console 中长期未被收录的问题
技能文档
Ghost Publishing Pro
Execution Gates
About to make any Ghost API call
Have I confirmed ~/.openclaw/credentials/ghost-admin.json exists and contains both `url` and `key` fields?
Proceed.
Stop. Read the credentials file first. If missing, run Credentials Setup. Do not attempt any API call without confirmed credentials.
About to PUT (update) any post
Have I fetched the current post this session and captured its `updated_at` value?
Proceed with PUT including `updated_at`.
Stop. Fetch the post first. A PUT without `updated_at` returns 409. No exceptions.
About to publish a post that should go to subscribers
Is `email_segment` included in the same API call as `"status": "published"`?
Proceed.
Stop. Add `email_segment` to this call. Email cannot be triggered after the fact via API — only Ghost Admin manual resend. This is a one-shot gate.
About to run any bulk operation (batch update, batch tag, batch excerpt, migration import)
Has the user explicitly approved this bulk operation — scope, post count, and what will change?
Proceed.
Stop. State the scope (how many posts, what changes), and wait for explicit approval. Bulk writes are irreversible without manual rollback.
About to write to Ghost site settings, code injection, redirects, or staff
Does the task require owner-level access that integration tokens cannot provide?
Stop. This operation is a Ghost platform limitation — outside the scope of this skill. Flag it to the user: this endpoint returns 403 for integration tokens by design and cannot be automated via the Admin API.
Do not attempt. Do not suggest browser fallback. State the platform limitation clearly and stop.
About to upload an image to Ghost via the /images/upload/ endpoint
Am I using Python requests with multipart/form-data for this specific upload call?
Proceed. All other API calls (posts, tags, analytics) use curl or Node.js as normal.
Switch to Python requests for the image upload only. curl multipart fails silently on macOS zsh for this endpoint. Browser fetch is blocked by CORS. Everything else in this skill uses curl or Node.js — this exception applies to image upload only.
Before You Install
This skill has three hard requirements:
- Node.js installed locally (
node --versionto verify) - curl installed (
curl --versionto verify — standard on macOS/Linux) - Ghost Admin API key stored at
~/.openclaw/credentials/ghost-admin.json
If those three aren't ready, start with the Credentials Setup section below. Everything else in this skill assumes they're in place.
Start Here
Most users want two things: publish a post and send it to subscribers in one call, and update existing posts without breaking them. Start with Core Operations below — that covers 90% of day-to-day use.
Also here if you need it: batch imports, site health audits, email analytics, excerpt management, GSC indexing repair, and full Squarespace/WordPress/Substack migrations. All 17 workflows are in references/workflows.md.
If you're new: do Credentials Setup, then go straight to Core Operations. Skip everything else until you need it.
A full Ghost CMS publishing skill built from real production use — not a generic API wrapper.
This contains proven workflows, hard-won pitfalls, and patterns from actually running a Ghost Pro newsletter and migrating an entire Squarespace blog in an afternoon.
Dependencies
Most workflows use only Node.js built-ins (fs, https, and the standard HMAC module) and curl — no npm packages required.
The Squarespace/WordPress XML migration workflow optionally uses one npm package:
npm install fast-xml-parser@5.7.2
Install this only if you are running a migration script. All other workflows (publish, update, schedule, image upload, analytics) require no third-party packages.
Required Access
This skill uses Ghost's Admin API. Here's exactly what it does with your credentials:
Reads: Post list, member count, analytics, post content, image URLs.
Writes: Creates and updates posts, uploads images, schedules content, sends newsletters.
Recommended setup: Create a dedicated integration key (Settings > Integrations > Add custom integration > Admin API Key). This covers the full publishing workflow with minimal scope.
The skill never stores credentials beyond the file you configure. Tokens are captured to shell variables and never logged or printed to stdout. No external calls outside your Ghost instance.
Security Model
This skill is designed around minimal-scope credential use. Here's exactly how credential access is scoped and why it's safe:
Use a dedicated integration key, not your owner credentials. Ghost Admin → Settings → Integrations → Add custom integration → copy the Admin API Key. This key is isolated to the integration, fully revocable, and scoped to post/image/member operations — your owner account is never exposed.
The credentials file is read-only at runtime. The skill reads ~/.openclaw/credentials/ghost-admin.json to generate a short-lived JWT (5-minute expiry). Nothing is written back to the file. Tokens are captured to shell variables, never logged or persisted.
No external calls outside your Ghost instance. Every API call targets your Ghost domain only. No third-party services, no telemetry, no data leaves your site.
Revocation is instant. If you need to cut access, delete the integration in Ghost Admin → Settings → Integrations. All tokens derived from that key immediately stop working.
Keep the credentials file out of shared folders and version control. Restrict access to your user account only using your OS file permission settings.
Ghost Platform Limitations (Out of Scope)
These operations return 403 for integration tokens — they are Ghost platform restrictions, not skill gaps. This skill does not cover them and does not provide browser workarounds:
- Staff management — owner-only, no API path
- Site settings / code injection —
403 NoPermissionErrorby design - Redirects and routes files —
POST /ghost/api/admin/redirects/returns403with integration tokens
Theme management (upload + activation) is fully supported via the Admin API — see Workflow 15 below.
If you hit a NoPermissionError on settings write endpoints, that is expected Ghost behavior — not a bug in this skill.
Credentials Setup
Create a credentials file at ~/.openclaw/credentials/ghost-admin.json:
{
"url": "https://your-site.ghost.io",
"key": "id:secret"
}
Stored at: ~/.openclaw/credentials/ghost-admin.json (fields: url, key)
Get your key: Ghost Admin > Settings > Integrations > Add custom integration > Admin API Key.
Covers: all post operations, image uploads, scheduling, newsletters, analytics, batch updates.
Authentication
Ghost uses short-lived JWT tokens. Generate one before every API call — they expire in 5 minutes.
Pure Node.js — no npm required.
Token generation uses Node.js built-ins (fs and the standard HMAC module) and the Admin API key format (id:secret). The full implementation is in references/api.md under Authentication — copy the token generation script into your workflow, capture the output to a shell variable, and pass it as Authorization: Ghost {token} on all requests.
Tokens expire in 5 minutes. Regenerate before each API call or every 50 posts in batch operations.
Core Operations
Publish a post + send as newsletter (one call)
curl -s -X POST "{url}/ghost/api/admin/posts/?source=html" \
-H "Authorization: Ghost {token}" \
-H "Content-Type: application/json" \
-d '{"posts":[{
"title": "Your Title",
"html": "Your content",
"status": "published",
"email_segment": "all"
}]}'
This is the killer feature — one API call publishes to the web and sends to all subscribers simultaneously. Do not publish first and try to send separately. If you miss the email_segment field on first publish, the newsletter cannot be resent via API — it is a one-shot operation.
Create a draft
Same as above with "status": "draft". No email sent.
Update an existing post
# 1. Fetch post to get updated_at (required)
curl -s "{url}/ghost/api/admin/posts/{id}/" -H "Authorization: Ghost {token}"
# 2. Update with updated_at included
curl -s -X PUT "{url}/ghost/api/admin/posts/{id}/?source=html" \
-H "Authorization: Ghost {token}" \
-H "Content-Type: application/json" \
-d '{"posts":[{"html":"New content","updated_at":"{fetched_updated_at}"}]}'
List posts
curl -s "{url}/ghost/api/admin/posts/?limit=15&filter=status:draft&fields=id,title,slug,status,updated_at" \
-H "Authorization: Ghost {token}"
Upload image
curl -s -X POST "{url}/ghost/api/admin/images/upload/" \
-H "Authorization: Ghost {token}" \
-F "file=@/path/to/image.jpg" \
-F "purpose=image"
# Returns URL — use as feature_image value
Schedule a post
Add "status": "scheduled" and "published_at": "2026-03-20T18:00:00.000Z" (UTC).
HTML Content
Always use ?source=html in the request URL. Ghost accepts raw HTML in the html field.
Standard article: , , , , , , ``
Book-style literary typography — ideal for fiction, essays, and long-form literary content:
Paragraph one.
Paragraph two — no gap, indent only.
YouTube embed:
Email rules — critical:
- JS is stripped in email delivery. No scripts or interactive elements.
- Subscribe widgets are web-only — stripped from email.
- Ghost wraps content in its own email template. Don't add headers or footers.
- The
email_segmentfield only fires on first publish. It must be in the same API call as"status": "published".
Migration Workflows
See references/workflows.md for full migration playbooks:
- Squarespace XML export > Ghost batch import (proven — full blog migrated in one afternoon)
- WordPress XML migration
- Substack CSV + HTML migration
- Batch feature image updates
- DOCX > book-style Ghost posts with YouTube embeds
- Native audio card embedding (upload MP3, embed as Ghost audio card)
- Theme management (JWT upload via Admin API)
- Site audit — scan all published posts for missing feature images, excerpts, meta descriptions, tags, stale slugs, and untouched content (Workflow 14)
- Content performance intelligence — three-section report: email performance (open rate, click rate, CTO, divergence analysis), web-only post health + amplification candidates, pages health snapshot. Audience snapshot with subscriber tier breakdown. (Workflow 15)
- Batch excerpt push — write custom excerpts to all posts in a single run. 300-char hard cap, slug-based targeting, skip/fail reporting. Proven on 65 posts in production. (Workflow 16)
- GSC → Ghost indexing & SEO repair loop — triage GSC coverage report, classify unindexed URLs, submit real posts for indexing, accelerate discovery with internal links. Note: redirect rule writes are blocked by Ghost's API for integration tokens — redirect management is outside this skill's scope. (Workflow 17)
See references/api.md for complete endpoint documentation, error codes, and token generation details.
Common Pitfalls
409 on PUT— must includeupdated_atfrom a fresh fetch- Email not sending —
email_segmentonly fires on first publish; use Ghost admin to resend - Rate limiting — add 500ms delay between calls in batch scripts
- Token expired mid-batch — regenerate every 50 posts in long operations
tagsinfieldsparam causes400 BadRequestError— use&include=tagsinstead- External script tag in code injection pointing to a local/LAN hostname will silently fail on the live HTTPS site — mixed content + Private Network Access policy blocks it. All search/widget JS must be inline in the code injection block.
PUT /admin/settings/always returns403with integration tokens — site settings are outside this skill's scopeGET /admin/integrations/also returns403— get Content API key from site HTML source instead (data-key=attribute on portal/search script tags)- Custom theme:
{{content}}must be triple-braced — in any custom.hbstemplate, always use{{{content}}}(three braces). Double-braced{{content}}escapes the HTML and rendersundefinedinstead of the post body. - Custom excerpts drive search — Ghost's Content API
fields=excerptreturns the custom excerpt, not body text. If a post needs to surface in client-side search for a keyword, that keyword must appear in the custom excerpt. - Links inside HTML cards in Lexical are double-escaped — regex on
"url":"..."fields won't find them. Usejson.dumps(lexical)→ string replace →json.loads()to safely find and replace any URL pattern inside embedded HTML. - Ghost's sitemap is always clean — Ghost Pro auto-generates sitemaps using the configured site URL. No manual sitemap editing needed.
- Squarespace migration leaves /blog/ links — batch imports preserve old internal link paths with the
/blog/prefix. After any Squarespace import, audit all posts for/blog/references and fix them via the API. POST /admin/redirects/upload/returns403— redirect management is blocked for integration tokens by Ghost's platform design. Outside the scope of this skill.
Tag Management
Ghost's Admin API supports full tag CRUD. These endpoints require an Admin-level token (owner or staff with Admin role). Integration tokens return 403 — if that happens, see the safe-mode note below.
List all tags
r = requests.get(
f'{GHOST_URL}/ghost/api/admin/tags/?limit=all',
headers=headers
)
tags = r.json().get('tags', [])
for tag in tags:
print(tag['id'], tag['name'], tag['slug'])
Create a tag
r = requests.post(
f'{GHOST_URL}/ghost/api/admin/tags/',
headers=headers,
json={"tags": [{"name": "Your Tag", "slug": "your-tag"}]}
)
if r.status_code == 403:
print("Safe-mode: Admin token requires owner-level permissions for tag endpoints. Add tags manually in Ghost Admin or use an owner token.")
else:
tag = r.json()['tags'][0]
print(tag['id'], tag['name'])
Update a tag
# Fetch tag id first via list, then:
r = requests.put(
f'{GHOST_URL}/ghost/api/admin/tags/{TAG_ID}/',
headers=headers,
json={"tags": [{"id": TAG_ID, "name": "Updated Name", "slug": "updated-slug"}]}
)
if r.status_code == 403:
print("Safe-mode: owner-level token required for tag updates.")
Delete a tag
r = requests.delete(
f'{GHOST_URL}/ghost/api/admin/tags/{TAG_ID}/',
headers=headers
)
if r.status_code == 403:
print("Safe-mode: owner-level token required for tag deletion.")
elif r.status_code == 204:
print("Tag deleted.")
Bulk assign a tag to multiple posts
# Fetch posts, then PATCH each with the tag added
posts = requests.get(
f'{GHOST_URL}/ghost/api/admin/posts/?limit=all&include=tags',
headers=headers
).json()['posts']
for post in posts:
existing_tags = [{"id": t["id"]} for t in post.get("tags", [])]
if not any(t["id"] == TAG_ID for t in existing_tags):
existing_tags.append({"id": TAG_ID})
requests.put(
f'{GHOST_URL}/ghost/api/admin/posts/{post["id"]}/',
headers=headers,
json={"posts": [{"id": post["id"], "updated_at": post["updated_at"], "tags": existing_tags}]}
)
print(f"Tagged: {post['title']}")
Safe-mode note: All tag write endpoints (
POST,PUT,DELETE) require owner-level Admin API credentials. If you get a403, either switch to an owner token or manage tags manually in Ghost Admin → Settings → Tags. The list endpoint (GET) works with standard integration tokens.
License
MIT. Copyright (c) 2026 @highnoonoffice. Retain this notice in any distributed version.
常见问题
- 为什么更新文章时会返回 409 错误?
- PUT 请求必须带上文章当前的 `updated_at` 字段,该值需要先在同一会话中通过 GET 拉取,再随更新请求一起发送。
- 为什么发布后邮件没有发出?
- `email_segment` 仅在首次发布时触发,必须与 `"status": "published"` 写在同一次 API 调用里;事后无法再通过 API 重发邮件。
- 这个技能能修改站点设置或添加重定向吗?
- 不能。员工管理、站点设置/代码注入、重定向这三类接口对集成令牌返回 403,是 Ghost 平台的设计,技能会直接告知用户这一限制,而非建议改用浏览器操作。
相关技能
Sync Mailchimp newsletter posts to a Ghost blog. Fetches newsletter content from RSS, converts HTML to clean markdown with horizontal rules, uploads images t...
Audit any personal or brand site for AI agent discoverability and fix what is fixable — structured data, trust anchor pages, llms.txt, crawlability checks, and Ghost-specific deployment patterns. Ghost Pro native.
Build, review, and debug Ghost CMS themes.
Manage Gumroad and batch-publish digital products with the official CLI.
Write content by interviewing the user instead of drafting - extract their material through questions, then assemble the piece from their own words. Use when the user needs to write something for an audience or mentions "ghostwriter".