GR

groq-core-workflow-a

Covers core Groq integration patterns including function calling and structured outputs for rapid inference tasks.

Install

mkdir -p .claude/skills/groq-core-workflow-a && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/9309" && unzip -o skill.zip -d .claude/skills/groq-core-workflow-a && rm skill.zip

Installs to .claude/skills/groq-core-workflow-a

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Execute Groq's primary workflow: chat completions with tool use and JSON mode. Use when implementing chat interfaces, function calling, structured output, or building AI features with Groq's fast inference. Trigger with phrases like "groq chat completion", "groq tool use", "groq function calling", "groq JSON mode".
316 chars✓ has a “when” triggerlonger than Claude Code's old 250-char listing cap (fine on current versions)
Intermediate

Key capabilities

  • Execute chat completions with system and user messages
  • Implement function calling loops
  • Generate structured JSON outputs
  • Enforce schema compliance with strict mode
  • Manage multi-turn conversation history

How it works

The skill utilizes the Groq SDK to interface with LPU inference models, supporting chat completions, tool use, and structured output formats.

Inputs & outputs

You give it
User prompt and system instructions
You get back
Model completion or structured JSON object

When to use groq-core-workflow-a

  • Integrating chat completions in applications
  • Implementing function calling with Groq
  • Generating structured JSON outputs
  • Building real-time AI agents

About this skill

Groq Core Workflow A: Chat, Tools & Structured Output

Overview

Primary integration patterns for Groq: chat completions, tool/function calling, JSON mode, and structured outputs. Groq's LPU delivers sub-200ms time-to-first-token, making these patterns viable for real-time user-facing features. This skill walks through five workflow steps; the lean skeleton lives here, and the full copy-paste code lives in references/.

Prerequisites

  • Install the SDK with npm install groq-sdk.
  • Set GROQ_API_KEY in the environment (see Authentication below).
  • Familiarity with the Groq model line-up and which model fits each task.

Authentication

Groq authenticates via an API key. Create one at console.groq.com/keys and export it as GROQ_API_KEY; the SDK reads it automatically, so new Groq() needs no explicit argument. Never hardcode the key — read it from the environment (or a secrets manager) so it stays out of source control.

Model Selection for This Workflow

TaskRecommended ModelWhy
Chat with toolsllama-3.3-70b-versatileBest tool-calling accuracy
JSON extractionllama-3.1-8b-instantFast, accurate for structured tasks
Structured outputsllama-3.3-70b-versatileSupports strict: true schema compliance
Vision + chatmeta-llama/llama-4-scout-17b-16e-instructMultimodal input

Instructions

Work through the five patterns in order. Read the target file, then Write or Edit the integration code into your project.

  1. Chat completion — send system + user messages to groq.chat.completions.create and return choices[0].message.content plus usage. Skeleton below; full example in worked examples.
  2. Tool use / function calling — a three-phase loop: send the message with tools + tool_choice: "auto", execute any returned tool_calls, then send the results back for the final answer. Full code in implementation.
  3. JSON mode — set response_format: { type: "json_object" } and describe the JSON shape in the system prompt. See implementation.
  4. Structured outputs — use response_format.json_schema with strict: true for guaranteed schema compliance (no post-validation). See implementation.
  5. Multi-turn conversation — accumulate the message history and push each assistant reply back onto the stack. See worked examples.

Minimal chat skeleton:

import Groq from "groq-sdk";
const groq = new Groq();

const completion = await groq.chat.completions.create({
  model: "llama-3.3-70b-versatile",
  messages: [
    { role: "system", content: "You are a concise technical assistant." },
    { role: "user", content: userMessage },
  ],
  temperature: 0.7,
  max_tokens: 1024,
});
// completion.choices[0].message.content, completion.usage

Output

Each pattern returns a predictable shape:

  • Chat completion{ reply: string, usage: {...} }; usage carries prompt_tokens / completion_tokens for cost metering.
  • Tool use — the final assistant content string, produced after the tool results are fed back; intermediate tool_calls carry function.name and a JSON-string function.arguments.
  • JSON mode — a parsed JavaScript object matching the shape described in the system prompt (parse message.content with JSON.parse).
  • Structured outputs — a parsed object guaranteed to satisfy the declared JSON schema, so no downstream validation is required.
  • Multi-turn — the latest reply string, with conversation state retained in the class instance for the next turn.

Error Handling

ErrorCauseSolution
tool_calls with malformed JSONModel hallucinated argumentsWrap JSON.parse in try/catch, retry with lower temperature
json_object returns non-JSONSystem prompt missing JSON instructionAlways include "respond with JSON" in system prompt
context_length_exceededConversation too longTrim older messages, keep system prompt
Tool call loopModel keeps calling toolsSet tool_choice: "none" on final completion

Examples

The chat skeleton above is the smallest complete call. Two fuller runnable examples live in worked examples:

  • Example 1 — Chat completion with system prompt + rolling history, returning reply and token usage.
  • Example 2 — Multi-turn conversation class that retains context across turns.

For tool use, JSON mode, and strict structured outputs, see full implementation.

Resources

Next Steps

For audio, vision, and speech workflows, see the companion groq-core-workflow-b skill, which covers Whisper transcription, vision inputs, and text-to-speech.

When not to use it

  • Do not hardcode API keys in source code

Prerequisites

groq-sdk package installedGROQ_API_KEY environment variable set

Limitations

  • Model may hallucinate arguments if tool calls are malformed
  • Context length limits apply to long conversations

How it compares

It use Groq's LPU inference engine to achieve sub-200ms time-to-first-token for real-time AI features compared to standard inference providers.

Compared to similar skills

groq-core-workflow-a side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
groq-core-workflow-a (this skill)026dReviewIntermediate
copilot-sdk74moReviewIntermediate
mcp-builder1363moReviewAdvanced
openrouter-function-calling526dReviewIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

More by jeremylongshore

View all by jeremylongshore

analyzing-logs

jeremylongshore

Analyze application logs to detect performance issues, identify error patterns, and improve stability by extracting key insights.

14123

ollama-setup

jeremylongshore

Configure auto-configure Ollama when user needs local LLM deployment, free AI alternatives, or wants to eliminate hosted API costs. Trigger phrases: "install ollama", "local AI", "free LLM", "self-hosted AI", "replace OpenAI", "no API costs". Use when appropriate context detected. Trigger with relevant phrases based on skill purpose.

1167

backtesting-trading-strategies

jeremylongshore

Backtest crypto and traditional trading strategies against historical data. Calculates performance metrics (Sharpe, Sortino, max drawdown), generates equity curves, and optimizes strategy parameters. Use when user wants to test a trading strategy, validate signals, or compare approaches. Trigger with phrases like "backtest strategy", "test trading strategy", "historical performance", "simulate trades", "optimize parameters", or "validate signals".

1071

generating-database-seed-data

jeremylongshore

Process this skill enables AI assistant to generate realistic test data and database seed scripts for development and testing environments. it uses faker libraries to create realistic data, maintains relational integrity, and allows configurable data volumes. u... Use when working with databases or data models. Trigger with phrases like 'database', 'query', or 'schema'.

1033

cursor-codebase-indexing

jeremylongshore

Execute set up and optimize Cursor codebase indexing. Triggers on "cursor index setup", "codebase indexing", "index codebase", "cursor semantic search". Use when working with cursor codebase indexing functionality. Trigger with phrases like "cursor codebase indexing", "cursor indexing", "cursor".

885

testing-mobile-apps

jeremylongshore

Execute mobile app testing on iOS and Android devices/simulators. Use when performing specialized testing. Trigger with phrases like "test mobile app", "run iOS tests", or "validate Android functionality".

810

You might also like

copilot-sdk

github

Build agentic applications with GitHub Copilot SDK. Use when embedding AI agents in apps, creating custom tools, implementing streaming responses, managing sessions, connecting to MCP servers, or creating custom agents. Triggers on Copilot SDK, GitHub SDK, agentic app, embed Copilot, programmable agent, MCP server, custom agent.

763

mcp-builder

anthropics

Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).

136215

openrouter-function-calling

jeremylongshore

Implement function/tool calling with OpenRouter models. Use when building agents or structured outputs. Trigger with phrases like 'openrouter functions', 'openrouter tools', 'openrouter agent', 'function calling'.

539

develop-ai-functions-example

vercel

Develop examples for AI SDK functions. Use when creating, running, or modifying examples under examples/ai-functions/src to validate provider support, demonstrate features, or create test fixtures.

536

chatgpt-app-builder

mcp-use

Build ChatGPT apps with interactive widgets using mcp-use and OpenAI Apps SDK. Use when creating ChatGPT apps, building MCP servers with widgets, defining React widgets, working with Apps SDK, or when user mentions ChatGPT widgets, mcp-use widgets, or Apps SDK development.

535

create-mcp-app

modelcontextprotocol

This skill should be used when the user asks to "create an MCP App", "add a UI to an MCP tool", "build an interactive MCP View", "scaffold an MCP App", or needs guidance on MCP Apps SDK patterns, UI-resource registration, MCP App lifecycle, or host integration. Provides comprehensive guidance for building MCP Apps with interactive UIs.

331

Search skills

Search the agent skills registry