--- name: x-openclaw description: Use this skill for all X or Twitter tasks in OpenClaw-style environments. Covers setup, authentication, safe command execution, reading timelines, tweets, users, search results, bookmarks, and write actions like post, reply, quote, like, retweet, follow, and bookmark. Prefer this skill when the user wants a single self-contained SKILL.md with no extra references or scripts. --- # X OpenClaw Skill Single-file X or Twitter skill for environments that only accept one `SKILL.md`. ## When To Use Use this skill whenever the user wants to: - read X timelines, bookmarks, tweets, replies, lists, or user profiles - search tweets, users, or topics - post, reply, quote, delete, like, retweet, bookmark, follow, or unfollow - operate through a terminal agent with minimal extra files ## Tool Assumption This skill assumes the machine can run the `twitter` CLI from `twitter-cli`. If `twitter` is missing, install it first: ```bash uv tool install twitter-cli ``` Upgrade when behavior looks stale or APIs changed: ```bash uv tool upgrade twitter-cli ``` ## Core Rule For Agents Before any real X action, verify auth first. Do not assume cookies are already available. ```bash twitter status --yaml >/dev/null && echo "AUTH_OK" || echo "AUTH_NEEDED" ``` If auth is missing, guide the user through one of these: ```bash twitter whoami TWITTER_BROWSER=chrome twitter whoami TWITTER_BROWSER=arc twitter whoami ``` If browser extraction is unavailable, use environment variables: ```bash export TWITTER_AUTH_TOKEN="" export TWITTER_CT0="" twitter whoami ``` Then verify: ```bash twitter status twitter whoami ``` ## Authentication Guidance Preferred order: 1. Browser cookie extraction 2. Explicit browser selection 3. Environment variables Common recovery: - no browser cookies found: ask the user to log into `x.com` in a supported browser, then retry - read works but write returns 226: full cookies are missing, prefer browser cookie extraction - `401` or `403`: cookies expired, re-login and retry - password changed: re-extract cookies Never ask the user to paste full cookie strings unless there is no safer option. ## Output Preference For agent workflows, prefer structured output: ```bash twitter feed --json twitter tweet "" --json twitter search "AI agent" --json ``` Useful rule: - use `--json` when piping into `jq` - use `--yaml` for readable structured output - use rich output only when the user wants human-readable terminal formatting - use `-c` for compact LLM-friendly output when token budget matters ## Safe Execution Rules - avoid bursty write actions - do not mass-like, mass-follow, or mass-reply without explicit user intent - prefer read-only commands first, then write actions after confirmation when the action is public or destructive - treat cookies and session state as secrets - re-check results after important write operations ## Command Cheatsheet ### Read ```bash twitter status twitter whoami twitter user "" twitter feed twitter feed -t following twitter bookmarks twitter search "关键词" twitter tweet "" twitter show 1 twitter list "" twitter user-posts "" twitter likes "" twitter followers "" twitter following "" ``` ### Write ```bash twitter post "正文" twitter post "正文" --image a.jpg twitter reply "" "回复内容" twitter quote "" "引用内容" twitter delete "" twitter like "" twitter unlike "" twitter retweet "" twitter unretweet "" twitter bookmark "" twitter unbookmark "" twitter follow "" twitter unfollow "" ``` ## Recommended Workflows ### Search then inspect ```bash twitter search "独立开发" --json twitter show 1 --json ``` ### Inspect a tweet thread and replies ```bash twitter tweet "" --json ``` ### Inspect a user before following ```bash twitter user "" --json twitter user-posts "" --json twitter follow "" ``` ### Post and verify ```bash twitter post "今天发布一个小更新" twitter user-posts "" --json ``` ## What This Skill Can Do Well - timeline and bookmark reading - tweet and reply inspection - creator and topic discovery - compact structured output for agent reasoning - normal posting and engagement workflows - single-file skill distribution for OpenClaw-like setups ## Known Limits - write actions are more sensitive than reads - incomplete cookies may allow reading but break posting - rate limits and risk controls may interrupt automation - some endpoints may change with platform updates ## Agent Decision Policy Follow this order: 1. Check auth 2. Prefer read-only commands to gather context 3. Use structured output when reasoning over results 4. Ask before public or destructive write actions unless the user already requested them clearly 5. Execute writes one by one 6. Re-check results after important actions ## Minimal Examples For OpenClaw ```bash # auth check twitter status # read home timeline twitter feed --json # read a tweet twitter tweet "https://x.com/user/status/1234567890" --json # search posts twitter search "AI 工具" --json # like and reply twitter like "" twitter reply "" "感谢分享" ``` This skill is intentionally self-contained. If the runtime supports only a single skill document, this file should be enough for normal X or Twitter agent operations.