agentsclimarketplace

Grok build

Skill ericyz/grok-for-claude-code/skills/grok-build

Run the Grok Build CLI (xAI) as a collaborating AI inside Claude Code, with intelligent model routing across the software development lifecycle. Claude is the conductor/orchestrator — requirements, architecture, the hard 20%, verification, and review — and routes deterministic, high-volume work (scaffolding, boilerplate, test generation, first-pass review, migrations, live web/X search) to Grok, the cheaper, faster model. Use when the user wants to "use Grok / grok-build", "vibe code / agentic engineering", "accelerate the SDLC", "delegate to Grok", "scaffold / generate tests / migrate", "first-pass code review", "search the web or X", "deep research / multi-source research report", "second-model cross-check", or "lower token cost on a big job". Claude always verifies Grok's output and re-checks itself if unsatisfied.From its SKILL.md

Install
npx -y skills add ericyz/grok-for-claude-code --skill grok-build

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

2 things to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

16.8 KB, as published. Nobody here has run it

Grok Build for Claude Code — hybrid SDLC

Run the Grok Build CLI (grok, xAI) as a second AI working alongside Claude Code. The organizing idea is intelligent model routing across the SDLC: keep judgement-heavy work on Claude (the frontier model) and route deterministic, high-volume work to Grok (cheaper, faster). Two AIs, one workflow.

  • Claude = conductor / orchestrator — requirements, architecture, the hard 20% (edge cases, integration, correctness), specs, tests/evals, final review.
  • Grok = delegated agent — a full terminal agent (file edits, terminal, subagents, MCP, live web/X search) that executes well-specified work.

This is agentic engineering, not vibe coding: the value is the structure around the model — routing, shared rules, verification gates — not raw generation. Generation is solved; verification, judgement, and direction are the craft.

Two modes (pick per task)

  • Conductor (sync, inline): you're shaping something in real time; delegate a small, well-scoped chunk to grok mid-flow (e.g. "generate these tests"), use the result immediately.
  • Orchestrator (async, multi-unit): decompose a larger task into units, dispatch to grok (often with --dir, agentic, in parallel), then review and integrate. Best for migrations, bulk implementation against patterns, test suites.

Division of labor across the SDLC

Route each phase to the right model. This is the core policy.

SDLC phaseOwnerWhy
Requirements & planningClaudeambiguity, human-paced judgement
Design & architectureClaudetrade-offs; most human-centric
Implementation — complex / architecture-bearing (the 20%)Claudecorrectness, deep context
Implementation — scaffolding / boilerplate / well-specifiedgrokdeterministic, high volume
Test & eval generationgrok (Claude defines the contract)cheaper-model territory
First-pass code reviewgrok → Claude finalAI as first-pass reviewer
Cross-model verification (output + trajectory)bothtwo model families ≠ same failure
Maintenance / migration / modernizationgrok executes, Claude directstedious, systematic
Live web / X searchgrok → Claude re-checkstools Claude lacks natively here
Deep research (multi-source)grok fans out search/fetch · Claude plans, verifies ≥2 sources, synthesizesoffload bulky pages to cheap Grok; frontier model judges

Routing tier within grok: fast (default, bulk — grok-composer-2.5-fast) · build (harder reasoning / reviews / cross-checks — grok-build). Add --effort low|medium|high|xhigh|max to scale reasoning within a tier.

Tiers are remappable to any ID grok models lists — via --model <exact id>, or persistently with the default_model / tier_fast / tier_build plugin options (env CLAUDE_PLUGIN_OPTION_*). Keep the executor a different, cheaper model than the Claude conductor: that's what yields the cost saving and the cross-model verification value (Claude executing Claude loses both).

How to call it

grok-delegate [options] "the task prompt"

Options: --tier fast|build · --dir <path> (workspace; maps to grok --cwd, one dir) · --timeout 10m (wall-clock watchdog) · --yolo (auto-approve tools — needed for ANY tool use in headless mode; maps to grok --always-approve) · --worktree (fresh git worktree; isolates writes) · --sandbox <profile> · --effort <level> · --max-turns <n> · --json (adds grok's sessionId for later --session resume) · --json-schema '<schema>' (schema-constrained output) · --print-command (dry run: show the resolved grok call, don't run it) · pipe a long prompt with a trailing -.

The wrapper guarantees: non-empty stdout on success; non-zero structured exit on failure; every call bounded by a pure-bash wall-clock watchdog (grok -p has no timeout of its own, and stock macOS has no GNU timeout).

Two ways to delegate. Call the wrapper directly (above), or — when you want file generation to happen entirely on Grok with zero Claude tokens spent writing — hand the unit to the grok-build-delegate subagent (its only file-acting tool is the wrapper; it returns a digest for you to verify). Either way, you still own verification.

Structured failures. The wrapper exits 10 quota · 11 auth · 12 timeout · 13 grok-missing (besides 2 failed / 3 empty) and prints a GROK_SIGNAL {...} line on stderr; grok-job status/result surface it, so you can react (e.g. retry quota with --continue, fix auth with grok login) instead of scraping prose.

If Claude itself is running headless (claude -p, one-shot): run delegations synchronously — let grok-delegate BLOCK and return before you continue. Do NOT background a delegation expecting a later turn / "harness re-invocation": there is none in -p mode, so you'd exit before the work finishes. (Backgrounding is only valid in an interactive session that will be re-invoked.)

Shared harness: one AGENTS.md for both AIs

grok reads AGENTS.md from the workspace as project instructions (verified via grok inspect). Keep a single shared AGENTS.md at the repo root (stack, conventions, hard rules, workflow) so Claude and Grok operate under the same rules — this raises grok's first-pass success rate and keeps output consistent (lower OpEx).

Rule: when delegating any repo work, always pass --dir <repo-root> so grok loads AGENTS.md and the real code, instead of pasting files into the prompt (cheaper, denser context).

Verification gates (non-negotiable)

Claude owns correctness. For anything that ships:

  1. Define the contract first — Claude writes/owns the tests and evals; they tell grok what "correct" means more precisely than prose.
  2. Output eval = actually run it, don't stop at reading the code. Reading the diff is necessary but NOT sufficient — a static review that "looks right" is still vibe coding. Execute it: run the tests, launch the app, hit the real API/endpoints, and check each acceptance criterion against observed behavior. Verify external assumptions empirically rather than trusting the spec's claims. If you cannot run it, say so explicitly — do not mark the gate passed.
  3. Trajectory check — did it take a sane path? Print mode returns only the final text, so have grok summarize its own steps as part of its output, or keep a session (--continue / --session <id>, get the ID from --json) and ask it to recap. grok export can also dump a session transcript as Markdown if you need the full trajectory.
  4. Review every shipping line — be skeptical of clever code; check imports are real packages (hallucinated deps), error handling, edge cases, and that the contract itself is internally consistent (examples/placeholders match the verified behavior).
  5. Never trust grok's "done" — re-run the gate yourself in a clean state. An executor agent may take shortcuts to make a check pass (stubbing dependencies, patching the environment) and then report success. Before believing a passing test/eval: diff any touched tooling against a pristine reference, restore it, and re-run the gate under Claude's own control. grok's self-reported pass is a claim, not evidence. The measured local trap: headless grok without --yolo exits 0 and writes nothing — always check the files actually changed. If wrong: retry on --tier build (or a higher --effort), sharpen the spec, or do that piece yourself.

Safety for write tasks

Read-only work (search, review, analysis) is low-risk. When grok writes files or runs commands (--yolo grants write + terminal):

  • Write tasks MUST pass --yolo. Verified: without it, headless grok silently skips every tool call and returns exit 0 without writing anything (usually with empty output, which the wrapper turns into exit 3). Claude Code may also prompt for or block the auto-approve flag — approve it or pre-allow Bash(grok-delegate*). Always verify the files actually changed (the gate catches the silent no-write).
  • Run it on a dedicated git branch, or pass --worktree so grok works in a fresh git worktree and changes stay isolated.
  • Add --sandbox <profile> for execution containment, and --max-turns <n> to bound runaway agentic loops.
  • Claude reviews the diff before merging — never auto-merge grok's writes.

Cost discipline — where the savings actually come from

Delegation does not save money by itself. On a small task the hybrid can cost more than Claude-only, because the dominant cost is Claude's own cache_read — re-reading a large, growing context across many orchestration turns. The savings are real only when you keep Claude's context lean and the round-trips few. Apply these as hard rules:

  1. Delegate above the break-even, not below. Hand work to grok only when the offloaded volume clearly exceeds the spec-writing + round-trip + verification overhead it adds. Bulk/parallel/repetitive (mass migration, exhaustive tests, fan-out research, long-context reads that return a small digest) = delegate. Small, self-contained, or judgement-heavy = just do it yourself. (Delegating a tiny task is a net loss.)
  2. Keep Claude's context lean (the biggest lever). Do not pull the files grok already handled (--dir) back into Claude's context, and do not paste grok's raw bulky output into the thread. Claude ingests a digest, not raw content — this is what collapses the per-turn cache_read that makes a chatty hybrid expensive.
  3. Make grok return a digest, not a dump. End every delegation prompt with an explicit trailer instruction, e.g.: "...End with a fenced block ===DIGEST=== listing: files changed, key decisions, and a 1-paragraph 'context for next step'. Put bulky detail ONLY in files, not in your reply." Claude reads the DIGEST; the bulky work stays on cheap Grok tokens.
  4. Batch, don't chatter. One large, fully-specified delegation beats many small round-trips (each round-trip re-reads context = cache_read tax).
  5. Review the diff, not the whole tree. git diff is compact; reading every file is not.
  6. Hold state on the cheap side. For multi-step jobs, keep a grok session with --continue / --session <id> (capture the ID from a --json call) so the working context lives in Grok, and Claude passes deltas instead of re-supplying everything.
  7. Asymmetric effort. The conductor doesn't need max reasoning effort to coordinate + verify; run Claude at a moderate effort and let the cheap workers do the volume.
  8. Don't manufacture work to keep the prompt cache warm. The ~5-min cache expires while you wait on a long delegation and the next turn pays cache_create instead of cache_read — but "warming" turns generate frontier output tokens (the most expensive class) and cost more. Backgrounding a long delegation (grok-job) is fine to avoid blocking, but it does not make a small task cheaper. The only real fix is scale: make each delegation big enough that the displaced Claude output dwarfs the one-time re-cache cost.

Honest framing for any cost claim: there is no flat headline ratio. Below the break-even the hybrid costs more; above it, lean-context routing cuts frontier-model spend. Quote what you actually measured, never a slogan.

SDLC recipes

ROOT=grok-delegate

# Scaffold from a spec (Claude wrote the spec/architecture)
"$ROOT" --tier build --yolo --worktree --dir ./app \
  "Scaffold per ARCHITECTURE.md: dirs, configs, stub modules. Follow AGENTS.md."

# Generate tests for a contract Claude defined
"$ROOT" --tier fast --yolo --dir ./app \
  "Write unit + edge-case tests for src/payments.py covering the cases in SPEC.md."

# First-pass review (Claude does the final pass)
{ echo "Review this diff for correctness/security/perf bugs, be skeptical. List each as file:line — issue."; git diff; } | "$ROOT" --tier build -

# Implement-until-tests-pass (feedback loop; isolate in a worktree)
"$ROOT" --tier build --yolo --worktree --dir ./app \
  "Implement feature X to satisfy AGENTS.md and make 'pytest -q' pass. Iterate until green.
   End with ===DIGEST===: files changed, key decisions, context for next step."

# Migration / modernization
"$ROOT" --tier build --yolo --worktree --dir ./svc \
  "Migrate all callers from APIv1 to APIv2 per MIGRATION.md. List every file changed."

# Live web / X search → Claude re-checks
"$ROOT" --tier fast --yolo "Web-search <X>. Give URLs + dates."

# Schema-constrained output (machine-readable handoff)
"$ROOT" --tier fast --json-schema '{"type":"object","properties":{"todos":{"type":"array","items":{"type":"string"}}}}' \
  --dir . "List every TODO comment in src/ as short strings."

Deep-research recipe (multi-source)

grok has live web search and X search built in (headless tool use requires --yolo). Deep research is a Claude-orchestrated recipe, not a single grok call: grok is the cheap, grounded legwork worker; Claude plans, verifies, and synthesizes.

Caveat that shapes the recipe: a single -p call is one agentic pass — it will not reliably iterate when evidence is thin, its citations can be coarse, and any model can leak parametric "knowledge" disguised as a sourced fact. Never ship its citations unverified.

  1. Plan (Claude). Decompose into sub-questions + an explicit list of load-bearing claims to verify. Claude owns scope and final synthesis.
  2. Fan-out fetch (grok, cheap, parallel). One call per sub-question; force compact stdout so bulky pages stay in Grok's context, not Claude's:
    "$ROOT" --tier fast --yolo \
      "Use web search for <sub-question>. Return 5-8 bullet findings, each with the
       exact source URL and publication date. Output ONLY findings+URLs+dates."
    
  3. Deepen on key sources (grok). For each load-bearing claim, name the URL and make grok quote the supporting text (turns coarse citations into verifiable quotes):
    "$ROOT" --tier build --yolo \
      "Open <URL> and quote the exact sentence(s) supporting: '<claim>'.
       If the page does not support it, reply NOT SUPPORTED."
    
  4. Adversarial verify (Claude). Corroborate each key claim across ≥2 independent domains; treat any single/vague/domain-only citation as unverified; sanity-check dates; watch for parametric knowledge masquerading as a sourced fact.
  5. Synthesize (Claude). Write the final cited report from verified findings only; mark anything uncorroborated as "unverified."

Iteration is Claude's job: re-dispatch follow-up grok calls to close gaps. Token economics: bulky searched/fetched text is paid in cheap Grok tokens and distilled to bullets+URLs before reaching Claude.

What Grok Build brings that Claude lacks natively here

  • Live web + X search — current, grounded info, including the X/Twitter firehose (headless tool use needs --yolo; disable with grok's --disable-web-search).
  • A cheap, fast coding model (grok-composer-2.5-fast) for bulk generation.
  • Native git worktrees (--worktree) for isolated write tasks.
  • Schema-constrained output (--json-schema) for machine-readable handoffs.
  • Resumable sessions (--continue / --resume <sessionId>) to hold working state on the cheap side.

Prerequisites & limits

  • grok installed and authenticated (grok models lists models; sign in with grok login); ~/.grok/bin on PATH.
  • Scripts executable (chmod +x scripts/*.sh) — /grok-build:setup checks this.
  • Headless -p returns final text only (use --json for sessionId + stop reason; grok export for a full transcript). Tool use headless requires --yolo (--always-approve) — without it grok silently skips tools and writes nothing.
  • The wrapper's watchdog defaults to 5m — raise --timeout for long agentic tasks, and prefer grok-job (background) past the ~2-min sync Bash-tool limit.

Keep looking

Skills are one crate of 607,533. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.