home / skills / shunsukehayashi / miyabi-claude-plugins / xai-account-ops

xai-account-ops skill

/miyabi-skills/xai-account-ops

This skill helps automate X account analysis, trend discovery, competitor comparison, and improvement suggestions using xAI Grok-4 API.

npx playbooks add skill shunsukehayashi/miyabi-claude-plugins --skill xai-account-ops

Review the files below or copy the command above to add this skill to your agents.

Files (13)
skill.md
1.7 KB
---
name: xai-account-ops
description: xAI APIを使ったXアカウント運用支援スキル。アカウント分析、トレンド検索、競合分析、改善提案を自動化。
---

# xAI Account Operations スキル

## 概要

xAI API(Grok-4)を使ったX(Twitter)アカウント運用支援スキルです。

## 機能

### 1. アカウント分析 (`analyze`)
特定アカウントの最新投稿を分析し、エンゲージメント傾向を把握します。

```bash
./run.sh analyze The_AGI_WAY
```

### 2. トレンド検索 (`trend`)
キーワードでバズっている投稿を検索します。

```bash
./run.sh trend "Claude Code"
```

### 3. 競合分析 (`competitor`)
複数アカウントを比較分析します。

```bash
./run.sh competitor "satori_sz9,ai_and_and"
```

### 4. 改善提案 (`suggest`)
アカウントデータに基づく改善提案を生成します。

```bash
./run.sh suggest The_AGI_WAY
```

## API設定

| 項目 | 値 |
|------|-----|
| Base URL | `https://api.x.ai/v1/` |
| Model | `grok-4-fast` |
| Endpoint | `/v1/responses` (X Search) |
| API Key | `$XAI_API_KEY` 環境変数 |

## 使用例

### アカウント分析
```bash
source ~/.config/claude-env/tokens.conf
./run.sh analyze The_AGI_WAY
```

### トレンド検索(期間指定)
```bash
./run.sh trend "Claude Code" "2026-02-01T00:00:00Z" "2026-02-19T23:59:59Z"
```

## 出力先

分析結果は `outputs/xai-account-ops/` に保存されます。

## 依存関係

- `curl` - APIリクエスト
- `jq` - JSON処理

## 注意事項

- APIキーは環境変数 `XAI_API_KEY` で管理
- X Searchコスト: ~$0.005/回 + トークン代
- レート制限に注意(アカウントプランによる)

Overview

This skill automates X (Twitter) account operations using the xAI Grok-4 API. It streamlines account analysis, trend discovery, competitor comparisons, and data-driven improvement suggestions. Outputs are saved locally for review and further processing.

How this skill works

The skill calls the xAI API (grok-4-fast) to fetch and analyze recent posts, search for trending content by keyword and time window, and compare multiple accounts. Commands wrap curl and jq to request X Search endpoints, parse JSON responses, and write human-readable reports to outputs/xai-account-ops/. Authentication relies on the XAI_API_KEY environment variable and respects rate and cost considerations.

When to use it

  • When you need regular engagement analysis for a single X account.
  • To discover viral or rising posts around specific keywords or time ranges.
  • When benchmarking multiple accounts or competitors for content strategy.
  • To generate concrete, data-backed improvement suggestions for posting and timing.
  • When automating report generation for social media managers or small teams.

Best practices

  • Store XAI_API_KEY securely as an environment variable, not in scripts.
  • Limit query frequency to avoid rate limits and control X Search costs.
  • Use specific date ranges for trend queries to reduce noise and API usage.
  • Post-process saved JSON outputs with jq or custom scripts to integrate into dashboards.
  • Combine competitor comparisons with manual review to validate automated findings.

Example use cases

  • Run ./run.sh analyze <handle> to get engagement trends and top-performing posts for a brand account.
  • Use ./run.sh trend "keyword" "start_time" "end_time" to find recent viral posts for a campaign idea.
  • Execute ./run.sh competitor "acct1,acct2" to produce side-by-side metrics for competitive analysis.
  • Call ./run.sh suggest <handle> to receive tailored content and timing recommendations.
  • Schedule periodic runs to populate outputs/xai-account-ops/ for trend tracking and monthly reporting.

FAQ

What API key is required and how is it provided?

Set your xAI API key in the XAI_API_KEY environment variable before running commands (for example, source a secure tokens file).

Where are results stored and what tools are needed to view them?

Results are saved under outputs/xai-account-ops/. Use jq, less, or import the JSON into spreadsheets or dashboards for inspection.