SuperAPI AI Directory

grok

Writing & research

View repository

Updated 10-16 08:46

About this skill

/grok — Claude calls Grok

The main battlefield is X (Twitter) public search and real-time discourse sampling. x mode must explicitly hand the task to Grok's X tool family:

  • x_keyword_search: exact keywords, account operators, dates, engagement thresholds, Top/Latest sorting
  • x_semantic_search: natural-language topics, fuzzy trends, opinion/sentiment sampling
  • x_user_search: user or account discovery
  • x_thread_fetch: context fetching for known post URLs/IDs/threads
  • web_search / open_page: fact-checking, media reports, third-party trend page supplementation

Secondary scenario: use Grok as an independent second opinion. Reuse the grok.com subscription, zero extra cost (vs. MCP solutions which require an xAI API key and pay per token).

Honest disclosure: this skill sends prompts through the Grok CLI and cannot, like the REST Responses API, enforce in the request body the declaration tools: [{type: "x_search"}]. What it can do is write tool selection, evidence fields, and output format into the prompt, so that Grok prioritizes using these X tools when the current runtime exposes them. It is not a firehose, and it cannot see DMs, private accounts, or individual-level likes/bookmarks.

All invocation logic (filesystem boundary, mode templates, timeouts, error handling, temp file cleanup) is consolidated in scripts/grok-call.sh a single script. This skill is only responsible for: identifying the mode → writing the query file → calling the script → relaying the result.

How to invoke (three steps, common to all modes)

  1. Use the Write toolto write the user's question verbatim into a temp file, such as /tmp/grok-q-<时间戳>.txt. Why use Write instead of a shell heredoc: if the user's question contains EOF、$, backticks,rm -rf characters like these, the heredoc will be truncated or trigger command injection. Write puts the question on disk as pure data, and the script then cat reads it in, with no shell parsing throughout, eliminating this problem at the root.

  2. Run the script,<mode> takes x / ask / continue:

    bash ~/.cc-switch/skills/grok/scripts/grok-call.sh <mode> /tmp/grok-q-<时间戳>.txt
    

    The script automatically assembles the filesystem boundary + the corresponding mode template + the user's question, calls grok (timeout 330s), and cleans up the temp file after running. It also has built-in pre-checks: exit code 3 if grok does not exist, 2 for wrong arguments, 124 for timeout.

  3. stdout is the grok reply,relay it to the user verbatim, do not summarize again or rewrite the style. Preserve @usernames, engagement data, and links. Wrap it in a layer using the format below:

    ━━━ Grok 回复 ━━━
    <grok stdout 原文>
    ━━━━━━━━━━━━━━━━
    

How to choose among the three modes

Parse the user input to decide <mode>, and when ambiguous use AskUserQuestion to confirm:

  • x(primary): when you need public X data, real-time feedback, sampling within a limited time window, an account's recent activity, or specific thread context. Triggers:/grok x, "on X ...", "on Twitter ...", "X hot topics/trends", "grok take a look at @someaccount", "scrape this X thread". The script template already enforces X tool selection, evidence links, post IDs, timestamps, engagement data, and limitation notes.
  • ask: general Q&A / second opinion, non-X scenarios. Triggers:/grok followed by an ordinary question, "grok second opinion", "consult grok". The script template opens up web search and asks grok to give an independent judgment, not to agree.
  • continue:Continue by asking a follow-up to the most recent grok conversation. Trigger: "继续问 grok", "接着问". The script includes -c, The query file only needs to contain the follow-up question. Note -c continues from the most recent session in the current working directory; across directories, a hit is not guaranteed.

Error handling (script exit codes)

  • 0 Success — stdout is the grok reply
  • 124 Timeout (5.5 minutes) — prompt the user to retry or simplify the question
  • 3 Environment error — grok is not installed (prompt to install at https://grok.com installation) or the query file is missing
  • 2 Parameter error — wrong mode or missing query file
  • Other — grok's own error code, stderr has the first two lines of diagnostics

The script writes diagnostic information to stderr and the body to stdout, so stdout is always clean body text.

When not to use this skill

  • Simply looking up code or modifying files → use Claude itself, don't detour through grok
  • Need multi-turn deep conversation (5+ rounds) → go directly into the grok TUI (run in terminal grok without parameters) is more convenient
  • Write X tweets → x-twitter-writer
  • Large-scale historical corpus scraping, bulk export, scheduled collection → x-sousuo
  • General web research, mainly papers/news/web pages → smart-research
  • If you only need to read local code or modify files → do it with Claude itself, don't detour through grok

Known limitations

  • Each call has a 3-5s cold start + X-scraping thinking time; a single call may take 30s-2min, which is normal
  • grok-build is a fixed model and does not support adjusting thinking depth (passing --effort will return 400, the script no longer passes it)
  • X search is public index sampling, not a full firehose
  • Exact X interaction counts (likes/views/reposts/replies/bookmarks) may be missing fields; when missing, this must be stated
  • X data cannot be used alone as a factual source; when making factual judgments, it must be cross-verified with web sources