$npx -y skills add Dianel555/DSkills --skill grok-searchEnhanced 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 n
| 1 | # Grok Search |
| 2 | |
| 3 | Enhanced web search via Grok API. Standalone CLI only (no MCP dependency). |
| 4 | |
| 5 | ## Implementation Layout |
| 6 | |
| 7 | - `scripts/groksearch_cli.py` - CLI entrypoint and compatibility facade |
| 8 | - `scripts/groksearch/` - internal modules for config, HTTP retry, Grok provider, Tavily calls, formatting, and commands |
| 9 | |
| 10 | ## Execution Methods |
| 11 | |
| 12 | Run `scripts/groksearch_cli.py` via Bash: |
| 13 | |
| 14 | ```bash |
| 15 | # Prerequisites: pip install httpx tenacity |
| 16 | # Environment: GROK_API_URL, GROK_API_KEY (required); TAVILY_API_KEY (optional) |
| 17 | |
| 18 | # Web search (Grok only) |
| 19 | python scripts/groksearch_cli.py web_search --query "search terms" [--platform "GitHub"] [--min-results 3] [--max-results 10] |
| 20 | |
| 21 | # Web search with Tavily extra sources (parallel + URL-deduplicated merge) |
| 22 | python scripts/groksearch_cli.py web_search --query "..." --extra-sources 5 |
| 23 | |
| 24 | # Fetch webpage (default: Grok) |
| 25 | python scripts/groksearch_cli.py web_fetch --url "https://..." [--out file.md] |
| 26 | |
| 27 | # Fetch via Tavily extract endpoint |
| 28 | python scripts/groksearch_cli.py web_fetch --url "https://..." --via tavily |
| 29 | |
| 30 | # Map a website's structure (Tavily) |
| 31 | python scripts/groksearch_cli.py web_map --url "https://docs.example.com" [--instructions "API only"] [--max-depth 2] [--max-breadth 20] [--limit 50] [--timeout 150] |
| 32 | |
| 33 | # Check config |
| 34 | python scripts/groksearch_cli.py get_config_info [--no-test] |
| 35 | |
| 36 | # Switch model |
| 37 | python scripts/groksearch_cli.py switch_model --model "grok-2-latest" |
| 38 | |
| 39 | # Toggle built-in tools |
| 40 | python scripts/groksearch_cli.py toggle_builtin_tools --action on|off|status [--root /path/to/project] |
| 41 | ``` |
| 42 | |
| 43 | ## Tool Routing Policy |
| 44 | |
| 45 | ### Forced Replacement Rules |
| 46 | |
| 47 | | Scenario | Disabled | Force Use | |
| 48 | |----------|----------|-----------| |
| 49 | | Web Search | `WebSearch` | CLI `web_search` | |
| 50 | | Web Fetch | `WebFetch` | CLI `web_fetch` | |
| 51 | |
| 52 | ### Tool Capability Matrix |
| 53 | |
| 54 | | Tool | Parameters | Output | |
| 55 | |------|------------|--------| |
| 56 | | `web_search` | `query`(required), `platform`/`min_results`/`max_results`(optional), `extra_sources`(int, 0=disabled) | `[{title,url,description,provider?}]` | |
| 57 | | `web_fetch` | `url`(required), `out`(optional), `via`(grok\|tavily, default grok) | Structured Markdown | |
| 58 | | `web_map` | `url`(required), `instructions`/`max_depth`/`max_breadth`/`limit`/`timeout`(optional) | `{base_url,results,response_time}` JSON | |
| 59 | | `get_config_info` | `no_test`(optional) | `{api_url,status,connection_test,tavily_*}` | |
| 60 | | `switch_model` | `model`(required) | `{previous_model,current_model}` | |
| 61 | | `toggle_builtin_tools` | `action`(on/off/status), `root`(optional) | `{blocked,deny_list}` | |
| 62 | |
| 63 | ## Search Workflow |
| 64 | |
| 65 | ### Phase 1: Query Construction |
| 66 | - **Intent Recognition**: Broad search → `web_search` | Deep retrieval → `web_fetch` |
| 67 | - **Parameter Optimization**: Set `platform` for specific sources, adjust result counts |
| 68 | |
| 69 | ### Phase 2: Search Execution |
| 70 | 1. Start with `web_search` for structured summaries |
| 71 | 2. Use `web_fetch` on key URLs if summaries insufficient |
| 72 | 3. Retry with adjusted query if first round unsatisfactory |
| 73 | |
| 74 | ### Phase 3: Result Synthesis |
| 75 | 1. Cross-reference multiple sources |
| 76 | 2. **Must annotate source and date** for time-sensitive info |
| 77 | 3. **Must include source URLs**: `Title [<sup>1</sup>](URL)` |
| 78 | |
| 79 | ## Error Handling |
| 80 | |
| 81 | | Error | Recovery | |
| 82 | |-------|----------| |
| 83 | | Connection Failure | Run `get_config_info`, verify API URL/Key | |
| 84 | | No Results | Broaden search terms | |
| 85 | | Fetch Timeout | Try alternative sources | |
| 86 | |
| 87 | ## Anti-Patterns |
| 88 | |
| 89 | | Prohibited | Correct | |
| 90 | |------------|---------| |
| 91 | | No source citation | Include `Source [<sup>1</sup>](URL)` | |
| 92 | | Give up after one failure | Retry at least once | |
| 93 | | Use built-in WebSearch/WebFetch | Use GrokSearch tools/CLI | |