Headless Ghost publishing. Write, audit, and automate your entire Ghost operation from your AI workflow — 17 workflows covering article publishing, batch imp...
---
name: ghost-publishing-pro
version: 2.4.0
description: "Headless Ghost publishing. Write, audit, and automate your entire Ghost operation from your AI workflow — 17 workflows covering article publishing, batch imports, site health audits, email performance, bulk excerpt push, and GSC indexing repair. Admin API only. No browser, no dashboard, no context switching."
homepage: https://github.com/highnoonoffice/hno-skills
source: https://github.com/highnoonoffice/hno-skills/tree/main/ghost-publishing-pro
credentials:
- name: ghost-admin.json
description: "JSON file at ~/.openclaw/credentials/ghost-admin.json with two fields: url (your Ghost site URL) and key (Admin API key in id:secret format — Ghost Admin > Settings > Integrations > Add custom integration)"
required: true
binaries:
- node
- curl
- python3
license: MIT
metadata: ~
---
# Ghost Publishing Pro
## Execution Gates
```xml
<skill_gates version="1.0" mode="mandatory_pre_execution" evaluation="sequential" on_violation="stop_and_report">
<gate id="credentials_check" priority="1" severity="hard" scope="session_start">
<condition>About to make any Ghost API call</condition>
<question>Have I confirmed ~/.openclaw/credentials/ghost-admin.json exists and contains both `url` and `key` fields?</question>
<pass_action>Proceed.</pass_action>
<fail_action>Stop. Read the credentials file first. If missing, run Credentials Setup. Do not attempt any API call without confirmed credentials.</fail_action>
</gate>
<gate id="fetch_before_put" priority="2" severity="hard" scope="pre_update">
<condition>About to PUT (update) any post</condition>
<question>Have I fetched the current post this session and captured its `updated_at` value?</question>
<pass_action>Proceed with PUT including `updated_at`.</pass_action>
<fail_action>Stop. Fetch the post first. A PUT without `updated_at` returns 409. No exceptions.</fail_action>
</gate>
<gate id="publish_email_atomic" priority="3" severity="hard" scope="pre_publish">
<condition>About to publish a post that should go to subscribers</condition>
<question>Is `email_segment` included in the same API call as `"status": "published"`?</question>
<pass_action>Proceed.</pass_action>
<fail_action>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.</fail_action>
</gate>
<gate id="bulk_write_approval" priority="4" severity="hard" scope="pre_bulk">
<condition>About to run any bulk operation (batch update, batch tag, batch excerpt, migration import)</condition>
<question>Has the user explicitly approved this bulk operation — scope, post count, and what will change?</question>
<pass_action>Proceed.</pass_action>
<fail_action>Stop. State the scope (how many posts, what changes), and wait for explicit approval. Bulk writes are irreversible without manual rollback.</fail_action>
</gate>
<gate id="settings_wall" priority="5" severity="soft" scope="pre_settings">
<condition>About to write to Ghost site settings, code injection, redirects, or staff</condition>
<question>Does the task require owner-level access that integration tokens cannot provide?</question>
<pass_action>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.</pass_action>
<fail_action>Do not attempt. Do not suggest browser fallback. State the platform limitation clearly and stop.</fail_action>
</gate>
<gate id="image_upload_method" priority="6" severity="soft" scope="pre_image">
<condition>About to upload an image to Ghost via the /images/upload/ endpoint</condition>
<question>Am I using Python requests with multipart/form-data for this specific upload call?</question>
<pass_action>Proceed. All other API calls (posts, tags, analytics) use curl or Node.js as normal.</pass_action>
<fail_action>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.</fail_action>
</gate>
</skill_gates>
```
---
### Before You Install
This skill has three hard requirements:
- **Node.js** installed locally (`node --version` to verify)
- **curl** installed (`curl --version` to 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:
```bash
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 NoPermissionError` by design
- **Redirects and routes files** — `POST /ghost/api/admin/redirects/` returns `403` with 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`:
```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)**
```bash
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": "<p>Your content</p>",
"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**
```bash
# 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":"<p>New content</p>","updated_at":"{fetched_updated_at}"}]}'
```
**List posts**
```bash
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**
```bash
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:** `<p>`, `<h2>`, `<h3>`, `<hr>`, `<blockquote>`, `<ul>`, `<ol>`
**Book-style literary typography** — ideal for fiction, essays, and long-form literary content:
```html
<div style="font-family: Georgia, serif; text-align: justify; hyphens: auto; -webkit-hyphens: auto;" lang="en">
<p style="text-indent: 2em; margin-bottom: 0; margin-top: 0;">Paragraph one.</p>
<p style="text-indent: 2em; margin-bottom: 0; margin-top: 0;">Paragraph two — no gap, indent only.</p>
</div>
```
**YouTube embed:**
```html
<figure class="kg-card kg-embed-card">
<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/{VIDEO_ID}"
frameborder="0" allowfullscreen></iframe>
</figure>
```
**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_segment` field 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 include `updated_at` from a fresh fetch
- Email not sending — `email_segment` only 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
- `tags` in `fields` param causes `400 BadRequestError` — use `&include=tags` instead
- 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 returns `403` with integration tokens — site settings are outside this skill's scope
- `GET /admin/integrations/` also returns `403` — 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 `.hbs` template, always use `{{{content}}}` (three braces). Double-braced `{{content}}` escapes the HTML and renders `undefined` instead of the post body.
- **Custom excerpts drive search** — Ghost's Content API `fields=excerpt` returns 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. Use `json.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/` returns `403`** — 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**
```python
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**
```python
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**
```python
# 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**
```python
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**
```python
# 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 a `403`, 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.
don't have the plugin yet? install it then click "run inline in claude" again.
Publish, update, schedule, and audit Ghost CMS posts entirely through API calls from your workflow , no browser, no dashboard, no manual steps. use this skill when you need to write + send newsletters in one call, batch import content from WordPress/Squarespace/Substack, audit your entire site for missing metadata, analyze email performance, or repair GSC indexing. covers 17 end-to-end workflows including migrations, theme uploads, and content audits. the skill enforces hard gates on credential setup, concurrent write safety, and email delivery , these prevent 409 conflicts, missed newsletters, and irreversible bulk mistakes.
credentials file (required)
~/.openclaw/credentials/ghost-admin.jsonurl (your ghost site url), key (admin api key in id:secret format)binaries (required)
node (verify with node --version) , used for jwt token generation, xml parsing, and batch operationscurl (verify with curl --version) , used for all api calls except image uploadspython3 (verify with python3 --version) , used for image uploads only (multipart form-data requires python requests on macos/linux; curl fails silently on zsh)optional npm dependency
fast-xml-parser@5.7.2 , install only if running squarespace/wordpress xml migrations. all other workflows (publish, update, schedule, image upload, analytics) require zero third-party packagesexternal connection: ghost admin api
https://{your-ghost-domain}/ghost/api/admin/ghost platform limitations (out of scope)
step 1: verify credentials file exists and is valid
input: filesystem access to ~/.openclaw/credentials/ghost-admin.json
action: read the file and parse json. confirm both url and key fields are present and non-empty. do not proceed if file is missing or malformed.
output: shell variable GHOST_URL set to the url value; GHOST_KEY set to the key value (format id:secret)
edge case: if file is missing, fail with "credentials file not found at ~/.openclaw/credentials/ghost-admin.json. create it first with url and key fields." do not attempt to create it automatically.
step 2: generate jwt token before every api call
input: GHOST_KEY (id:secret format), current unix timestamp, 5-minute expiry window
action: parse the key into id and secret. use node.js built-in hmac to generate a jwt token with payload containing iat (issued at), exp (expires at +5 minutes), and aud (audience = /admin/). encode as {header}.{payload}.{signature}. the full implementation is in references/api.md , copy it into your workflow.
output: shell variable TOKEN set to the jwt string
edge case: if token generation fails (bad key format, wrong binary), fail with "token generation failed. verify ghost_key is in id:secret format." tokens expire after 5 minutes; regenerate before each api call or every 50 posts in batch operations.
step 3: publish a post + send as newsletter (one atomic call)
input: GHOST_URL, TOKEN, post data object with title, html, status: "published", and email_segment: "all"
action: curl post to {GHOST_URL}/ghost/api/admin/posts/?source=html with authorization header Authorization: Ghost {TOKEN} and content-type application/json. body is json array {"posts":[{...}]}. this fires publication and newsletter send in a single call , there is no second step.
output: response json with post id, url, and email status
edge case: if email_segment is missing or added after publish, the newsletter cannot be resent via api , ghost admin resend is the only fallback. the gate prevents this by requiring email_segment in the same call as status: published.
step 4: create a draft (no newsletter)
input: same as step 3 but with status: "draft" instead of published
action: curl post to {GHOST_URL}/ghost/api/admin/posts/?source=html with same headers and body structure
output: response json with post id and draft status
edge case: drafts can be published later via update (step 6) without re-sending newsletters
step 5: upload image
input: GHOST_URL, TOKEN, local file path to image (jpg, png, gif, webp)
action: use python3 with requests library (not curl) to post multipart form-data to {GHOST_URL}/ghost/api/admin/images/upload/. field file is the image file; field purpose is image. this is the only endpoint where python is required , curl multipart fails silently on macos zsh for this endpoint.
output: response json with images array containing url field , use this url as the feature_image value in post objects
edge case: curl multipart fails silently on macos; use python requests exclusively for image upload. file size limit is 10mb per ghost pro specs.
step 6: update an existing post (with conflict safety)
input: GHOST_URL, TOKEN, post id, new post data (html, title, tags, etc.), and updated_at value from the most recent fetch
action: first, curl get to {GHOST_URL}/ghost/api/admin/posts/{id}/ to fetch the current post and capture its updated_at timestamp. then curl put to the same endpoint with the updated post object, including the updated_at value in the body. this prevents 409 conflicts if another write occurred between fetch and update.
output: response json with updated post data
edge case: if put does not include updated_at from a fresh fetch in this same session, ghost returns 409 conflict. the gate requires a fetch before every put. do not skip this step.
step 7: list posts with filtering and field selection
input: GHOST_URL, TOKEN, optional filter string (e.g., status:draft, tag:science), optional field list
action: curl get to {GHOST_URL}/ghost/api/admin/posts/?limit=15&filter={filter}&fields=id,title,slug,status,updated_at with authorization header
output: response json with posts array containing requested fields
edge case: tags in the fields param causes 400 BadRequestError , use &include=tags instead of adding tags to fields. rate limit: default limit is 15; use limit=all for full list but expect slower response.
step 8: schedule a post
input: GHOST_URL, TOKEN, post data with status: "scheduled" and published_at: "2026-03-20T18:00:00.000Z" (utc iso format)
action: curl post to {GHOST_URL}/ghost/api/admin/posts/?source=html with the scheduled post object in the body
output: response json with post id and scheduled status
edge case: time must be in utc iso format. the scheduled post will publish automatically at the specified time.
step 9: batch tag assignment (multi-post)
input: GHOST_URL, TOKEN, tag id, list of post ids to tag
action: for each post, curl get to {GHOST_URL}/ghost/api/admin/posts/{id}/?include=tags to fetch the post and its current tags. extract the existing tag id array. append the new tag id to the array. curl put to {GHOST_URL}/ghost/api/admin/posts/{id}/ with the updated tags array and the updated_at value from the fetch. add 500ms delay between calls to respect rate limits.
output: log of posts tagged with count and any failures
edge case: tag write endpoints (post, put, delete) require owner-level admin api credentials , integration tokens return 403. the tag list endpoint (get) works with standard integration tokens.
step 10: batch import posts (from xml migration)
input: xml file path (wordpress or squarespace export), GHOST_URL, TOKEN
action: parse xml using fast-xml-parser (npm install required for this workflow only). extract post title, content, publish date, tags, and featured image url from each item. for each post, construct a ghost post object with html (cleaned), title, published_at, tags (array of tag objects with name field), and feature_image (url). curl post to {GHOST_URL}/ghost/api/admin/posts/?source=html for each post. add 500ms delay between calls. log success and failure counts.
output: import report with total posts, successful imports, and failed post titles with error codes
edge case: squarespace imports preserve old internal link paths with /blog/ prefix , after import, audit all posts for /blog/ references and batch fix them via step 6 (update). wordpress xml may contain malformed html , use a html sanitizer or manual review before import.
step 11: site audit (metadata completeness scan)
input: GHOST_URL, TOKEN, optional output file path
action: curl get to {GHOST_URL}/ghost/api/admin/posts/?limit=all&include=tags to fetch all published posts. for each post, check for presence of: feature_image, custom_excerpt, meta_description, tags (at least one), and updated_at timestamp older than 30 days. flag posts missing any of these. generate a report with post title, slug, missing fields, and last update date.
output: audit report (json or csv) with flagged posts and missing field counts
edge case: if limit=all times out (large sites with 1000+ posts), use pagination with limit=100 and ?page=1, ?page=2, etc. to avoid timeout.
step 12: email performance report
input: GHOST_URL, TOKEN, time range (e.g., last 30 days)
action: curl get to {GHOST_URL}/ghost/api/admin/posts/?limit=all&include=email to fetch all posts with email send data. filter posts published in the time range. extract open_rate, click_rate, and cto (click to open) for each email. calculate divergence between expected open rate (based on subscriber count at send time) and actual. generate three-section report: email performance summary (avg open, avg ctr, top posts by engagement), web-only post health (posts with no email send, flag for amplification), subscriber tier breakdown.
output: performance report (json or markdown table) with email stats, engagement rankings, and web-only candidates
edge case: email data is only available for posts sent via the email_segment field , drafts and web-only posts have no email metrics.
step 13: batch excerpt writer
input: GHOST_URL, TOKEN, excerpt data mapping (slug or post id to custom excerpt text), optional dry-run flag
action: for each excerpt mapping, curl get to fetch the post by slug or id to get its updated_at. construct the custom_excerpt field (max 300 char hard cap). curl put to update the post with the custom_excerpt and updated_at. add 500ms delay between calls. log success, skip (if excerpt already set), and fail cases.
output: batch report with count of updated, skipped, and failed posts
edge case: custom excerpts drive ghost's content api search results and feed preview text. if a post needs to surface in client-side search, the search keyword must appear in the custom excerpt. 300-char limit is enforced by ghost.
step 14: gsc to ghost indexing repair loop
input: gsc coverage report (downloaded from google search console), GHOST_URL, TOKEN
action: parse gsc report to identify unindexed urls. classify each unindexed url by status (not submitted, crawled but not indexed, indexed but removed). for submitted but not indexed urls, verify the post exists in ghost (curl get by slug). if post exists and is published, check for missing canonical, robots, or noindex meta tags. flag posts for resubmission. for indexed but removed urls, check if post still exists , if so, fix any noindex tags or stale meta descriptions. log resubmission candidates and posts needing meta fixes.
output: gsc repair report with url classification, resubmission list, and meta tag recommendations
edge case: ghost's api does not support redirect writes (post /admin/redirects/ returns 403 for integration tokens) , redirect management is outside this skill's scope. focus on canonical verification and noindex removal only.
step 15: theme upload and activation
input: GHOST_URL, TOKEN, local zip file path of custom theme
action: curl post multipart form-data to {GHOST_URL}/ghost/api/admin/themes/upload/ with file field set to the theme zip. response includes theme name and active status. if activation is needed, curl post to {GHOST_URL}/ghost/api/admin/themes/{name}/activate/ to set it as the active theme.
output: response json with theme name, version, and active status
edge case: theme zip must contain valid hbs template files and package.json. custom theme templates must use triple-brace syntax {{{content}}} , double-braced {{content}} escapes html and renders undefined instead of post body.
step 16: custom html content formatting
input: content in markdown, plaintext, or structured format; desired html output (standard article, literary typography, embeds)
action: convert markdown/plaintext to html using standard tags: <p>, <h2>, <h3>, <hr>, <blockquote>, <ul>, <ol>. for literary typography (fiction, essays), wrap in <div> with georgia serif font, justify alignment, and paragraph indent. for youtube embeds, use <figure class="kg-card kg-embed-card"> wrapper with <iframe> pointing to youtube-nocookie.com. construct the full html object and pass to step 3 or step 6.
output: html string ready for post body
edge case: js is stripped in email delivery , no scripts or interactive elements in html. subscribe widgets are web-only. ghost wraps content in its own email template.
step 17: squarespace/wordpress/substack migration full workflow
input: export file (xml for squarespace/wordpress, csv + html for substack), GHOST_URL, TOKEN, optional mapping config (redirect rules, tag remapping)
action: combine steps 10 (parse and import posts), 5 (upload featured images), and 13 (write custom excerpts). parse the export file for each post. download featured images from external urls and upload via step 5. construct post object with cleaned html, title, tags, published_at, and feature_image url. import via step 10. after all imports complete, audit for /blog/ link prefixes (squarespace only) and batch fix via step 6. generate migration report with total posts, successful imports, image upload success rate, and any manual fixes needed.
output: migration report with post count, image count, tag mapping, and flagged urls needing manual review
edge case: substack html may have inline styles or malformed tags , sanitize before import. squarespace always includes /blog/ in internal link paths , batch find/replace after import. wordpress xml guids may not match ghost slugs , use url slugification rules for consistency.
if credentials file is missing or malformed
stop execution immediately. output: "credentials file not found at ~/.openclaw/credentials/ghost-admin.json or file is invalid json. create it with url and key fields. example:
{"url": "https://yoursite.ghost.io", "key": "id:secret"}
"
if any api call requires owner-level permissions and token is integration-only
the endpoint returns 403 NoPermissionError. stop and output: "this operation requires owner-level admin api credentials. switch to an owner token in ~/.openclaw/credentials/ghost-admin.json, or manage this feature manually in ghost admin." do not suggest browser fallback.
if about to update (put) any post
check if the current session has already fetched that post and captured its updated_at timestamp. if yes, include updated_at in the put body. if no, fetch the post first (step 7), capture updated_at, then proceed with put. if you skip the fetch, ghost returns 409 conflict and the update fails.
if about to publish a post that should go to subscribers
check if email_segment field is included in the same api call as status: "published". if yes, proceed , newsletter will be sent automatically. if no, do not publish. output: "email_segment field is required in the same api call as status: published. do not publish without it. if you publish first, the newsletter cannot be resent via api , only ghost admin manual resend." wait for user to add email_segment to the request body.
if about to run any bulk operation (batch update, batch tag, batch import)
stop and ask the user to explicitly approve the scope: how many posts, what exact changes will be made. output the scope clearly. wait for explicit yes/no approval before proceeding. bulk writes are irreversible without manual rollback in ghost admin.
if image upload is failing with curl
image uploads always fail silently on macos zsh when using curl multipart. switch to python3 requests library (step 5). curl works fine for all other api calls (posts, tags, analytics) , this exception applies to image upload only.
if a batch operation hits rate limit (429 response)
ghost pro allows 2,000 requests per 5 minutes per integration key. add 500ms delay between calls. if rate limit is hit mid-batch, wait 5 minutes and resume from the last successful post.
if token expires during a long batch operation
jwt tokens expire 5 minutes after generation. regenerate token before each api call, or every 50 posts in batch operations. if you get a 401 unauthorized response, regenerate the token and retry.
if post has no feature_image or custom_excerpt
site audit (step 11) will flag it. if it's a high-priority post, update via step 6 to add these fields , they improve seo and email/feed preview appearance.
if squarespace import is complete but posts contain /blog/ prefixes in internal links
this is expected behavior from squarespace exports. batch find/replace all /blog/ urls in post html using step 6 (update). example: find /blog/post-title, replace with /post-title.
if gsc report shows unindexed urls
step 14 will classify them. if status is "submitted but not indexed", verify the post exists in ghost and has a canonical tag. if the post is deleted or unpublished, google will naturally remove it from the index over time. if the post is live and published, check robots/noindex tags and resubmit to google search console.
if theme upload fails with 403
integration tokens cannot manage themes. switch to an owner token in credentials file and retry.
publish + newsletter (step 3)
posts (array with single post object), post.id, post.url, post.email_sent_at (timestamp if email was sent, null if draft)draft create (step 4)
posts (array), post.status = "draft"image upload (step 5)
images (array with single image object), image.url (full cdn url)update post (step 6)
posts (array), post.updated_at (new timestamp)list posts (step 7)
posts (array of post objects with requested fields), meta (object with pagination)schedule post (step 8)
posts (array), post.status = "scheduled", post.published_at (iso timestamp)batch tag assignment (step 9)
tagged (count), failed (count), failed_posts (array of post titles and error messages)batch import (step 10)
total_posts (count), successful (count), failed (count), failed_posts (array of original titles and error codes)site audit (step 11)
title, slug, missing_fields (array), last_updated_date, feature_image (true/false), custom_excerpt (true/false), meta_description (true/false), tags (count), stale (true if updated_at > 30 days ago)email performance (step 12)
email_count, avg_open_rate, avg_ctr, top_posts (array with title, open_rate, ctr), web_only_count, subscriber_tiers (breakdown by paid/free)batch excerpt write (step 13)
updated (count), skipped (count), failed (count), failed_posts (array with slug and error)gsc repair (step 14)
unindexed_urls (count), classification (not_submitted, crawled, indexed_removed), resubmit_candidates (array with url and reason), meta_fixes (array with post slug and missing tags)theme upload (step 15)
themes (array), theme.name, theme.active (boolean)migration full (step 17)
posts_imported (count), images_uploaded (count), image_failures (count), excerpts_written (count), /blog/ links_found(count),manual_review_needed` (array)user knows the skill worked when:
publish + newsletter: post appears on the live site within 10 seconds, email arrives in subscriber inboxes within 30 seconds, email send timestamp is visible in ghost admin posts view
draft create: post appears in ghost admin drafts list, url does not resolve (404) until status is changed to published
image upload: feature image loads on the live post page, url in the response is a valid ghost cdn path, image is no longer referenced by local file path
update post: change is live on the site within 5 seconds, updated_at timestamp in ghost admin is newer than before, no 409 conflict error
list posts: output includes all posts matching the filter, field count matches request, pagination cursor moves correctly on subsequent calls
schedule post: post appears in ghost admin scheduled queue with future publish date, post does not go live before scheduled time, auto-publishes at exact scheduled time
batch tag assignment: all target posts show the tag in ghost admin post editor, tag count in posts list is incremented, bulk tag report shows 0 failed count
batch import: all posts appear in ghost admin with correct titles and publish dates, urls are indexable (no robots: noindex), featured images load, internal links point to correct ghost urls
**