interacting-with-x について
API 認証情報を使ってエージェントが X を操作するスキルです。スクリプトから投稿、タイムラインやメンションの取得、各種アクションを実行できます。
主な機能
- 01ツイートとスレッドの投稿
- 02投稿へのメディア添付
- 03タイムラインとメンションの取得
- 04ユーザーの投稿取得
- 05いいね、リツイート、フォロー
活用シーン
- 01エージェントから最新情報を投稿
- 02アカウントのタイムラインやメンションを確認
- 03Blueskyの内容をXへクロスポスト
- 04アカウントへのいいね、リツイート、フォロー
インストール
コマンドをコピーしてターミナルで実行します。
$
npx skills add https:/ / github.com/ just-cameron/ central --skill interacting-with-xインストール後、Claude Code で/interacting-with-xを入力して読み込まれたか確認します。
詳細
X とのやり取り
エージェントが X(Twitter)であらゆる操作を行えるようにします。
セットアップ
.env に追加します:
X_API_KEY=your_api_key
X_API_SECRET=your_api_secret
X_ACCESS_TOKEN=your_access_token
X_ACCESS_TOKEN_SECRET=your_access_token_secret
X_BEARER_TOKEN=your_bearer_token
認証情報は https://developer.x.com/en/portal/dashboard から取得します。
操作
ツイートを投稿する
# Simple tweet
uv run python .skills/interacting-with-x/scripts/post.py "Hello from Central"
# Thread (multiple tweets chained)
uv run python .skills/interacting-with-x/scripts/post.py --thread "First tweet" "Second tweet" "Third tweet"
# With media
uv run python .skills/interacting-with-x/scripts/post.py --media image.png "Tweet with image"
# Reply to existing tweet
uv run python .skills/interacting-with-x/scripts/post.py --reply-to 1234567890 "Reply text"
タイムライン/メンションを読む
# Home timeline
uv run python .skills/interacting-with-x/scripts/read.py timeline
# Mentions
uv run python .skills/interacting-with-x/scripts/read.py mentions
# User's tweets
uv run python .skills/interacting-with-x/scripts/read.py user elonmusk
# Search
uv run python .skills/interacting-with-x/scripts/read.py search "AI agents"
エンゲージする
# Like
uv run python .skills/interacting-with-x/scripts/engage.py like 1234567890
# Retweet
uv run python .skills/interacting-with-x/scripts/engage.py retweet 1234567890
# Follow/unfollow
uv run python .skills/interacting-with-x/scripts/engage.py follow username
uv run python .skills/interacting-with-x/scripts/engage.py unfollow username
レート制限
X API には厳しいレート制限があります。Pro プランでは緩和されますが、それでも以下の制限があります:
- 投稿:100件/24時間(Pro:500件/24時間)
- 読み取り:100リクエスト/15分
- いいね:50件/24時間
スクリプトがレート制限を自動的に処理します。詳細については references/api-reference.md を参照してください。
文字数制限
- 標準:280文字
- Pro:25,000文字
スクリプトがアカウントの種類を自動検出し、それに応じて処理します。
ATProto からのクロスポスト
Bluesky のコンテンツを X にミラーリングするには:
# In your code
from .skills.interacting_with_x.scripts import post
# After posting to Bluesky, cross-post to X
post.create_tweet(text) # or post.create_thread(texts) for threads
ファセット(メンション、リンク)は自動的に X の形式に変換されます。
コメント
Markdown 対応