agentleFS
muneebhashonemuneebhashone/x-search-tool/skills/x-search/SKILL.md

x-search

Skill0 starsChanged 6 months agoMITView on GitHub

Use when the task needs sources from X/Twitter — real-time posts, threads, reactions, what people are saying right now — and fresh general-web context only as a fallback. Triggers on "on X", "on Twitter", "what's trending", "latest reactions to", "replies to", "who said", "recent posts about", or any query where X is the primary index and stale training data would mislead. Returns cited JSON.

  • Reads credentials
  • Installs packages

7 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions7 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 7

    1. glidea/supersearch-skills★ 4same name
    2. lleqsnoom/xskills★ 2same name
    3. arch3rPro/ark-space★ 1same name
    4. jeroromano/claude-code-orchestration-template★ 1same name
    5. schroneko/skills★ 1same name
    6. lloyd3126/chenchungnien-skills★ 0same name
    7. trapple/skills★ 0same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

The file

We split this skill into the rules it gives an agent

6 rules. 0 are common, 1 is distinctive, and 5 are very specific to this project.

  • 0

    Common

    Most of the 5 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Not on npm. The x-search binary must already be on PATH — if it isn't, ask the user to follow the project README (clone + npm install && …

    line 12
  2. Distinctive:

    No route flag, no other flags for agents.

    line 20
  3. Very specific:

    Don't double-shell-quote: If your query contains double quotes, wrap it in single quotes: x-search search 'site:example.com "claude opus"' …

    line 68
  4. Very specific:

    answer === "No results." is a real terminal state: Don't retry the same query.

    line 70
  5. Very specific:

    --pretty output is not machine-stable: Never invoke with --pretty from another agent or pipeline — parse the default JSON.

    line 71
  6. Very specific:

    If $? is non-zero, the JSON is an error envelope — parse .error.code to branch (bad_args → fix call, missing_api_key → set env var, …

    line 106

“Common” is measured: kept by at least 6 in 10 of the 5 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

x-search

A CLI (x-search) that forces Grok to run an X-first search and return cited JSON. One call hands the model two tools — x_search (X/Twitter, primary) and web_search (general web, fallback) — and the model is instructed to prefer X and only reach for the web when X is insufficient. Use it when value comes from the X index or from an LLM-synthesized answer with citations rather than raw URLs.

Install

Not on npm. The x-search binary must already be on PATH — if it isn't, ask the user to follow the project README (clone + npm install && npm run build && npm link).

Call

x-search search "<query>"

No route flag, no other flags for agents. The single search is always X-first with web fallback. Everything (model selection, token caps, timeout, caching, parallelism) is baked in at the cost/cache/efficiency-optimal default — do not look for knobs, there aren't any.

Pass --pretty only when output is going to a human. Default JSON is the stable contract; --pretty is not.

Output (compact JSON, one line on stdout)

{
  "query": "...",
  "results": [
    {"url": "...", "title": "...", "snippet": "...", "date": "2026-05-22", "source": "x"}
  ],
  "answer": "<1–3 sentence synthesis grounded in results>",
  "citations": [{"url": "...", "quote": "..."}],
  "cost_usd": 0.0021
}
FieldMeaning
results[]Raw hits in the order the model encountered them. Each carries source: "x" (from X/Twitter) or source: "web" (from the web-search fallback)
answerShort synthesis. Will be exactly "No results." if the search came up empty
citations[]URLs (+ short quote) that the answer drew from
cost_usdActual call cost. Estimate computed locally from a pricing table — treat as approximate if providers change prices

Required env

VarUsed for
XAI_API_KEYthe single Grok call (x_search + web_search)

Pass directly; do not rely on a .env file unless you explicitly set XSEARCH_DOTENV=1 first.

Exit codes

CodeMeaning
0OK
2Bad args (missing/empty query)
3Missing API key
4Provider error (network, HTTP error, rate limit)

On non-zero exit, stdout contains {"error":{"code":"...","message":"...","provider":"..."}}.

Gotchas

  • Always pays for one LLM round-trip. Even when you only want URLs, the model is forced to call its search tool and emit a synthesis. There's no "URLs-only" mode. Don't use x-search if you just need a generic web lookup and an LLM in the loop is overkill.
  • X-first, not web-first. The model prioritizes x_search. If your query is really a generic web lookup with no X angle, expect mostly source: "web" results — and consider whether a plain web search would serve you better.
  • Don't double-shell-quote. If your query contains double quotes, wrap it in single quotes: x-search search 'site:example.com "claude opus"' — not nested doubles.
  • X results return x.com URLs. They're typically x.com/<user>/status/<id>. External links inside posts are not separately enumerated — they appear inline in snippet.
  • answer === "No results." is a real terminal state. Don't retry the same query; rephrase.
  • --pretty output is not machine-stable. Never invoke with --pretty from another agent or pipeline — parse the default JSON.
  • No --route, --full, --cost, --timeout, --model, --max-tokens, etc. exist. Don't pass them; cac will reject the invocation. The defaults are deliberate.

When NOT to use

  • Query is answerable from training data (definitions, math, well-known general knowledge older than ~6 months).
  • You need a non-search action (file edits, code generation, shell ops, calculations).
  • You need raw URLs and no LLM synthesis — x-search always burns an LLM round-trip.
  • The user wants Reddit / HN / Stack Overflow specifically — use a dedicated skill (reddit-search, hn-search) if available.

Examples

# What people on X are saying about a release
x-search search "reactions to Claude 4.7 release on X"

# Real-time replies in a Twitter thread
x-search search "replies to elonmusk latest tweet about Grok"

# X-first, but the model may fall back to web docs if X is thin
x-search search "what people are saying about the B200 release notes"

Recipe: parse the JSON

result=$(x-search search "reactions to Claude 4.7 on X")

echo "$result" | jq -r '.answer'                  # the synthesis
echo "$result" | jq -r '.results[].url'           # all source URLs
echo "$result" | jq -r '.results[] | select(.source=="x") | .url'   # X-only hits
echo "$result" | jq -r '.citations[].url'         # only URLs the answer cited
echo "$result" | jq -r '.cost_usd'                # log to your budget tracker

If $? is non-zero, the JSON is an error envelope — parse .error.code to branch (bad_args → fix call, missing_api_key → set env var, provider_error → retry).

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.