Claude
Skills
Sign in
Back

using-grok

Included with Lifetime
$97 forever

Integrate xAI's Grok models for multi-model collaboration. Triggers on "Ask Grok", "What does Grok think", "Have Grok analyze", or similar phrases. Provides access to grok_query, grok_analyze_code, grok_reason, and grok_execute_code tools.

General

What this skill does


# Using Grok

## Description

Integrate xAI's Grok models into your workflow for multi-model collaboration. Get Grok's perspective on questions, code analysis, explanations, and creative tasks.

## When to Use

Use this skill when users want to:
- Get a second opinion from Grok on technical questions
- Have Grok analyze code for bugs, performance, or security issues
- Compare perspectives between Claude and Grok
- Leverage Grok's training data and reasoning capabilities
- Use Grok's extended thinking for complex problems

### Trigger Patterns

Activate this skill when you see phrases like:
- "Ask Grok..."
- "What does Grok think about..."
- "Get Grok's perspective on..."
- "Have Grok analyze..."
- "Use Grok to..."
- "Query Grok about..."
- "Let Grok explain..."
- "Have Grok review this code..."
- "Ask Grok to reason through..."
- "Get Grok to deeply think about..."
- "How much would it cost to ask Grok..."
- "Estimate the cost of asking Grok..."
- "Have Grok run/execute this code..."
- "Ask Grok to calculate..."
- "Verify this with Grok..."

### Additional Trigger Patterns

| Category | Phrases |
|----------|---------|
| **Quick Checks** | "Double-check with Grok", "Grok verify", "Sanity check via Grok" |
| **Code-Specific** | "Grok this code", "Grok debug this", "Have Grok test this" |
| **Comparisons** | "What would Grok say?", "Grok's take on this", "Second opinion from Grok" |
| **Cost-Aware** | "Quick Grok check" (implies fast model), "Deep Grok analysis" (implies reasoning) |
| **Verification** | "Have Grok run the numbers", "Verify calculation with Grok" |

## Available Tools

### grok_query

Query Grok with a question or prompt. Supports vision/image analysis.

**Parameters:**
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `query` | string | Yes | The question or prompt to send to Grok |
| `model` | string | No | Model alias or ID (default: "auto") |
| `context` | string | No | System context to guide the response |
| `max_tokens` | integer | No | Maximum response tokens (default: 4096) |
| `temperature` | number | No | Sampling temperature 0-2 (default: 0.7) |
| `top_p` | number | No | Nucleus sampling 0-1 (alternative to temperature) |
| `stream` | boolean | No | Enable SSE streaming (default: auto-detected) |
| `image_url` | string | No | Image URL (HTTPS) or base64 data URI for vision queries |
| `image_detail` | string | No | Detail level for image analysis: "auto", "low", "high" (default: "auto") |

**Smart Streaming (P4-014):**
When `stream` is not specified, streaming is automatically enabled for:
- Reasoning models (thinking traces benefit from streaming)
- Long output indicators ("explain in detail", "step by step", "write code", etc.)
- Queries > 500 characters
- High complexity queries (complexity score >= 40)

Simple queries use non-streaming to preserve cache benefits. Explicit `stream: true/false` always overrides auto-detection.

**Vision Support (P4-015):**
- Provide an `image_url` to enable image analysis
- Supports HTTPS URLs (e.g., `https://example.com/photo.jpg`)
- Supports base64 data URIs (e.g., `data:image/png;base64,...`)
- **Minimum image size:** 448×448 pixels (images are processed as 448×448 tiles)
- **Maximum image size:** 10 MiB per image
- Supported formats: PNG, JPEG
- When image is provided with `model: "auto"`, automatically selects vision-capable model (grok-4)
- Use `image_detail: "low"` for faster, cheaper analysis; `"high"` for detailed inspection

**Model Aliases:**
| Alias | Best For | Model ID |
|-------|----------|----------|
| `auto` | General queries | grok-4 |
| `fast` | Quick responses, cost-effective | grok-4-fast |
| `smartest` | Complex reasoning | grok-4 |
| `code` | Code generation, agentic tasks | grok-code-fast-1 |
| `reasoning` | Extended thinking, chain-of-thought | grok-4.1-fast |
| `cheap` | Budget-conscious queries | grok-4-fast |
| `vision` | Image/vision analysis | grok-4 |

### grok_models

List available Grok models with capabilities and pricing.

**Parameters:**
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `refresh` | boolean | No | Force refresh from API (default: false) |

### grok_analyze_code

Analyze code for bugs, performance issues, security vulnerabilities, and style problems.

**Parameters:**
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `code` | string | Yes | The code to analyze |
| `language` | string | No | Programming language (auto-detected if not specified) |
| `analysis_type` | string | No | Type: "performance", "bugs", "security", "style", or "all" (default: "all") |
| `model` | string | No | Model to use (default: grok-code-fast-1) |

**Supported Languages:** JavaScript, TypeScript, Python, Go, Rust, Java, C#, C/C++, Ruby, PHP, SQL, HTML, CSS, Shell, and more (auto-detected).

### grok_reason

Perform extended reasoning and deep thinking on complex problems.

**Parameters:**
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `query` | string | Yes | The question or problem to reason through |
| `effort` | string | No | Reasoning depth: "low", "medium", "high" (default: "medium") |
| `show_thinking` | boolean | No | Include reasoning trace in output (default: true) |
| `model` | string | No | Model to use (default: grok-4-1-fast-reasoning) |
| `context` | string | No | Additional context for the problem |

**Effort Levels:**
- `low`: Quick analysis with focused conclusions (~2000 tokens)
- `medium`: Balanced reasoning with step-by-step analysis (~4000 tokens)
- `high`: Thorough deep thinking with multiple perspectives (~8000 tokens)

### grok_estimate_cost

Estimate the cost of a Grok query before execution.

**Parameters:**
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `query` | string | Yes | The query text to estimate |
| `model` | string | No | Model to use for estimation (default: auto) |
| `context` | string | No | Additional context to include in estimation |
| `max_tokens` | number | No | Expected maximum output tokens |

### grok_execute_code

Execute Python code server-side for calculations, data analysis, and algorithm testing.

**Parameters:**
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `code` | string | Yes | Python code to execute (max 50,000 chars) |
| `description` | string | No | What the code should accomplish (improves explanation) |
| `include_output` | boolean | No | Include raw stdout/stderr (default: true) |
| `max_turns` | integer | No | Max execution iterations 1-10 (default: 3) |
| `model` | string | No | Model to use (default: grok-4-1-fast) |

**Use Cases:**
- Verify mathematical calculations
- Test algorithms with sample data
- Perform data analysis
- Validate code snippets before suggesting them
- Run complex computations

## Model Selection Guide

Choose the right model for the task:

```
Quick question or simple task?
└─ Use "fast" - cheapest, fastest response

Code analysis or generation?
└─ Use "code" - optimized for programming tasks

Complex reasoning or multi-step analysis?
└─ Use "reasoning" - extended thinking, 2M context

Vision or image understanding?
└─ Use "auto" (grok-4) - supports image input

Not sure?
└─ Use "auto" - intelligent default selection
```

## Tool Selection Guide

Choose the right tool for the task:

```
General question or creative task?
└─ Use grok_query - flexible general-purpose tool

Code review or bug hunting?
└─ Use grok_analyze_code - structured analysis with line references

Complex problem requiring deep thought?
└─ Use grok_reason - shows thinking process, adjustable effort

Need to run calculations or test code?
└─ Use grok_execute_code - server-side Python execution

Want to know the cost before querying?
└─ Use grok_estimate_cost - preview costs without spending

List available models and pricing?
└─ Use grok
Files: 1
Size: 15.4 KB
Complexity: 20/100
Category: General

Related in General