mistral-sdk-patterns
Provides standard patterns for Mistral AI SDK usage, covering client setup, error handling, and streaming.
Install
mkdir -p .claude/skills/mistral-sdk-patterns && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/5414" && unzip -o skill.zip -d .claude/skills/mistral-sdk-patterns && rm skill.zipInstalls to .claude/skills/mistral-sdk-patterns
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.
Apply production-ready Mistral AI SDK patterns for TypeScript and Python.Key capabilities
- →Implement singleton client pattern
- →Configure retry logic with exponential backoff
- →Validate structured outputs using JSON Schema
- →Process streaming responses with accumulation
- →Track token usage and estimated costs
How it works
It establishes a singleton client pattern for TypeScript and Python to manage API connections and provides utility functions for retries, structured output validation, and token usage tracking.
Inputs & outputs
When to use mistral-sdk-patterns
- →Implementing Mistral AI API clients
- →Refactoring SDK integration code
- →Setting up team coding standards
- →Adding robust error handling to AI calls
About this skill
Mistral SDK Boundary Patterns
Overview
Prevent provider-specific shapes and volatile client behavior from spreading. Centralize configuration, normalize results and errors, and expose cancellation and usage as first-class fields.
Prerequisites
- A locked official client version and matching documentation.
- An application interface for chat, embeddings, and optional streams.
- Defined timeout, retry, observability, and redaction policies.
Current Contract
Mistral documents official Python and TypeScript clients, but signatures can move independently of application code. REST endpoints remain the verification boundary for the pinned client.
Authentication
Inject MISTRAL_API_KEY into one server-side client factory. Return no key or authorization metadata from the adapter.
Instructions
- Inventory imports, transport overrides, model strings, and response shapes.
- Define normalized types including request ID, usage, finish state, and error class.
- Create one factory with explicit host, timeout, user agent, and dependency pin.
- Retry only classified transient failures while honoring deadline, cancellation, and budget.
- Keep stream assembly and tool-call validation in separate tested components.
- Add characterization tests before migrating call sites.
Tool Discipline
Use Read, Glob, and Grep to inspect code, locks, configuration, tests, and evidence. Use Write and Edit only for approved repository changes. Invocation alone does not authorize network calls, paid usage, uploads, stateful resources, admin mutations, deployments, or deletion.
Approval Boundaries
Require approval for dependency, transport, retry, fallback-model, or live characterization changes. Never execute returned tool arguments automatically.
Error Handling
- Retrying every exception can multiply spend and hide invalid requests.
- Import-time client construction makes rotation and tests unsafe.
- Returning raw SDK objects couples the app to undocumented fields.
Output
Return client pin, adapter surface, timeout/retry matrix, normalized fields, affected call sites, tests, and rollback.
Examples
- Wrap chat and embeddings behind explicit adapter methods.
- Map
429as retryable only within the operation deadline and budget.
Validation
Prove only the adapter imports the SDK, errors remain typed, cancellation propagates, usage survives, and secrets do not.
Resources
- Current first-party evidence map — recheck dated sources before relying on mutable endpoints, models, limits, prices, preview status, or retention.
- Record live account observations as environment-specific evidence, not universal Mistral guarantees.
When not to use it
- →Using CommonJS imports for the SDK
Prerequisites
Limitations
- →SDK is ESM-only for TypeScript
How it compares
This workflow enforces standardized error handling and singleton client management rather than initializing new clients per request.
Compared to similar skills
mistral-sdk-patterns side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| mistral-sdk-patterns (this skill) | 1 | 2mo | Review | Intermediate |
| honcho-integration | 1 | 4mo | Review | Advanced |
| mcp-builder | 136 | 5mo | Review | Advanced |
| stripe-integration | 48 | 4mo | No flags | Advanced |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by jeremylongshore
View all by jeremylongshore →You might also like
honcho-integration
plastic-labs
Integrate Honcho memory and social cognition into existing Python or TypeScript codebases. Use when adding Honcho SDK, setting up peers, configuring sessions, or implementing the dialectic chat endpoint for AI agents.
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).
stripe-integration
wshobson
Implement Stripe payment processing for robust, PCI-compliant payment flows including checkout, subscriptions, and webhooks. Use when integrating Stripe payments, building subscription systems, or implementing secure checkout flows.
langchain
zechenzhangAGI
Framework for building LLM-powered applications with agents, chains, and RAG. Supports multiple providers (OpenAI, Anthropic, Google), 500+ integrations, ReAct agents, tool calling, memory management, and vector store retrieval. Use for building chatbots, question-answering systems, autonomous agents, or RAG applications. Best for rapid prototyping and production deployments.
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.
telegram-dev
2025Emma
Telegram 生态开发全栈指南 - 涵盖 Bot API、Mini Apps (Web Apps)、MTProto 客户端开发。包括消息处理、支付、内联模式、Webhook、认证、存储、传感器 API 等完整开发资源。