当前位置: 首页 > Skill >

xAI Plus

xAI Plus

2.0.2 2026.11.15 浏览:817
获取Skill文件查看使用说明
作者:陆宁许可证:
本文目录展开

xAI Skill

Search X (Twitter), search the web, chat with Grok models (including vision), and analyze X content patterns using xAI's API.

Features

  • X Search: Search posts, threads, and accounts with date/handle filters
  • Web Search: Search the web via Grok's web_search tool
  • Chat: Text and vision (image analysis) with Grok models
  • Analysis: Voice patterns, trend research, post safety checks
  • Models: List available xAI models

Setup

API Key

Get your xAI API key from console.x.ai.

# Via clawdbot config (recommended)
clawdbot config set skills.entries.xai-plus.apiKey "xai-YOUR-KEY"

# Or environment variable
export XAI_API_KEY="xai-YOUR-KEY"

The scripts check these locations in order:

  1. XAI_API_KEY env var
  2. ~/.clawdbot/clawdbot.json → env.XAI_API_KEY
  3. ~/.clawdbot/clawdbot.json → skills.entries.xai-plus.apiKey
  4. ~/.clawdbot/clawdbot.json → skills.entries["grok-search"].apiKey (fallback)

Default Model (Optional)

Override the default model (grok-4-1-fast):

# Via config
clawdbot config set skills.entries.xai-plus.model "grok-3"

# Or environment variable
export XAI_MODEL="grok-3"

Model priority:

  1. Command-line --model flag (highest priority)
  2. XAI_MODEL env var
  3. ~/.clawdbot/clawdbot.json → env.XAI_MODEL
  4. ~/.clawdbot/clawdbot.json → skills.entries.xai-plus.model
  5. Default: grok-4-1-fast

Search

X Search

Search X posts and threads with optional filters.

Basic search:

node {baseDir}/scripts/grok_search.mjs "query" --x

With date filter:

# Last 7 days
node {baseDir}/scripts/grok_search.mjs "Claude AI" --x --days 7

# Specific date range
node {baseDir}/scripts/grok_search.mjs "AI agents" --x --from 2026-01-01 --to 2026-01-31

Filter by handles:

# Only from specific accounts
node {baseDir}/scripts/grok_search.mjs "AI news" --x --handles @AnthropicAI,@OpenAI

# Exclude accounts
node {baseDir}/scripts/grok_search.mjs "GPT" --x --exclude @spam1,@spam2

Output formats:

# JSON (default, agent-friendly)
node {baseDir}/scripts/grok_search.mjs "query" --x

# Links only
node {baseDir}/scripts/grok_search.mjs "query" --x --links-only

# Human-readable text
node {baseDir}/scripts/grok_search.mjs "query" --x --text

JSON output schema:

{
  "query": "search query",
  "mode": "x",
  "results": [
    {
      "title": "@handle",
      "url": "https://x.com/handle/status/123",
      "snippet": "Post text...",
      "author": "@handle",
      "posted_at": "2026-01-15T10:30:00Z"
    }
  ],
  "citations": ["https://x.com/..."]
}

Web Search

Search the web via Grok.

node {baseDir}/scripts/grok_search.mjs "TypeScript best practices 2026" --web

JSON output schema:

{
  "query": "search query",
  "mode": "web",
  "results": [
    {
      "title": "Page title",
      "url": "https://example.com/page",
      "snippet": "Description...",
      "author": null,
      "posted_at": null
    }
  ],
  "citations": ["https://example.com/..."]
}

Search Options

Flag Description Example
--x Search X/Twitter Required for X search
--web Search the web Required for web search
--days N Last N days (X only) --days 7
--from YYYY-MM-DD Start date (X only) --from 2026-01-01
--to YYYY-MM-DD End date (X only) --to 2026-01-31
--handles a,b Only these accounts (X only) --handles @user1,@user2
--exclude a,b Exclude accounts (X only) --exclude @spam
--max N Max results --max 20
--model ID Override model --model grok-3
--json JSON output (default) -
--links-only Just URLs -
--text Human-readable -
--raw Include debug output -

See references/search-patterns.md for advanced query patterns and optimization tips.

Chat

Text Chat

Ask Grok anything.

node {baseDir}/scripts/chat.mjs "What is quantum computing?"

With model override:

node {baseDir}/scripts/chat.mjs --model grok-3 "Explain transformers in ML"

JSON output:

node {baseDir}/scripts/chat.mjs --json "What is TypeScript?"

JSON schema:

{
  "model": "grok-4-1-fast",
  "prompt": "What is TypeScript?",
  "text": "TypeScript is...",
  "citations": ["https://..."]
}

Vision Chat

Analyze images with Grok.

node {baseDir}/scripts/chat.mjs --image ./screenshot.png "What's in this image?"

Multiple images:

node {baseDir}/scripts/chat.mjs --image ./pic1.jpg --image ./pic2.jpg "Compare these"

Supported formats: JPG, PNG, WebP, GIF

Chat Options

Flag Description Example
--model ID Model to use --model grok-2-vision-1212
--image PATH Attach image (can repeat) --image ./pic.jpg
--json JSON output -
--raw Include debug output -

See references/models.md for model comparison and capabilities.

Analysis

Analyze X content for voice patterns, trends, and post quality.

Voice Analysis

Analyze an account's voice and writing patterns.

node {baseDir}/scripts/analyze.mjs voice @username

Custom date range:

# Last 60 days
node {baseDir}/scripts/analyze.mjs voice @username --days 60

JSON output schema:

{
  "handle": "@username",
  "analyzed_posts": 150,
  "voice": {
    "tone": "casual, technical",
    "personality": ["curious", "direct", "helpful"],
    "perspective": "practitioner sharing lessons",
    "energy_level": "medium"
  },
  "patterns": {
    "sentence_structure": ["short declarative", "occasional fragments"],
    "vocabulary": ["technical", "accessible"],
    "formatting_quirks": ["line breaks for emphasis", "minimal punctuation"],
    "recurring_phrases": ["here's the thing", "turns out"]
  },
  "topics": ["AI", "software engineering", "startups"],
  "best_posts": [
    {
      "url": "https://x.com/username/status/123",
      "text": "Post text...",
      "why": "Authentic voice, specific example"
    }
  ],
  "anti_patterns": ["never uses em-dashes", "avoids numbered lists"]
}

Trend Research

Research trends and discussions about a topic.

node {baseDir}/scripts/analyze.mjs trends "AI agents"

JSON output schema:

{
  "topic": "AI agents",
  "trends": [
    {
      "pattern": "Shift from chatbots to autonomous agents",
      "description": "Discussion focuses on...",
      "example_posts": ["https://x.com/..."]
    }
  ],
  "perspectives": [
    {
      "viewpoint": "Agents will replace most SaaS",
      "supporters": ["@user1", "@user2"]
    }
  ],
  "hashtags": ["#AIAgents", "#AutonomousAI"],
  "key_accounts": ["@researcher1", "@founder2"],
  "posting_angles": [
    {
      "angle": "Practical implementation challenges",
      "hook": "Everyone talks about AI agents. Nobody talks about...",
      "target_audience": "Engineers building with AI"
    }
  ]
}

Post Safety Check

Check a draft post or existing post for AI signals and platform flag patterns.

Check draft text:

node {baseDir}/scripts/analyze.mjs post "Your draft post text here"

Check existing post:

node {baseDir}/scripts/analyze.mjs post --url "https://x.com/user/status/123"

JSON output schema:

{
  "post_text": "Your post...",
  "ai_detection_score": 3,
  "ai_signals": [
    "Contains em-dash",
    "Ends with engagement bait question"
  ],
  "platform_flag_score": 2,
  "platform_risks": [
    "Generic question could trigger spam filter"
  ],
  "quality_score": 7,
  "suggestions": [
    "Replace em-dash with period or comma",
    "Remove 'What do you think?' closer",
    "Add specific personal detail"
  ]
}

Scoring:

  • AI Detection: 0-10 (10 = definitely AI)
  • Platform Flag Risk: 0-10 (10 = high spam risk)
  • Quality: 0-10 (10 = excellent)

Analysis Options

Flag Description Example
--days N Date range for analysis --days 60
--url URL Analyze existing post --url https://x.com/...
--model ID Override model --model grok-3
--json JSON output -
--raw Include debug output -

See references/analysis-prompts.md for detailed prompt structures and scoring criteria.

Models

List available xAI models.

node {baseDir}/scripts/models.mjs

Output:

grok-2-vision-1212
grok-3
grok-4-1-fast
grok-4-fast

JSON output:

node {baseDir}/scripts/models.mjs --json

Quick model comparison:

Model Speed Quality Vision Best For
grok-4-1-fast Fast Good No Default (search, chat, analysis)
grok-4-fast Fast Good No Alternative fast model
grok-3 Slower Best No Complex reasoning, detailed analysis
grok-2-vision-1212 Medium Good Yes Image analysis

See references/models.md for detailed model capabilities and use cases.

Advanced Usage

Citation Deduplication

For X searches, the tool automatically deduplicates tweet URLs, preferring canonical /@handle/status/id over /i/status/id format.

Custom Model Selection

Override the default model for any operation:

# Search with grok-3 for better quality
node {baseDir}/scripts/grok_search.mjs "complex query" --x --model grok-3

# Chat with vision model
node {baseDir}/scripts/chat.mjs --model grok-2-vision-1212 --image pic.jpg "Describe"

# Analysis with grok-3 for deeper insights
node {baseDir}/scripts/analyze.mjs voice @username --model grok-3

Debugging

Add --raw to any command to see the full API response:

node {baseDir}/scripts/grok_search.mjs "query" --x --raw

Reference Documentation

  • API Reference - xAI API endpoints and parameters
  • Search Patterns - Query patterns, filters, optimization tips
  • Models - Model comparison and capabilities
  • Analysis Prompts - Structured prompts and scoring criteria
  • X Algorithm - Ranking, engagement weights, spam detection

Examples

Research a topic

# Find recent discussions
node {baseDir}/scripts/grok_search.mjs "Claude Sonnet 4.5" --x --days 3

# Get trend analysis
node {baseDir}/scripts/analyze.mjs trends "Claude Sonnet 4.5"

Analyze voice before drafting

# Study the target account
node {baseDir}/scripts/analyze.mjs voice @target_account --days 30

# Check your draft
node {baseDir}/scripts/analyze.mjs post "Your draft here"

Multi-modal research

# Search web for context
node {baseDir}/scripts/grok_search.mjs "TypeScript 5.7 features" --web

# Ask follow-up
node {baseDir}/scripts/chat.mjs "What are the key TypeScript 5.7 improvements?"

# Analyze screenshot
node {baseDir}/scripts/chat.mjs --image ./code.png "Review this code"

Error Handling

Common errors and solutions:

Missing API key:

Missing XAI_API_KEY

→ Set XAI_API_KEY environment variable or add to ~/.clawdbot/clawdbot.json

Invalid mode:

Must specify --web or --x

→ Add --web or --x flag to search command

Image format error:

Unsupported image type

→ Use JPG, PNG, WebP, or GIF format

API error:

xAI API error: 401 Unauthorized

→ Check API key is valid and active

Tips

  • Default model (grok-4-1-fast) is fast and good for most tasks
  • Use grok-3 for complex analysis or when quality matters more than speed
  • X searches are limited by recency (xAI x_search tool constraints)
  • Web searches work best with specific, current queries
  • Voice analysis needs sufficient post history (30+ posts recommended)
  • Post safety checks are advisory; use judgment for final decisions
  • JSON output is best for agent/script consumption
  • Text output is better for terminal/human reading

Troubleshooting

No results from X search:

  • Try broader query or longer date range
  • Check if handles exist and are public
  • Remove overly restrictive filters

Voice analysis incomplete:

  • Increase --days to get more post history
  • Check if account is public and active
  • Verify handle is correct (with or without @)

API rate limits:

  • xAI enforces rate limits per API key
  • Spread requests over time if hitting limits
  • Consider upgrading xAI plan for higher limits

Content Writing Workflow

Use the analysis tools to improve your X content:

# Research before writing
node {baseDir}/scripts/analyze.mjs trends "your topic"
node {baseDir}/scripts/grok_search.mjs "your topic" --x --days 7

# Study voice patterns
node {baseDir}/scripts/analyze.mjs voice @target_account

# Check draft before posting
node {baseDir}/scripts/analyze.mjs post "$(cat draft.txt)"

Use the JSON output to:

  • Research current discussions and posting angles
  • Learn from successful voices in your niche
  • Catch AI signals and platform flags before publishing

推荐文章

更多
PHP时间戳与日期字符串相互转换方法详解

本文介绍PHP中时间数值(Unix时间戳)与日期字符串之间的相互转换方法。通过strtotime和date函数,实现将当前时间、指定日期转换为时间戳,以及将时间戳格式化为可读的日期时间字符串,并提供相关在线计算工具推荐。

2025.11.30 1,031
PHP日期转时间戳时区偏差怎么解决

在 PHP 中将日期字符串转换为时间戳时,若未显式指定时区,默认使用脚本配置的 date.timezone 或系统时区。当服务器时区与业务逻辑预期(如 UTC )不一致时,会产生偏差。解决核心是确保输入字符串携带明确时区信息,或在转换前统一设置时区上下文。

2026.10.24 1,029
PHP跨域配置:怎么安全地允许指定域名而非使用通配符

在 PHP 中安全地允许指定域名跨域,核心是解析请求头中的 Origin ,验证其是否在白名单内,然后动态设置 Access-Control-Allow-Origin 响应头。不要使用通配符 * ,也不要硬编码单一域名。

2025.03.29 1,017
JavaScript中利用replace结合正则实现replaceAll效果

JavaScript原生仅支持replace()进行单次或全局替换,缺乏类似Java的replaceAll()便捷方法。本文总结四种在JS中实现全量替换的方案:使用带g标志的正则、带gm标志的正则、扩展String原型以及split后join。通过对比代码示例,展示各方法的实现细节与适用场景,帮助开发者根据需求选择最优解。

2025.04.29 1,014
OpenAI的Jalapeno芯片未落地,教你分辨300兆瓦算力消息

OpenAI计划在SB Energy租赁的数据中心部署约300兆瓦自研Jalapeno推理芯片,但目前双方仍处于洽谈阶段,交易细节与上线时间表均未公布。本文带你按报道原文核实项目所处阶段,厘清芯片发布、电力功率与实际推理算力的边界,并将融资意向与签约、开工、投运节点分开追踪,避免误将规划容量计入现有算力。

2026.12.02 1,011
PHP实现基础文件上传:HTML表单与$_FILES处理流程

在 HTML 表单中设置 enctype="multipart/form-data" ,并在 PHP 后端通过 $_FILES 数组接收文件,调用 move_uploaded_file() 将临时文件移动到目标目录即可完成上传。

2026.09.07 1,011
Skill 文件
  • SKILL.md
    • xAI Skill
    • Features
    • Setup
      • API Key
      • Default Model (Optional)
    • Search
      • X Search
      • Web Search
      • Search Options
    • Chat
      • Text Chat
      • Vision Chat
      • Chat Options
    • Analysis
      • Voice Analysis
      • Trend Research
      • Post Safety Check
      • Analysis Options
    • Models
    • Advanced Usage
      • Citation Deduplication
      • Custom Model Selection
      • Debugging
    • Reference Documentation
    • Examples
      • Research a topic
      • Analyze voice before drafting
      • Multi-modal research
    • Error Handling
    • Tips
    • Troubleshooting
    • Content Writing Workflow
  • 项目或源文件

相关 Skill

更多
FlowSearch — Deep Web Research via Claude Native Search FlowSearch — Deep Web Research via Claude Native Search 使用 Claude 原生搜索工具进行深度网络研究。适用于全面研究、市场分析、竞品情报或标准搜索不足的场景。
Web Research Web Research 高效研究,避免token浪费;严格分类,少量获取;判断何时搜索、何时获取、何时放弃。
X Search X Search 使用 xAI API 搜索 X (Twitter) 帖子。适用于查找推文、搜索 X/Twitter 或查看社交媒体内容。
一个图片开始写文章 一个图片开始写文章 Logic Thinking Speaker in Luo Zhenyu Style. Use when user provides text or images and needs deep, multi-angle, scenario-based logical analysis. Features: 10+ minute speech, first-person narrative style, web research for materials, output to desktop for WeChat public account.
Moss Deep Search Moss Deep Search Deep web research using LLM + multiple search rounds. Use when user needs comprehensive analysis, detailed research, or says "deep search", "详细搜索", "深入调查".