x-post

x-post is a skill for Claude Code from anneheartrecord/charles-skill. It costs 145 tokens per session (1,124 once invoked), scanned A, original, MIT.

A command for publishing posts through the official X API, including replies and multi-post threads. It previews the text and estimated cost first, then requires explicit confirmation before publishing.

In plain words
What is it for?
Posting a single update, replying to a specific post, or publishing a longer thread. It can check API credentials, split long text, and place links in a thread reply according to its rules.
Why use it?
It prevents accidental public posts and helps catch length, link, credential, and permission problems before an API request is sent. The preview also shows how links affect the estimated charge.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: positional $N argument.

Part of the social-media-ops plugin — 8 skills shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/anneheartrecord/charles-skill/x-post
Any agent
npx skills add anneheartrecord/charles-skill --skill x-post
Clone the repo
git clone --depth 1 https://github.com/anneheartrecord/charles-skill

Made for: Claude Code.

Or install social-media-ops, the plugin that ships this one along with the rest of its 8 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for x-post

README.md
[![agentmods](https://agentmods.dev/badge/skills/anneheartrecord/charles-skill/x-post.svg)](https://agentmods.dev/skills/anneheartrecord/charles-skill/x-post)
Your own site
<a href="https://agentmods.dev/skills/anneheartrecord/charles-skill/x-post"><img src="https://agentmods.dev/badge/skills/anneheartrecord/charles-skill/x-post.svg" alt="Measured on agentmods" height="20"></a>
Per session 145 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,124 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00145 $0.01124
Opus 5 $0.00072 $0.00562
Sonnet 5 $0.00029 $0.00225
Haiku 4.5 $0.00015 $0.00112

Measured 5d ago against content hash 6388d2d05827, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

x-post scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

The scan reads SKILL.md. This mod also ships 3 executable files (scripts/post_tweet.py, scripts/split_thread.py, scripts/tests/test_split_thread.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/x-operation-skills/x-post/SKILL.md · 74 lines

What it actually says

X 发帖(官方 API)

把定稿内容通过官方 API 发到 X。核心原则:发布是不可逆的对外动作,永远先预览、后确认、再发布

前置条件

官方 API 的 OAuth 凭证,四个环境变量(developer.x.com → 项目 → Keys and tokens,Access Token 需勾选 Read and write;按惯例存 ~/.config/secrets/api-keys.env):

export X_API_KEY="..."
export X_API_SECRET="..."
export X_ACCESS_TOKEN="..."
export X_ACCESS_TOKEN_SECRET="..."

依赖:pip3 install tweepy。计费为预充值信用点、按请求扣费、无订阅。

先自检再用:python3 <skill目录>/scripts/post_tweet.py --check 验证凭证(缺变量/权限不足/过期会 FAIL 并给提示,不发帖)。⚠️ 发帖写路径尚未在真实凭证下端到端验证过(需用户配好凭证后自测一次首发);dry-run 预览与拆分逻辑已测。

工作流程(硬性顺序,不可跳步)

第 1 步:dry-run 预览

python3 <skill目录>/scripts/post_tweet.py --text "帖子内容"

输出内容、字数、预估费用。把预览结果原样给用户看,特别是:

  • 含链接的帖单价 $0.20,是纯文字($0.015)的 13 倍(X 刻意抑制外链)。检测到链接必须显式提醒,并建议备选:链接放到自回复里(主帖纯文字 $0.015 + 回复含链接 $0.20,总价不变但主帖曝光不受外链抑制)。
  • 超过 280 字符会发布失败,预览时先检查(中文按 2 字符计)。

第 2 步:等用户明确确认

**只有用户明确说「发」「确认发布」「就这条」等肯定指令才进入第 3 步。**以下情况一律不发:用户只是让你「生成/改一下/看看」;内容还是草稿阶段;用户没有对本次预览的具体内容表态。修改内容后必须重新 dry-run,不能拿旧确认发新内容。

第 3 步:发布

python3 <skill目录>/scripts/post_tweet.py --text "帖子内容" --yes

发 thread(长文自动拆分)

长文一条发不下时,用同仓 split_thread.py 拆:按句界切成 ≤270 加权长度(中文算 2),把所有链接归拢到末条自回复,这样整个 thread 只有末条付 $0.20,正文各条 $0.015。

python3 <仓库>/x-post/scripts/split_thread.py --file draft.md --number > thread-plan.json
python3 <skill目录>/scripts/post_tweet.py --thread-file thread-plan.json        # dry-run 预览
python3 <skill目录>/scripts/post_tweet.py --thread-file thread-plan.json --yes  # 确认后顺序发

注意:链接被抽到末条后,正文里原本「仓库在 <链接>」这类句子会留空档,拆分前把这类句子改成不依赖内联链接的说法(如「仓库和链接放在末条」)。dry-run 会显示每条正文、加权长度、预估总价,让用户确认整个 thread 再发。

第 4 步:回报结果

把返回的帖子 URL 给用户;发布记录(时间、内容、费用)追加到用户运营目录的发布日志(若有)。

判断规则(硬口径)

  • 没有 dry-run 过的内容绝不发布。
  • 一次确认只对应一次发布;批量发 thread 需要用户对整个 thread 文案确认过。
  • 发布失败(限流/凭证过期)时原样报错,不重试超过 1 次,不静默吞错。
  • 费用敏感:单次会话累计发帖费用预估超过 $1 时,汇总提醒用户。
Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 74 lines · 145 tokens per session scan A 6388d2d05827

Subscribe to this mod's changes

x-post is a skill published in the GitHub repository anneheartrecord/charles-skill (3 stars, last pushed 28d ago), licensed MIT. It adds 145 tokens to every session and 1,124 once invoked, about $0.0007 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

agent-recall

Persistent compounding memory for AI agents. 5 default MCP tools: sessionstart, sessionend, remember, recall, check. Full surface (18 tools) available with --full flag. Two-verb model: inhale (sessionstart) and exhale (sessionend). Correction-first memory with decision trail tracking, watchfor warnings, palace rooms…

Goldentrii/AgentRecall-X · 157 tokens

mykg-github-pages

Set up and maintain the GitHub Pages site for the mykg repo (SenolIsci/mykg) — a purpose-built pages/ folder (landing page adapted from README.md, blog posts, diagrams), built by a GitHub Actions workflow that runs Jekyll and deploys the result to a gh-pages branch. Use whenever the user wants to publish project…

SenolIsci/mykg · 228 tokens

networkx

Build, analyze, and visualize networks and graphs using NetworkX (Python). Use this skill whenever the user wants to: create graphs or networks, analyze graph properties, compute centrality measures, find shortest paths, detect communities, run graph algorithms, convert graphs to/from matrices or dataframes, visualize…

SenolIsci/mykg · 163 tokens

swarmvault

Use SwarmVault when the user needs a local-first knowledge vault that writes durable markdown, graph, search, dashboard, review, chat-session, context-pack, task-ledger, static AI export, retrieval, and MCP artifacts to disk from books, notes, transcripts, exports, datasets, slide decks, files, URLs, code, and…

swarmclawai/swarmvault · 76 tokens

engraph

Index and search document collections using hybrid semantic + graph + full-text search. Use when users need to search knowledge bases, find connections between documents, discover related content via link graphs, or query indexed markdown collections.

devwhodevs/engraph · 45 tokens

compiler

Scans knowledge/, analyzes documents, generates summaries/concepts/connections to wiki/ with reference graph. Updates existing articles instead of creating duplicates.

Yrzhe/pagefly · 30 tokens