agentleFS
Aias00Aias00/agent-skills/toutiao-publisher/SKILL.md

toutiao-publisher

Skill2 starsChanged 8 months agoApache-2.0View on GitHub

Publish articles to Toutiao (头条号) with persistent login. Supports one-time auth setup, pre-flight checks, EXTEND.md preferences, browser automation, and direct authenticated API publishing for title/content/cover flows.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

6 rules. About 0 are common, 4 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    If none exists and user asks for stable defaults, follow: references/config/first-time-setup.md

    line 44
  2. Distinctive:

    If check fails, provide specific fix items before continuing.

    line 89
  3. Very specific:

    If --content points to .html/.htm, the publisher uses that HTML directly.

    line 118
  4. Very specific:

    If --cover is omitted, the publisher will try nearby files like images/01-cover.*, images/cover.*, images/cover-wide.*, cover.*, or the …

    line 121
  5. Distinctive:

    Prefer the API publisher for direct article publishing because it uploads the cover and submits the final payload without relying on …

    line 122
  6. Distinctive:

    if failed: exact failed phase and suggested retry command

    line 171

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Toutiao Publisher

Language

Match the user's language for all prompts and completion reports.

Script Directory

Determine this SKILL.md directory as SKILL_DIR, and run scripts via:

python ${SKILL_DIR}/scripts/run.py <script.py> [args...]
ScriptPurpose
scripts/check_permissions.pyPre-flight environment checks
scripts/auth_manager.pyLogin setup/status/validate/clear
scripts/publisher.pyArticle publish automation
scripts/api_publisher.pyDirect article publish via authenticated in-page API
scripts/extend_config.pyEXTEND.md preference loading

When to Use

Trigger when user asks to:

  • publish article to Toutiao / 今日头条 / 头条号
  • setup or fix Toutiao login session
  • automate title/content/cover filling on Toutiao publish page
  • publish more reliably through the authenticated API path when browser autosave is unstable

Preferences (EXTEND.md)

Load optional preferences (priority order):

  1. Project-level: .baoyu-skills/toutiao-publisher/EXTEND.md
  2. User-level: ~/.baoyu-skills/toutiao-publisher/EXTEND.md

If none exists and user asks for stable defaults, follow: references/config/first-time-setup.md

Supported keys:

  • default_headless
  • default_no_cover
  • default_raw
  • default_debug_screenshots
  • default_wait_seconds
  • default_login_timeout_minutes
  • default_auth_headless

Boolean accepts 1/0, true/false, yes/no.

Value priority for publish/auth:

  1. CLI args
  2. EXTEND.md
  3. Script defaults

Workflow

Use this checklist:

Toutiao Publishing Progress:
- [ ] Step 0: Load EXTEND.md preferences
- [ ] Step 1: Run pre-flight checks
- [ ] Step 2: Ensure authentication is valid
- [ ] Step 3: Resolve publish params (title/content/cover)
- [ ] Step 4: Execute publish flow
- [ ] Step 5: Report result + next actions

Step 0: Load preferences

Scripts auto-load EXTEND.md. If found, mention the loaded file path.

Step 1: Pre-flight checks

python ${SKILL_DIR}/scripts/run.py check_permissions.py

If check fails, provide specific fix items before continuing.

Step 2: Authentication

First-time login:

python ${SKILL_DIR}/scripts/run.py auth_manager.py setup

Common management:

python ${SKILL_DIR}/scripts/run.py auth_manager.py status
python ${SKILL_DIR}/scripts/run.py auth_manager.py validate
python ${SKILL_DIR}/scripts/run.py auth_manager.py clear
python ${SKILL_DIR}/scripts/run.py auth_manager.py reauth

Step 3: Resolve publish params

Reference: references/article-posting.md

Rules:

  • Title is strongly recommended for automation success.
  • Title length is auto-adjusted to Toutiao constraints (2-30 chars).
  • --content accepts file path or inline text.
  • If --content points to .html/.htm, the publisher uses that HTML directly.
  • For generated article bundles, prefer article-toutiao.md over the generic article.md when both exist.
  • --cover is optional; --no-cover can force no-cover mode.
  • If --cover is omitted, the publisher will try nearby files like images/01-cover.*, images/cover.*, images/cover-wide.*, cover.*, or the first image under images/.
  • Prefer the API publisher for direct article publishing because it uploads the cover and submits the final payload without relying on front-end autosave.
  • The API publisher also uploads local inline images referenced from markdown/HTML and rewrites them to Toutiao-hosted image URLs before submit. This is the stable path when the article package contains local images/... assets.

Step 4: Publish

Recommended API path:

python ${SKILL_DIR}/scripts/run.py api_publisher.py --title "标题" --content article.md

Explicit cover:

python ${SKILL_DIR}/scripts/run.py api_publisher.py --title "标题" --content article.md --cover ./cover.png

Dry-run / payload inspection:

python ${SKILL_DIR}/scripts/run.py api_publisher.py --title "标题" --content article.md --dry-run

Legacy browser automation:

python ${SKILL_DIR}/scripts/run.py publisher.py --title "标题" --content article.md

Automated/headless:

python ${SKILL_DIR}/scripts/run.py publisher.py --title "标题" --content article.md --cover ./cover.png --headless

Troubleshooting mode:

python ${SKILL_DIR}/scripts/run.py publisher.py --title "标题" --content article.md --debug-screenshots --wait-seconds 30

Step 5: Completion report

Report:

  • input type/path
  • resolved options (headless, no_cover, raw)
  • auth state usage (existing/new login)
  • publish result (success/failure)
  • if failed: exact failed phase and suggested retry command

Security Notes

  • run.py blocks path traversal and only executes scripts inside scripts/.
  • Auth state is stored under skill data/ and permissions are restricted on POSIX.
  • Debug screenshots are disabled by default and only generated when explicitly enabled.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.