Content publisher

From oyi77/1ai-skills · View interactive version

Content publisher is an AI agent skill from the GitHub repository oyi77/1ai-skills. Use when automating drafting and publishing articles to Substack and Medium with SEO optimization, editorial calendars, and cross-platform distribution.

How to use this skill

Skill file

Content Publisher

When to Use

Trigger phrases:

Use cases:

When NOT to use:

Automates drafting and publishing articles to Substack and Medium with workflow automation.

When NOT to Use

Overview

Content Publisher automates workflow automation to reduce manual effort and increase reliability.

Workflow

# Example: Workflow automation
import schedule
import time

def run_workflow():
    data = fetch_data()
    processed = transform(data)
    deliver(processed)

schedule.every().hour.do(run_workflow)
while True:
    schedule.run_pending()
    time.sleep(60)
  1. Define triggers — Set up events or schedules that initiate the automation
  2. Configure inputs — Specify data sources and parameters
  3. Design pipeline — Define the sequence of automated steps
  4. Add error handling — Set up retries, alerts, and fallback paths
  5. Test end-to-end — Validate the full automation with realistic data
  6. Deploy and monitor — Activate and track performance

Code Examples

Python: Medium Draft

import os, requests

def publish_medium(title, body, tags):
    token = os.environ["MEDIUM_TOKEN"]
    headers = {"Authorization": f"Bearer {token}", "Content-Type": "application/json"}
    user = requests.get("https://api.medium.com/v1/me", headers=headers).json()["data"]["id"]
    payload = {"title": title, "contentFormat": "markdown", "content": body,
               "tags": tags[:5], "publishStatus": "draft"}
    resp = requests.post(f"https://api.medium.com/v1/users/{user}/posts", headers=headers, json=payload)
    resp.raise_for_status()
    return resp.json()["data"]["url"]

Node.js: WordPress Post

export async function publishWP(title, content, tags) {
  const auth = Buffer.from(`${process.env.WP_USER}:${process.env.WP_APP_PASSWORD}`).toString("base64");
  const resp = await fetch(`${process.env.WP_URL}/wp-json/wp/v2/posts`, {
    method: "POST", headers: { Authorization: `Basic ${auth}`, "Content-Type": "application/json" },
    body: JSON.stringify({ title, content, status: "draft", tags }),
  });
  if (!resp.ok) throw new Error(`WP ${resp.status}`);
  return (await resp.json()).link;
}

Configuration

Best Practices

Common Issues & Troubleshooting

| Problem | Solution |

|---|---|

| Medium 403 Forbidden | Token expired. Regenerate in Settings → Security → Integration tokens. |

| Substack draft missing | Session cookie expires ~24h. Re-authenticate and extract fresh SUBSTACK_SESSION. |

| WordPress 401 Unauthorized | Wrong app password or URL. Verify WP_URL ends with /wp-json/wp/v2/. |

| Cross-post formatting differs | Unsupported Markdown features. Strip footnotes and uncommon extensions before dispatch. |

| Medium tag limit (max 5) | API rejects >5 tags. Truncate to tags[:5] in the request payload. |

Anti-Rationalization Table

| Rationalization | Reality |

|---|---|

| "Manual is faster for one-off tasks" | One-off tasks become recurring. Automate early, save time later. |

| "I will add error handling later" | You never do. Handle errors from day one. |

| "Automation is overkill" | If you do it twice, automate it. If you do it daily, it is critical infrastructure. |

Process

  1. Research — Analyze target audience, competitors, and trending topics
  2. Create — Generate content following brand guidelines and best practices
  3. Publish & Optimize — Distribute to target platforms, track performance, iterate

Monetization

Verification

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.