Get the FREE Ultimate OpenClaw Setup Guide →

x-post

npx machina-cli add skill rameerez/claude-code-startup-skills/x-post --openclaw
Files (1)
SKILL.md
1.2 KB

Post to X using the CLI tool at ~/.claude/skills/x-post/x-post.py.

Setup

Requires Python packages: pip install xdk requests_oauthlib

Credentials file at ~/.claude/skills/x-post/x.key (JSON):

{
  "api_key": "...",
  "api_secret": "...",
  "access_token": "...",
  "access_token_secret": "..."
}

Commands

Post text:

python ~/.claude/skills/x-post/x-post.py post "Your tweet text"

Post with image:

python ~/.claude/skills/x-post/x-post.py post "Your tweet text" --media /path/to/image.jpg

Post with video:

python ~/.claude/skills/x-post/x-post.py post "Your tweet text" --media /path/to/video.mp4

Check profile:

python ~/.claude/skills/x-post/x-post.py me

Rules

  • Always show the user the exact tweet text before posting and get confirmation
  • Never post without explicit user approval
  • Video uploads use chunked upload (INIT/APPEND/FINALIZE) and may take a minute for processing
  • The script auto-detects media type from file extension

Source

git clone https://github.com/rameerez/claude-code-startup-skills/blob/main/skills/x-post/SKILL.mdView on GitHub

Overview

X-post lets you publish tweets from the command line using a dedicated CLI tool. It supports posting plain text, images, and videos, sourced from your local machine. A credentials file handles OAuth, and the tool prompts for exact tweet confirmation before posting.

How This Skill Works

The skill uses the Python script at ~/.claude/skills/x-post/x-post.py along with xdk and requests_oauthlib. It loads credentials from ~/.claude/skills/x-post/x.key and posts to X via the API. For videos it performs a chunked upload (INIT/APPEND/FINALIZE) and waits for processing, with a final user confirmation before posting.

When to Use It

  • Draft a tweet from the terminal
  • Attach and post an image via --media
  • Post a video from the CLI
  • Check your X profile from the CLI
  • Review the exact tweet text before posting

Quick Start

  1. Step 1: pip install xdk requests_oauthlib
  2. Step 2: Create credentials file at ~/.claude/skills/x-post/x.key with your API keys
  3. Step 3: Run a post command like python ~/.claude/skills/x-post/x-post.py post Your tweet text and confirm when prompted

Best Practices

  • Always show the exact tweet text and require user approval before posting
  • Rely on auto media type detection from the file extension
  • Use chunked upload for large videos and allow processing time
  • Keep the credentials file secure at ~/.claude/skills/x-post/x.key
  • Test with a small draft using the me command or a short text before posting

Example Use Cases

  • python ~/.claude/skills/x-post/x-post.py post Your tweet text
  • python ~/.claude/skills/x-post/x-post.py post Your tweet text --media /path/to/image.jpg
  • python ~/.claude/skills/x-post/x-post.py post Your tweet text --media /path/to/video.mp4
  • python ~/.claude/skills/x-post/x-post.py me
  • python ~/.claude/skills/x-post/x-post.py post Update: status

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers