Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Configure Groq local development with hot reload, mocking, and testing. Use when setting up a Groq development environment, configuring mocked vs live test workflows, or establishing a fast iteration cycle with Groq. Trigger with phrases like "groq dev setup", "groq local development", "groq dev environment", "develop with groq".
.claude/skills/jeremylongshore-groq-local-dev-loop/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-03 | ✗→✓ | ▲ Improved | 19% | 0% |
| case-05 | ✗→✓ | ▲ Improved | 76% | 0% |
| case-01 | ✗→✓ | ▲ Improved | -3% | 0% |
| case-02 | ✗→✓ | ▲ Improved | -1% | 0% |
| case-10 | ✗→✓ | ▲ Improved | 37% | 0% |
Set up a fast, reproducible local development workflow for Groq. Groq's sub-second response times make it uniquely suited for tight dev loops -- you get LLM responses fast enough to iterate without context-switching. This skill scaffolds a project, a memoized client, model constants, and a two-tier test strategy (mocked unit tests + opt-in live integration tests). The lean skeleton lives here; the full code lives in references/implementation.md and references/examples.md.
groq-sdk installed (npm install groq-sdk)GROQ_API_KEY set (free tier is fine for development)The groq-sdk client reads GROQ_API_KEY from the environment automatically — new Groq() and getGroqClient() both pick it up. Get a key at console.groq.com/keys, store it in a git-ignored .env.local, and commit only .env.example as a template. Never hardcode the key or commit .env.local.
Follow these seven steps in order. Steps 1-2 lay out the project; steps 3-4 centralize the client and model IDs; steps 5-6 establish the test tiers; step 7 templates the environment. Full code for each is in the reference files.
src/groq/{client,models,completions}.ts, tests/, and .env.local / .env.example.dev (tsx watch), test / test:watch (vitest), and test:integration scripts.getGroqClient() that fails fast when GROQ_API_KEY is missing and a resetClient() for tests.MODELS map with DEV_MODEL defaulting to llama-3.1-8b-instant to conserve dev quota.vi.mock("groq-sdk") so unit tests run sub-second with zero API calls.GROQ_INTEGRATION=1 with describe.skipIf so the default run stays offline..env.example, git-ignore .env.local.typescript// src/groq/client.ts -- lazily-memoized singleton import Groq from "groq-sdk"; let _client: Groq | null = null; export function getGroqClient(): Groq { if (!_client) { if (!process.env.GROQ_API_KEY) { throw new Error("GROQ_API_KEY not set. Copy .env.example to .env.local"); } _client = new Groq({ apiKey: process.env.GROQ_API_KEY, maxRetries: 2, timeout: 30_000 }); } return _client; } export function resetClient(): void { _client = null; }
See references/implementation.md for the full project scaffold, package.json, model constants, and .env.example, and references/examples.md for the complete unit and integration test files.
Applying the workflow produces:
src/groq/{client,models,completions}.ts and a tests/ directory.getGroqClient() that shares one configured client and throws an actionable error when GROQ_API_KEY is unset.MODELS map + DEV_MODEL constant so dev runs on the cheap 8B model.npm run test:watch, no API calls) and opt-in live tests (npm run test:integration, gated on GROQ_INTEGRATION=1)..env.example template committed for the team, with real secrets in a git-ignored .env.local.| Error | Cause | Solution | |-------|-------|----------| | GROQ_API_KEY not set | Missing .env.local | Copy from .env.example | | Test timeout | Live API call in unit test | Mock groq-sdk in unit tests | | 429 rate_limit_exceeded | Free tier RPM hit | Wait 60s or use test:watch with longer intervals | | Port already in use | Another tsx watch running | Kill process or change port |
llama-3.1-8b-instant during development (lowest quota usage, fastest).temperature: 0 for deterministic outputs during debugging.max_tokens conservatively to avoid burning through free tier.Run the hot-reload app and the mocked unit-test watcher side by side, then exercise the live API only when you opt in:
bashnpm run dev # tsx watch src/index.ts (hot reload) npm run test:watch # vitest --watch (mocked, no API calls) npm run test:integration # GROQ_INTEGRATION=1 vitest (live API)
For the complete mocked unit test (vi.mock("groq-sdk")) and the GROQ_INTEGRATION-gated live integration test, see references/examples.md.
groq-sdk-patterns skill.| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-03 | fail→pass | 23,407 | 20,798 | -11% | 1 | 1 | 0% | 4,200 | 4,992 | +19% | 0 | 0 | — |
case-04 | pass→pass | 19,460 | 18,217 | -6% | 1 | 1 | 0% | 2,481 | 3,970 | +60% | 0 | 0 | — |
case-05 | fail→pass | 37,428 | 15,979 | -57% | 1 | 1 | 0% | 2,053 | 3,604 | +76% | 0 | 0 | — |
case-01 | fail→pass | 34,571 | 22,122 | -36% | 1 | 1 | 0% | 5,442 | 5,257 | -3% | 0 | 0 | — |
case-02 | fail→pass | 42,894 | 23,939 | -44% | 1 | 1 | 0% | 6,137 | 6,089 | -1% | 0 | 0 | — |
case-06 | fail→fail | 14,445 | 2,550 | -82% | 1 | 1 | 0% | 1,798 | 1,876 | +4% | 0 | 0 | — |
case-07 | pass→pass | 8,936 | 10,836 | +21% | 1 | 1 | 0% | 1,547 | 2,346 | +52% | 0 | 0 | — |
case-08 | fail→fail | 16,844 | 15,962 | -5% | 1 | 1 | 0% | 1,775 | 3,139 | +77% | 0 | 0 | — |
case-09 | pass→pass | 14,667 | 14,184 | -3% | 1 | 1 | 0% | 2,981 | 3,721 | +25% | 0 | 0 | — |
case-10 | fail→pass | 11,140 | 14,819 | +33% | 1 | 1 | 0% | 2,193 | 3,000 | +37% | 0 | 0 | — |
case-11 | fail→pass | 20,979 | 7,538 | -64% | 1 | 1 | 0% | 2,371 | 2,788 | +18% | 0 | 0 | — |
case-12 | fail→pass | 9,954 | 8,551 | -14% | 1 | 1 | 0% | 1,504 | 2,086 | +39% | 0 | 0 | — |
case-13 | fail→pass | 19,605 | 4,821 | -75% | 1 | 1 | 0% | 2,816 | 2,413 | -14% | 0 | 0 | — |
case-14 | pass→pass | 12,202 | 8,188 | -33% | 1 | 1 | 0% | 1,198 | 2,011 | +68% | 0 | 0 | — |
case-15 | pass→pass | 20,434 | 17,959 | -12% | 1 | 1 | 0% | 2,975 | 4,056 | +36% | 0 | 0 | — |
case-16 | pass→pass | 18,538 | 13,830 | -25% | 1 | 1 | 0% | 2,876 | 4,136 | +44% | 0 | 0 | — |
case-17 | pass→pass | 10,161 | 10,941 | +8% | 1 | 1 | 0% | 1,792 | 2,596 | +45% | 0 | 0 | — |
case-18 | pass→pass | 10,271 | 7,015 | -32% | 1 | 1 | 0% | 962 | 1,852 | +93% | 0 | 0 | — |
case-19 | pass→pass | 22,571 | 8,215 | -64% | 1 | 1 | 0% | 996 | 2,027 | +104% | 0 | 0 | — |
case-20 | pass→pass | 23,229 | 24,994 | +8% | 1 | 1 | 0% | 3,425 | 5,534 | +62% | 0 | 0 | — |
case-21 | pass→pass | 15,418 | 11,695 | -24% | 1 | 1 | 0% | 1,895 | 3,863 | +104% | 0 | 0 | — |
case-22 | pass→pass | 19,480 | 17,269 | -11% | 1 | 1 | 0% | 2,897 | 3,879 | +34% | 0 | 0 | — |
case-23 | fail→pass | 18,216 | 3,503 | -81% | 1 | 1 | 0% | 2,259 | 1,957 | -13% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 23 cases were attempted. The headline lift of +39 percentage points is the difference between those two pass rates over the 23 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.