Dianel555/DSkills / skills/grok-search
grok-search
VerifiedEnhanced web search and real-time content retrieval via Grok API with forced tool routing. Use when: (1) Web search / information retrieval / fact-checking, (2) Webpage content extraction / URL parsing, (3) Breaking knowledge cutoff limits for current information, (4) Real-time news and technical documentation, (5) Multi-source information aggregation. Triggers: "search for", "find information about", "latest news", "current", "fetch webpage", "get content from URL". IMPORTANT: This skill REPLACES built-in WebSearch/WebFetch with Grok Search tools.
| File | Kind | Size |
|---|---|---|
| .env.example | other | 3.2 KB |
| README.md | markdown | 8.5 KB |
| SKILL.md | skill md | 6.6 KB |
| ruff.toml | config | 904 B |
| scripts/groksearch/__init__.py | script | 47 B |
| scripts/groksearch/cli.py | script | 5.0 KB |
| scripts/groksearch/commands.py | script | 9.1 KB |
| scripts/groksearch/config.py | script | 14.0 KB |
| scripts/groksearch/env.py | script | 1.4 KB |
| scripts/groksearch/formatting.py | script | 3.0 KB |
| scripts/groksearch/http.py | script | 2.9 KB |
| scripts/groksearch/prompts.py | script | 704 B |
| scripts/groksearch/provider.py | script | 5.7 KB |
| scripts/groksearch/tavily.py | script | 18.0 KB |
| scripts/groksearch_cli.py | script | 6.8 KB |
| scripts/tests/test_groksearch_cli.py | script | 62.8 KB |
| scripts/tests/test_retry_budget.py | script | 703 B |
scripts/groksearch/formatting.py
View on GitHubimport json
import re
import sys
def extract_json(text: str) -> str:
match = re.search(r"```(?:json)?\s*\n?([\s\S]*?)\n?```", text)
if match:
text = match.group(1).strip()
try:
data = json.loads(text)
if isinstance(data, list):
standardized = []
for item in data:
if isinstance(item, dict):
standardized.append(
{
"title": item.get("title", ""),
"url": item.get("url", item.get("link", "")),
"description": item.get(
"description",
item.get("content", item.get("snippet", item.get("summary", ""))),
),
}
)
return json.dumps(standardized, ensure_ascii=False, indent=2)
return json.dumps(data, ensure_ascii=False, indent=2)
except json.JSONDecodeError:
return json.dumps({"error": "Failed to parse JSON", "raw": text[:500]}, ensure_ascii=False, indent=2)
def merge_search_results(
grok_raw: str,
tavily_results: list[dict] | None,
tavily_requested: bool = False,
) -> list[dict]:
extracted = extract_json(grok_raw)
try:
grok_items = json.loads(extracted)
if not isinstance(grok_items, list):
grok_items = []
except json.JSONDecodeError:
grok_items = []
# Tavily reports credit usage as a non-result entry carrying only a "usage" key.
usage = None
if tavily_results:
for r in tavily_results:
if set(r) == {"usage"}:
usage = r["usage"]
tavily_results = [r for r in tavily_results if set(r) != {"usage"}]
seen_urls = {item.get("url", "").strip() for item in grok_items if item.get("url", "").strip()}
merged = list(grok_items)
if tavily_results:
for r in tavily_results:
url = r.get("url", "").strip()
if not url or url in seen_urls:
continue
seen_urls.add(url)
merged.append(
{
"title": r.get("title", ""),
"url": url,
"description": r.get("content", ""),
"provider": "tavily",
}
)
elif tavily_requested:
# Keep the top-level type a JSON array so list consumers are unaffected; disclose the
# degradation on the first item instead of injecting a synthetic pseudo-result.
print(
"WARNING: Tavily extra sources were requested but returned no results; output contains Grok sources only",
file=sys.stderr,
)
if merged:
merged[0]["degraded"] = "tavily_unavailable"
# Attach usage to the first item rather than adding an element, so the array stays
# a list of results for downstream consumers.
if usage and merged:
merged[0]["tavily_usage"] = usage
return merged
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-changelog-updatemorluto/reaPrepare or rewrite REA release changelogs and GitHub release notes from pinned Git history, with verified contributor thanks and Release Please synchronization. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| academy-guideanthropics/skillsStop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials, and use cases from Claude Academy (academy.claude.com), Anthropic's learning hub. Trigger on: "how do I", "how can I", "getting started with", "what can Claude do", "teach me", "learn to use"; questions about artifacts, projects, skills, plugins, connectors, MCP; requests about rolling Claude out to a team, class, or organization; and any ask for training materials, onboarding content, or learning resources. Use it when the user is learning how to use a feature or product — not when they are mid-task and just want the task done. This skill composes with other skills: after consulting product documentation to answer how a Claude feature works, also check here for a matching course or tutorial — a docs-grounded answer and an Academy recommendation belong together. Only recommend on a strong match; never invent Academy content. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| claude-apianthropics/skillsReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER — read BEFORE opening the target file; don't skip because it "looks like a one-liner" — whenever: the prompt names Claude/Anthropic in any form (Claude, Anthropic, Fable, Opus, Sonnet, Haiku, `anthropic`, `@anthropic-ai`, `claude-*`, `us.anthropic.*`, `[1m]`); the user asks about an LLM (pricing/model choice/limits/caching) — never answer from memory; OR the task is LLM-shaped with provider unstated (agent/MCP/tool-definition/multi-agent/RAG/LLM-judge/computer-use; generate/summarize/extract/classify/rewrite/converse over NL; debugging refusals/cutoffs/streaming/tool-calls/tokens). SKIP only when another provider is being worked on (overrides all triggers): OpenAI/GPT/Gemini/Llama/Mistral/Cohere/Ollama named in the query; OR `grep -rE 'openai|langchain_openai|google.generativeai|genai|mistralai|cohere|ollama'` over the project hits (run this grep FIRST if no provider named — don't Read the file). | Stars: 198k | Updated | Claude CodeCodex | Unverified | Install |
| doc-coauthoringanthropics/skillsGuide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision docs, or similar structured content. This workflow helps users efficiently transfer context, refine content through iteration, and verify the doc works for readers. Trigger when user mentions writing docs, creating proposals, drafting specs, or similar documentation tasks. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |