groq-sdk-patterns
Skill by jeremylongshore
Applies production patterns for the groq-sdk TypeScript package and the groq Python package. Useful for developers building, refactoring, or standardizing Groq integrations.
Install groq-sdk-patterns
Built from the published package, never by AI.
git clone --depth 1 https://github.com/jeremylongshore/tons-of-skills-marketplace /tmp/tons-of-skills-marketplace && mkdir -p ~/.claude/skills && cp -r /tmp/tons-of-skills-marketplace/skills/.curated/groq-sdk-patterns ~/.claude/skills/groq-sdk-patternsRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
git clone --depth 1 https://github.com/jeremylongshore/tons-of-skills-marketplace /tmp/tons-of-skills-marketplace && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/tons-of-skills-marketplace/skills/.curated/groq-sdk-patterns ~/.gemini/antigravity-cli/skills/groq-sdk-patternsAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Skills can run scripts on your machine. Some need an API key: check the README.
About
Groq SDK Patterns gives an AI assistant production patterns for the groq-sdk TypeScript package and the groq Python package. It covers a shared client singleton, a typed completion wrapper that reports Groq timing fields such as queue_time and completion_time, and streaming with async generators. It also covers error handling for Groq error types, retry logic that honors the retry-after header on 429 responses, and a multi-tenant client factory that keeps API keys isolated per tenant.
The skill works as a short workflow map. Full copy-paste implementations live in reference files for TypeScript, Python, and differences between OpenAI and Groq. The source notes that the Groq SDK mirrors the OpenAI SDK interface, so developers familiar with OpenAI will find the patterns recognizable. It is aimed at developers implementing Groq integrations, refactoring SDK usage, or setting team coding standards for Groq.
Written from the project's SKILL.md and checked against it.
What it can do
- Typed client singletonCreates one shared Groq client with maxRetries and timeout settings.
- Typed completion wrapperReturns content, token counts, and timing fields including tokensPerSec.
- Streaming with typed eventsYields delta content tokens through an async generator as they arrive.
- Groq error handlingBranches on Groq APIError status codes and APIConnectionError, rethrowing unknown errors.
- Retry with backoffWaits for the retry-after header on 429 responses, otherwise uses jittered backoff.
- Python patternsCovers sync Groq, AsyncGroq, and streaming in the Python reference file.
- Multi-tenant client factoryCaches one client per tenant so API keys stay isolated.
What you need
- GROQ_API_KEY set in the environment
- groq-sdk (TypeScript) or groq (Python) package installed
- Understanding of async/await and error handling
- Familiarity with OpenAI SDK patterns
Try asking
- Add a shared Groq client singleton to my TypeScript project
- Wrap my Groq chat calls with retry on 429 rate limit errors
- Show me how to stream Groq tokens in a Python app
Good to know
- Free tier rate limits are described as aggressive in the source.
- Full implementations are in separate reference files, not in the main skill text.
- Groq differs from OpenAI in package name, base URL, timing fields, and error class names.
Security check
B- Allowed to use Write, Edit without limitsIn
SKILL.md
Checked automatically: skills/.curated/groq-sdk-patterns/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work
Inside the skill
Allowed tools: ReadWriteEdit
-
SKILL.md6 KB -
references/python-patterns.md1 KB -
references/sdk-differences.md1 KB -
references/typescript-patterns.md5 KB
Alternatives to groq-sdk-patterns
All alternatives →Runs a 7-stage workflow for auditing, cleaning up and reviewing GitHub repositories, plus competitor analysis. Written for developers who want a repo checked for secrets, junk files and documentation gaps.
Teaches an AI assistant to build, debug and explain Gradio web UIs and ML demos in Python. It covers the core API, components, event listeners, layouts and the MCP server option. Aimed at Python developers who work with Gradio.
Recommends menus, buttons, toolbars and disclosure controls for Apple platforms using Human Interface Guidelines conventions. Built for developers and designers making iOS, iPadOS, macOS or visionOS interfaces. Checks existing project design context before asking questions.
Creates production-ready FastAPI project structures with async patterns, dependency injection, and error handling. It is for developers starting new FastAPI applications or backend API projects.
Analyzes Android apps to find user workflows to expose as AppFunctions, so AI agents and system shortcuts can run them without opening the app UI. Generates Kotlin code and refines KDoc for Android developers.
Creates, edits, validates and runs Agent QA tests, suites and hooks through MCP or CLI. It keeps canonical IDs and schema contracts intact, for developers and QA teams using Agent QA.
Compare with openclaw-github-repo-commander, gradio or hig-components-menus
groq-sdk-patterns: common questions
Is Groq SDK Patterns compatible with the OpenAI SDK?
The source says the Groq SDK mirrors the OpenAI SDK interface, such as chat.completions.create. It also notes differences in package name, base URL, timing fields, and error class names.
Which languages does this skill cover?
It covers TypeScript with the groq-sdk package and Python with the groq package. Python patterns include sync, async, and streaming examples.
How does it handle rate limits?
On 429 responses it reads the retry-after header and waits that long before retrying. Otherwise it uses jittered exponential backoff.
How do I install groq-sdk-patterns?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is groq-sdk-patterns free?
The code is published under the MIT licence. The service it connects to may have its own pricing.
Is groq-sdk-patterns safe to use?
It scores 79 of 100. Grades: maintenance A, licence A, quality A. Security check: grade B (allowed to use write, edit without limits). Review the code before you install. How grades work.
What are alternatives to groq-sdk-patterns?
Similar skills: openclaw-github-repo-commander, gradio, hig-components-menus, fastapi-templates.
