toutiao-publisher — Claude Code skill: publish to Toutiao
Turns a Markdown file into a Toutiao draft with inline images and a cover, then waits for you to approve the final publish.
npx skills add guanyang/super-publisher --skill toutiao-publisher -a claude-codeWhat toutiao-publisher does
The skill ships its own scripts. scripts/run.py bootstraps a local .venv, checks the requirements fingerprint and runs either publisher.py or auth_manager.py. A draft is built from a Markdown file: headings, lists, tables, block quotes, fenced code and local inline images. Relative image paths resolve from the Markdown file itself.
Manual mode is the default. Chrome stays open, you read the draft and click Publish yourself. Auto mode with --headless finishes the job, but only when you have explicitly authorized it. Success means Toutiao showed a recognized success indicator; a click on the final button without that confirmation comes back as publish_unconfirmed. So do not read the exit code as proof of publishing — check the JSON events.
The login session is shared. The profile lives in ~/.super-publisher/toutiao-publisher/, and Codex, Claude, Antigravity and plain CLI runs by the same system user reuse it. Python 3.9+, Google Chrome and local network access are required. Avoid starting concurrent browser operations against the same persistent Chrome profile; that is a reason to wait for the previous run to finish. clear --yes and reauth --yes wipe the shared session, so confirm first that other agents will not lose their login.
What it helps with
- build a Toutiao draft from a Markdown article
- check whether the shared Toutiao login still works
- upload inline images and a cover into the draft
- hold the final publish for human review
- publish automatically after explicit authorization
Example prompts for the agent
- Check the Toutiao login and show me the session status
- Fill a Toutiao draft from /absolute/path/article.md with cover /absolute/path/cover.jpg, don't publish
- Publish the article to Toutiao in auto mode, I authorize the final publish
How to install toutiao-publisher
1Skills CLI (Vercel)
npx skills add guanyang/super-publisher --skill toutiao-publisher -a claude-code2Manually: put the files in place
~/.claude/skills/toutiao-publisher/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/toutiao-publisher/
1Skills CLI (Vercel)
npx skills add guanyang/super-publisher --skill toutiao-publisher -a codex2Manually: put the files in place
.agents/skills/toutiao-publisher/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add guanyang/super-publisher --skill toutiao-publisher -a cursor2Manually: put the files in place
.cursor/skills/toutiao-publisher/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install guanyang/super-publisher toutiao-publisher2Manually: put the files in place
.github/skills/toutiao-publisher/SKILL.md1Skills CLI (Vercel)
npx skills add guanyang/super-publisher --skill toutiao-publisher -a gemini-cli2Platform CLI
gemini skills install https://github.com/guanyang/super-publisher --path skills/toutiao-publisherManually: put the files in place
.devin/skills/toutiao-publisher/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add guanyang/super-publisher --skill toutiao-publisher -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about toutiao-publisher
How do I install toutiao-publisher in Claude?
Run npx skills add guanyang/super-publisher --skill toutiao-publisher -a claude-code. The skill lands at ~/.claude/skills/toutiao-publisher/SKILL.md.
What does toutiao-publisher do?
It prepares and publishes articles for Toutiao/头条号: verifies the login, fills a draft from Markdown with images and a cover, and only completes the final publish after confirmation.
What does the skill need to run?
Python 3.9+, Google Chrome and local network access. The login session is stored in ~/.super-publisher/toutiao-publisher/ and shared by Codex, Claude, Antigravity and CLI runs under the same user.
Source text
SKILL.md · MIT
--- name: toutiao-publisher description: Publish or prepare articles for Toutiao/头条号, check or restore shared login state, fill Markdown drafts with inline images and covers, and optionally complete final publishing. Use for requests such as 发布到头条、检查头条登录、填充头条草稿、上传图文、人工审核 or explicitly authorized automatic publishing. --- # Toutiao Publisher Use the scripts from this Skill directory. Resolve the directory containing this `SKILL.md` first and set its absolute path as `SKILL_DIR`; do not assume the caller's working directory is the Skill directory. ## Safety rules - Default to `--mode manual`. Leave Chrome open for the user to review and click Publish. - Use `--mode auto` only when the user explicitly authorizes final publishing. - Run `clear --yes` or `reauth --yes` only after the user confirms that all local Agents may lose the shared Toutiao session. - Do not bypass input validation or treat an unconfirmed publish click as success. ## Preflight authentication Check the protected Toutiao page before asking the user to scan a QR code: ```bash python3 "$SKILL_DIR/scripts/run.py" auth_manager.py status --verify --json ``` If the result status is `not_authenticated`, open the interactive login flow: ```bash python3 "$SKILL_DIR/scripts/run.py" auth_manager.py setup --json ``` The shared profile lives under `~/.super-publisher/toutiao-publisher/` by default. Codex, Kiro, Antigravity, and direct CLI runs by the same system user reuse it. Set `SUPER_PUBLISHER_DATA_DIR` to override the location; relative values resolve from the user home directory. ## Prepare and publish an article Validate inputs without opening Chrome: ```bash python3 "$SKILL_DIR/scripts/run.py" publisher.py \ --mode validate \ --title "AI Trends 2026" \ --content-file "/absolute/path/article.md" \ --cover "/absolute/path/cover.jpg" \ --json ``` After validation succeeds, fill the draft and wait for manual review: ```bash python3 "$SKILL_DIR/scripts/run.py" publisher.py \ --mode manual \ --title "AI Trends 2026" \ --content-file "/absolute/path/article.md" \ --cover "/absolute/path/cover.jpg" \ --json ``` Use direct text only through `--content-text`. `--content` remains an alias for `--content-file`; a missing path is an error rather than literal article text. Markdown supports headings, links, ordered and unordered lists, block quotes, tables, fenced code, inline code, emphasis, and local inline images. Resolve relative image paths from the Markdown file. If the body contains images, skip explicit cover upload. Use `--no-cover` only when the body has no image and no cover is supplied. For explicitly authorized automatic publishing: ```bash python3 "$SKILL_DIR/scripts/run.py" publisher.py \ --mode auto \ --title "AI Trends 2026" \ --content-file "/absolute/path/article.md" \ --headless \ --json ``` Automatic publishing succeeds only after Toutiao displays a recognized success indicator. A final-button click without confirmation returns `publish_unconfirmed`. ## Result contract With `--json`, authentication commands write one JSON result to stdout. Publisher commands write newline-delimited JSON events; manual mode emits `awaiting_manual_review` before waiting for the user. - Exit `0`: authenticated, input valid, manual review completed, or publish confirmed. - Exit `1`: runtime, browser interaction, draft, upload, or publish failure. - Exit `2`: invalid input, missing authentication, or clear confirmation required. Treat stderr as human-readable diagnostics. Do not parse emojis or prose to determine success. ## Session management ```bash # Read local state only python3 "$SKILL_DIR/scripts/run.py" auth_manager.py status --json # Verify against Toutiao and refresh state python3 "$SKILL_DIR/scripts/run.py" auth_manager.py validate --json # Destructive: require explicit user confirmation first python3 "$SKILL_DIR/scripts/run.py" auth_manager.py clear --yes --json ``` ## Environment Require Python 3.9+, Google Chrome, and local network access. `scripts/run.py` bootstraps `scripts/setup_environment.py`, verifies the requirements fingerprint, and executes the target with the Skill-local `.venv` Python. The shared state directory uses owner-only permissions. Avoid starting concurrent browser operations against the same persistent Chrome Profile. Enable `--debug-screenshots` only when troubleshooting. Screenshots are written under `output/toutiao-publisher-debug/` by default.
© guanyang · MIT · guanyang/super-publisher