[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6F87NVV75EQ6M4VBWQYNWC9":3,"skill-same:01M6F87NVV75EQ6M4VBWQYNWC9":74},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":42,"linkOnly":43,"markdownContent":44,"markdownBody":45,"frontMatter":46,"refName":51,"commitSha":52,"skillDirectory":53,"forksCount":54,"repositoryHtmlUrl":55,"repositoryHomepageUrl":6,"ownerHtmlUrl":56,"ownerBlogUrl":57,"ownerDescription":58,"updatedAt":59,"install":60,"resources":73},"01M6F87NVV75EQ6M4VBWQYNWC9","mistral-reference-architecture",null,"Implement Mistral AI reference architecture with best-practice project layout.\nUse when designing new Mistral AI integrations, reviewing project structure,\nor establishing architecture standards for Mistral AI applications.\nTrigger with phrases like \"mistral architecture\", \"mistral best practices\",\n\"mistral project structure\", \"how to organize mistral\", \"mistral layout\".","Dicklesworthstone\u002Fpi_agent_rust","Dicklesworthstone","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F35050222?v=4","01M6CG26AR942CSVMN1M5E3DSE","Jeff Emanuel","01M6CG26EPP71PSHW1VDS71121",1992,"MIT","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Fplugins-community\u002Fplugins\u002Fsaas-packs\u002Fmistral-pack\u002Fskills\u002Fmistral-reference-architecture\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41],"architecture","mistral reference architecture","reference","Mistral","structure","new","when","for","project structure","how to","trigger","io","layout","project","organize","best practices","standards","best-practice","use","read","integrations","how","applications","2026-11-10 10:12:30",false,"---\nname: mistral-reference-architecture\ndescription: |\n  Implement Mistral AI reference architecture with best-practice project layout.\n  Use when designing new Mistral AI integrations, reviewing project structure,\n  or establishing architecture standards for Mistral AI applications.\n  Trigger with phrases like \"mistral architecture\", \"mistral best practices\",\n  \"mistral project structure\", \"how to organize mistral\", \"mistral layout\".\nallowed-tools: Read, Grep\nversion: 1.0.0\nlicense: MIT\nauthor: Jeremy Longshore \u003Cjeremy@intentsolutions.io>\n---\n\n# Mistral AI Reference Architecture\n\n## Overview\nProduction-ready architecture patterns for Mistral AI integrations.\n\n## Prerequisites\n- Understanding of layered architecture\n- Mistral AI SDK knowledge\n- TypeScript project setup\n- Testing framework configured\n\n## Project Structure\n\n```\nmy-mistral-project\u002F\n├── src\u002F\n│   ├── mistral\u002F\n│   │   ├── client.ts           # Singleton client wrapper\n│   │   ├── config.ts           # Environment configuration\n│   │   ├── types.ts            # TypeScript types\n│   │   ├── errors.ts           # Custom error classes\n│   │   ├── prompts\u002F            # Prompt templates\n│   │   │   ├── system.ts       # System prompts\n│   │   │   └── templates.ts    # Reusable templates\n│   │   └── handlers\u002F\n│   │       ├── chat.ts         # Chat completion handlers\n│   │       ├── embeddings.ts   # Embedding handlers\n│   │       └── tools.ts        # Function calling handlers\n│   ├── services\u002F\n│   │   └── ai\u002F\n│   │       ├── index.ts        # Service facade\n│   │       ├── chat.ts         # Chat service\n│   │       ├── rag.ts          # RAG implementation\n│   │       └── cache.ts        # Caching layer\n│   ├── api\u002F\n│   │   └── chat\u002F\n│   │       ├── route.ts        # API endpoint\n│   │       └── stream.ts       # Streaming endpoint\n│   └── jobs\u002F\n│       └── ai\u002F\n│           └── batch.ts        # Background processing\n├── tests\u002F\n│   ├── unit\u002F\n│   │   └── mistral\u002F\n│   └── integration\u002F\n│       └── mistral\u002F\n├── config\u002F\n│   ├── mistral.development.json\n│   ├── mistral.staging.json\n│   └── mistral.production.json\n└── docs\u002F\n    └── mistral\u002F\n        ├── SETUP.md\n        └── RUNBOOK.md\n```\n\n## Layer Architecture\n\n```\n┌─────────────────────────────────────────┐\n│             API Layer                    │\n│   (Routes, Controllers, Middleware)      │\n├─────────────────────────────────────────┤\n│           Service Layer                  │\n│  (Business Logic, Orchestration)         │\n├─────────────────────────────────────────┤\n│          Mistral Layer                   │\n│   (Client, Prompts, Error Handling)      │\n├─────────────────────────────────────────┤\n│         Infrastructure Layer             │\n│    (Cache, Queue, Monitoring)            │\n└─────────────────────────────────────────┘\n```\n\n## Key Components\n\n### Step 1: Client Wrapper\n\n```typescript\n\u002F\u002F src\u002Fmistral\u002Fclient.ts\nimport Mistral from '@mistralai\u002Fmistralai';\nimport { getMistralConfig } from '.\u002Fconfig';\n\nlet instance: Mistral | null = null;\n\nexport function getMistralClient(): Mistral {\n  if (!instance) {\n    const config = getMistralConfig();\n    instance = new Mistral({\n      apiKey: config.apiKey,\n      timeout: config.timeout,\n    });\n  }\n  return instance;\n}\n\nexport function resetMistralClient(): void {\n  instance = null;\n}\n```\n\n### Step 2: Configuration Management\n\n```typescript\n\u002F\u002F src\u002Fmistral\u002Fconfig.ts\nimport { z } from 'zod';\n\nconst configSchema = z.object({\n  apiKey: z.string().min(1),\n  model: z.string().default('mistral-small-latest'),\n  timeout: z.number().default(30000),\n  maxRetries: z.number().default(3),\n  cache: z.object({\n    enabled: z.boolean().default(true),\n    ttlSeconds: z.number().default(300),\n  }).default({}),\n});\n\nexport type MistralConfig = z.infer\u003Ctypeof configSchema>;\n\nexport function getMistralConfig(): MistralConfig {\n  const env = process.env.NODE_ENV || 'development';\n\n  const baseConfig = {\n    apiKey: process.env.MISTRAL_API_KEY,\n    model: process.env.MISTRAL_MODEL,\n    timeout: parseInt(process.env.MISTRAL_TIMEOUT || '30000'),\n    maxRetries: parseInt(process.env.MISTRAL_MAX_RETRIES || '3'),\n  };\n\n  return configSchema.parse(baseConfig);\n}\n```\n\n### Step 3: Error Handling\n\n```typescript\n\u002F\u002F src\u002Fmistral\u002Ferrors.ts\nexport class MistralServiceError extends Error {\n  constructor(\n    message: string,\n    public readonly code: string,\n    public readonly status?: number,\n    public readonly retryable: boolean = false,\n    public readonly originalError?: Error\n  ) {\n    super(message);\n    this.name = 'MistralServiceError';\n  }\n}\n\nexport function wrapMistralError(error: unknown): MistralServiceError {\n  if (error instanceof MistralServiceError) return error;\n\n  const err = error as any;\n\n  \u002F\u002F Rate limit\n  if (err.status === 429) {\n    return new MistralServiceError(\n      'Rate limit exceeded',\n      'RATE_LIMIT',\n      429,\n      true,\n      err\n    );\n  }\n\n  \u002F\u002F Auth error\n  if (err.status === 401) {\n    return new MistralServiceError(\n      'Authentication failed',\n      'AUTH_ERROR',\n      401,\n      false,\n      err\n    );\n  }\n\n  \u002F\u002F Server error\n  if (err.status >= 500) {\n    return new MistralServiceError(\n      'Mistral service error',\n      'SERVICE_ERROR',\n      err.status,\n      true,\n      err\n    );\n  }\n\n  return new MistralServiceError(\n    err.message || 'Unknown error',\n    'UNKNOWN',\n    err.status,\n    false,\n    err\n  );\n}\n```\n\n### Step 4: Service Layer\n\n```typescript\n\u002F\u002F src\u002Fservices\u002Fai\u002Fchat.ts\nimport { getMistralClient } from '..\u002F..\u002Fmistral\u002Fclient';\nimport { wrapMistralError } from '..\u002F..\u002Fmistral\u002Ferrors';\nimport { withRetry } from '..\u002F..\u002Futils\u002Fretry';\nimport { cache } from '.\u002Fcache';\n\nexport interface ChatOptions {\n  model?: string;\n  temperature?: number;\n  maxTokens?: number;\n  useCache?: boolean;\n}\n\nexport class ChatService {\n  async complete(\n    messages: Array\u003C{ role: string; content: string }>,\n    options: ChatOptions = {}\n  ): Promise\u003Cstring> {\n    const client = getMistralClient();\n    const model = options.model || 'mistral-small-latest';\n\n    \u002F\u002F Check cache for deterministic requests\n    if (options.useCache && options.temperature === 0) {\n      const cached = await cache.get(messages, model);\n      if (cached) return cached;\n    }\n\n    try {\n      const response = await withRetry(() =>\n        client.chat.complete({\n          model,\n          messages,\n          temperature: options.temperature,\n          maxTokens: options.maxTokens,\n        })\n      );\n\n      const content = response.choices?.[0]?.message?.content ?? '';\n\n      \u002F\u002F Cache deterministic responses\n      if (options.useCache && options.temperature === 0) {\n        await cache.set(messages, model, content);\n      }\n\n      return content;\n    } catch (error) {\n      throw wrapMistralError(error);\n    }\n  }\n\n  async *stream(\n    messages: Array\u003C{ role: string; content: string }>,\n    options: ChatOptions = {}\n  ): AsyncGenerator\u003Cstring> {\n    const client = getMistralClient();\n    const model = options.model || 'mistral-small-latest';\n\n    try {\n      const stream = await client.chat.stream({\n        model,\n        messages,\n        temperature: options.temperature,\n        maxTokens: options.maxTokens,\n      });\n\n      for await (const event of stream) {\n        const content = event.data?.choices?.[0]?.delta?.content;\n        if (content) yield content;\n      }\n    } catch (error) {\n      throw wrapMistralError(error);\n    }\n  }\n}\n\nexport const chatService = new ChatService();\n```\n\n### Step 5: Health Check\n\n```typescript\n\u002F\u002F src\u002Fmistral\u002Fhealth.ts\nimport { getMistralClient } from '.\u002Fclient';\n\nexport interface HealthStatus {\n  status: 'healthy' | 'degraded' | 'unhealthy';\n  latencyMs: number;\n  error?: string;\n}\n\nexport async function checkMistralHealth(): Promise\u003CHealthStatus> {\n  const client = getMistralClient();\n  const start = Date.now();\n\n  try {\n    await client.models.list();\n    return {\n      status: 'healthy',\n      latencyMs: Date.now() - start,\n    };\n  } catch (error: any) {\n    return {\n      status: 'unhealthy',\n      latencyMs: Date.now() - start,\n      error: error.message,\n    };\n  }\n}\n```\n\n### Step 6: Prompt Templates\n\n```typescript\n\u002F\u002F src\u002Fmistral\u002Fprompts\u002Ftemplates.ts\nexport interface PromptTemplate {\n  system: string;\n  user: (vars: Record\u003Cstring, string>) => string;\n}\n\nexport const templates: Record\u003Cstring, PromptTemplate> = {\n  summarize: {\n    system: 'You are a helpful assistant that creates concise summaries.',\n    user: ({ text, maxWords }) =>\n      `Summarize the following text in ${maxWords || '100'} words or less:\\n\\n${text}`,\n  },\n\n  classify: {\n    system: 'You are a classifier. Respond with only the category name.',\n    user: ({ text, categories }) =>\n      `Classify the following text into one of these categories: ${categories}\\n\\nText: ${text}`,\n  },\n\n  codeReview: {\n    system: 'You are an expert code reviewer. Be concise and actionable.',\n    user: ({ code, language }) =>\n      `Review this ${language} code and suggest improvements:\\n\\n\\`\\`\\`${language}\\n${code}\\n\\`\\`\\``,\n  },\n};\n\nexport function buildPrompt(\n  templateName: keyof typeof templates,\n  vars: Record\u003Cstring, string>\n): Array\u003C{ role: string; content: string }> {\n  const template = templates[templateName];\n  return [\n    { role: 'system', content: template.system },\n    { role: 'user', content: template.user(vars) },\n  ];\n}\n```\n\n## Data Flow Diagram\n\n```\nUser Request\n     │\n     ▼\n┌─────────────┐\n│   API       │\n│   Gateway   │\n└──────┬──────┘\n       │\n       ▼\n┌─────────────┐    ┌─────────────┐\n│   Service   │───▶│   Cache     │\n│   Layer     │    │   (Redis)   │\n└──────┬──────┘    └─────────────┘\n       │\n       ▼\n┌─────────────┐\n│   Mistral   │\n│   Client    │\n└──────┬──────┘\n       │\n       ▼\n┌─────────────┐\n│  Mistral    │\n│   API       │\n└─────────────┘\n```\n\n## Instructions\n\n### Step 1: Create Directory Structure\n```bash\nmkdir -p src\u002Fmistral\u002F{handlers,prompts}\nmkdir -p src\u002Fservices\u002Fai\nmkdir -p src\u002Fapi\u002Fchat\nmkdir -p tests\u002F{unit,integration}\u002Fmistral\nmkdir -p config docs\u002Fmistral\n```\n\n### Step 2: Implement Core Components\nCreate client wrapper, config, and error handling.\n\n### Step 3: Build Service Layer\nImplement chat service with caching and retry.\n\n### Step 4: Add Health Checks\nConfigure health endpoint for monitoring.\n\n## Output\n- Structured project layout\n- Client wrapper with retry\n- Error handling implemented\n- Health checks configured\n\n## Resources\n- [Mistral AI API Reference](https:\u002F\u002Fdocs.mistral.ai\u002Fapi\u002F)\n- [Clean Architecture](https:\u002F\u002Fblog.cleancoder.com\u002Funcle-bob\u002F2012\u002F08\u002F13\u002Fthe-clean-architecture.html)\n\n## Next Steps\nFor multi-environment setup, see `mistral-multi-env-setup`.\n","# Mistral AI Reference Architecture\n\n## Overview\nProduction-ready architecture patterns for Mistral AI integrations.\n\n## Prerequisites\n- Understanding of layered architecture\n- Mistral AI SDK knowledge\n- TypeScript project setup\n- Testing framework configured\n\n## Project Structure\n\n```\nmy-mistral-project\u002F\n├── src\u002F\n│   ├── mistral\u002F\n│   │   ├── client.ts           # Singleton client wrapper\n│   │   ├── config.ts           # Environment configuration\n│   │   ├── types.ts            # TypeScript types\n│   │   ├── errors.ts           # Custom error classes\n│   │   ├── prompts\u002F            # Prompt templates\n│   │   │   ├── system.ts       # System prompts\n│   │   │   └── templates.ts    # Reusable templates\n│   │   └── handlers\u002F\n│   │       ├── chat.ts         # Chat completion handlers\n│   │       ├── embeddings.ts   # Embedding handlers\n│   │       └── tools.ts        # Function calling handlers\n│   ├── services\u002F\n│   │   └── ai\u002F\n│   │       ├── index.ts        # Service facade\n│   │       ├── chat.ts         # Chat service\n│   │       ├── rag.ts          # RAG implementation\n│   │       └── cache.ts        # Caching layer\n│   ├── api\u002F\n│   │   └── chat\u002F\n│   │       ├── route.ts        # API endpoint\n│   │       └── stream.ts       # Streaming endpoint\n│   └── jobs\u002F\n│       └── ai\u002F\n│           └── batch.ts        # Background processing\n├── tests\u002F\n│   ├── unit\u002F\n│   │   └── mistral\u002F\n│   └── integration\u002F\n│       └── mistral\u002F\n├── config\u002F\n│   ├── mistral.development.json\n│   ├── mistral.staging.json\n│   └── mistral.production.json\n└── docs\u002F\n    └── mistral\u002F\n        ├── SETUP.md\n        └── RUNBOOK.md\n```\n\n## Layer Architecture\n\n```\n┌─────────────────────────────────────────┐\n│             API Layer                    │\n│   (Routes, Controllers, Middleware)      │\n├─────────────────────────────────────────┤\n│           Service Layer                  │\n│  (Business Logic, Orchestration)         │\n├─────────────────────────────────────────┤\n│          Mistral Layer                   │\n│   (Client, Prompts, Error Handling)      │\n├─────────────────────────────────────────┤\n│         Infrastructure Layer             │\n│    (Cache, Queue, Monitoring)            │\n└─────────────────────────────────────────┘\n```\n\n## Key Components\n\n### Step 1: Client Wrapper\n\n```typescript\n\u002F\u002F src\u002Fmistral\u002Fclient.ts\nimport Mistral from '@mistralai\u002Fmistralai';\nimport { getMistralConfig } from '.\u002Fconfig';\n\nlet instance: Mistral | null = null;\n\nexport function getMistralClient(): Mistral {\n  if (!instance) {\n    const config = getMistralConfig();\n    instance = new Mistral({\n      apiKey: config.apiKey,\n      timeout: config.timeout,\n    });\n  }\n  return instance;\n}\n\nexport function resetMistralClient(): void {\n  instance = null;\n}\n```\n\n### Step 2: Configuration Management\n\n```typescript\n\u002F\u002F src\u002Fmistral\u002Fconfig.ts\nimport { z } from 'zod';\n\nconst configSchema = z.object({\n  apiKey: z.string().min(1),\n  model: z.string().default('mistral-small-latest'),\n  timeout: z.number().default(30000),\n  maxRetries: z.number().default(3),\n  cache: z.object({\n    enabled: z.boolean().default(true),\n    ttlSeconds: z.number().default(300),\n  }).default({}),\n});\n\nexport type MistralConfig = z.infer\u003Ctypeof configSchema>;\n\nexport function getMistralConfig(): MistralConfig {\n  const env = process.env.NODE_ENV || 'development';\n\n  const baseConfig = {\n    apiKey: process.env.MISTRAL_API_KEY,\n    model: process.env.MISTRAL_MODEL,\n    timeout: parseInt(process.env.MISTRAL_TIMEOUT || '30000'),\n    maxRetries: parseInt(process.env.MISTRAL_MAX_RETRIES || '3'),\n  };\n\n  return configSchema.parse(baseConfig);\n}\n```\n\n### Step 3: Error Handling\n\n```typescript\n\u002F\u002F src\u002Fmistral\u002Ferrors.ts\nexport class MistralServiceError extends Error {\n  constructor(\n    message: string,\n    public readonly code: string,\n    public readonly status?: number,\n    public readonly retryable: boolean = false,\n    public readonly originalError?: Error\n  ) {\n    super(message);\n    this.name = 'MistralServiceError';\n  }\n}\n\nexport function wrapMistralError(error: unknown): MistralServiceError {\n  if (error instanceof MistralServiceError) return error;\n\n  const err = error as any;\n\n  \u002F\u002F Rate limit\n  if (err.status === 429) {\n    return new MistralServiceError(\n      'Rate limit exceeded',\n      'RATE_LIMIT',\n      429,\n      true,\n      err\n    );\n  }\n\n  \u002F\u002F Auth error\n  if (err.status === 401) {\n    return new MistralServiceError(\n      'Authentication failed',\n      'AUTH_ERROR',\n      401,\n      false,\n      err\n    );\n  }\n\n  \u002F\u002F Server error\n  if (err.status >= 500) {\n    return new MistralServiceError(\n      'Mistral service error',\n      'SERVICE_ERROR',\n      err.status,\n      true,\n      err\n    );\n  }\n\n  return new MistralServiceError(\n    err.message || 'Unknown error',\n    'UNKNOWN',\n    err.status,\n    false,\n    err\n  );\n}\n```\n\n### Step 4: Service Layer\n\n```typescript\n\u002F\u002F src\u002Fservices\u002Fai\u002Fchat.ts\nimport { getMistralClient } from '..\u002F..\u002Fmistral\u002Fclient';\nimport { wrapMistralError } from '..\u002F..\u002Fmistral\u002Ferrors';\nimport { withRetry } from '..\u002F..\u002Futils\u002Fretry';\nimport { cache } from '.\u002Fcache';\n\nexport interface ChatOptions {\n  model?: string;\n  temperature?: number;\n  maxTokens?: number;\n  useCache?: boolean;\n}\n\nexport class ChatService {\n  async complete(\n    messages: Array\u003C{ role: string; content: string }>,\n    options: ChatOptions = {}\n  ): Promise\u003Cstring> {\n    const client = getMistralClient();\n    const model = options.model || 'mistral-small-latest';\n\n    \u002F\u002F Check cache for deterministic requests\n    if (options.useCache && options.temperature === 0) {\n      const cached = await cache.get(messages, model);\n      if (cached) return cached;\n    }\n\n    try {\n      const response = await withRetry(() =>\n        client.chat.complete({\n          model,\n          messages,\n          temperature: options.temperature,\n          maxTokens: options.maxTokens,\n        })\n      );\n\n      const content = response.choices?.[0]?.message?.content ?? '';\n\n      \u002F\u002F Cache deterministic responses\n      if (options.useCache && options.temperature === 0) {\n        await cache.set(messages, model, content);\n      }\n\n      return content;\n    } catch (error) {\n      throw wrapMistralError(error);\n    }\n  }\n\n  async *stream(\n    messages: Array\u003C{ role: string; content: string }>,\n    options: ChatOptions = {}\n  ): AsyncGenerator\u003Cstring> {\n    const client = getMistralClient();\n    const model = options.model || 'mistral-small-latest';\n\n    try {\n      const stream = await client.chat.stream({\n        model,\n        messages,\n        temperature: options.temperature,\n        maxTokens: options.maxTokens,\n      });\n\n      for await (const event of stream) {\n        const content = event.data?.choices?.[0]?.delta?.content;\n        if (content) yield content;\n      }\n    } catch (error) {\n      throw wrapMistralError(error);\n    }\n  }\n}\n\nexport const chatService = new ChatService();\n```\n\n### Step 5: Health Check\n\n```typescript\n\u002F\u002F src\u002Fmistral\u002Fhealth.ts\nimport { getMistralClient } from '.\u002Fclient';\n\nexport interface HealthStatus {\n  status: 'healthy' | 'degraded' | 'unhealthy';\n  latencyMs: number;\n  error?: string;\n}\n\nexport async function checkMistralHealth(): Promise\u003CHealthStatus> {\n  const client = getMistralClient();\n  const start = Date.now();\n\n  try {\n    await client.models.list();\n    return {\n      status: 'healthy',\n      latencyMs: Date.now() - start,\n    };\n  } catch (error: any) {\n    return {\n      status: 'unhealthy',\n      latencyMs: Date.now() - start,\n      error: error.message,\n    };\n  }\n}\n```\n\n### Step 6: Prompt Templates\n\n```typescript\n\u002F\u002F src\u002Fmistral\u002Fprompts\u002Ftemplates.ts\nexport interface PromptTemplate {\n  system: string;\n  user: (vars: Record\u003Cstring, string>) => string;\n}\n\nexport const templates: Record\u003Cstring, PromptTemplate> = {\n  summarize: {\n    system: 'You are a helpful assistant that creates concise summaries.',\n    user: ({ text, maxWords }) =>\n      `Summarize the following text in ${maxWords || '100'} words or less:\\n\\n${text}`,\n  },\n\n  classify: {\n    system: 'You are a classifier. Respond with only the category name.',\n    user: ({ text, categories }) =>\n      `Classify the following text into one of these categories: ${categories}\\n\\nText: ${text}`,\n  },\n\n  codeReview: {\n    system: 'You are an expert code reviewer. Be concise and actionable.',\n    user: ({ code, language }) =>\n      `Review this ${language} code and suggest improvements:\\n\\n\\`\\`\\`${language}\\n${code}\\n\\`\\`\\``,\n  },\n};\n\nexport function buildPrompt(\n  templateName: keyof typeof templates,\n  vars: Record\u003Cstring, string>\n): Array\u003C{ role: string; content: string }> {\n  const template = templates[templateName];\n  return [\n    { role: 'system', content: template.system },\n    { role: 'user', content: template.user(vars) },\n  ];\n}\n```\n\n## Data Flow Diagram\n\n```\nUser Request\n     │\n     ▼\n┌─────────────┐\n│   API       │\n│   Gateway   │\n└──────┬──────┘\n       │\n       ▼\n┌─────────────┐    ┌─────────────┐\n│   Service   │───▶│   Cache     │\n│   Layer     │    │   (Redis)   │\n└──────┬──────┘    └─────────────┘\n       │\n       ▼\n┌─────────────┐\n│   Mistral   │\n│   Client    │\n└──────┬──────┘\n       │\n       ▼\n┌─────────────┐\n│  Mistral    │\n│   API       │\n└─────────────┘\n```\n\n## Instructions\n\n### Step 1: Create Directory Structure\n```bash\nmkdir -p src\u002Fmistral\u002F{handlers,prompts}\nmkdir -p src\u002Fservices\u002Fai\nmkdir -p src\u002Fapi\u002Fchat\nmkdir -p tests\u002F{unit,integration}\u002Fmistral\nmkdir -p config docs\u002Fmistral\n```\n\n### Step 2: Implement Core Components\nCreate client wrapper, config, and error handling.\n\n### Step 3: Build Service Layer\nImplement chat service with caching and retry.\n\n### Step 4: Add Health Checks\nConfigure health endpoint for monitoring.\n\n## Output\n- Structured project layout\n- Client wrapper with retry\n- Error handling implemented\n- Health checks configured\n\n## Resources\n- [Mistral AI API Reference](https:\u002F\u002Fdocs.mistral.ai\u002Fapi\u002F)\n- [Clean Architecture](https:\u002F\u002Fblog.cleancoder.com\u002Funcle-bob\u002F2012\u002F08\u002F13\u002Fthe-clean-architecture.html)\n\n## Next Steps\nFor multi-environment setup, see `mistral-multi-env-setup`.\n",{"name":5,"author":47,"license":15,"version":48,"description":49,"allowed-tools":50},"Jeremy Longshore \u003Cjeremy@intentsolutions.io>","1.0.0","Implement Mistral AI reference architecture with best-practice project layout.\nUse when designing new Mistral AI integrations, reviewing project structure,\nor establishing architecture standards for Mistral AI applications.\nTrigger with phrases like \"mistral architecture\", \"mistral best practices\",\n\"mistral project structure\", \"how to organize mistral\", \"mistral layout\".\n","Read, Grep","main","90b50ed0778745a80fd5bfb13b1843d45b9e82f7","tests\u002Fext_conformance\u002Fartifacts\u002Fplugins-community\u002Fplugins\u002Fsaas-packs\u002Fmistral-pack\u002Fskills\u002Fmistral-reference-architecture",233,"https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust","https:\u002F\u002Fgithub.com\u002FDicklesworthstone","https:\u002F\u002Fwww.jeffreyemanuel.com\u002F","Building in NY","2026-11-15 01:54:15",{"source":8,"skillName":5,"commands":61,"prompt":71,"zipAvailable":72},[62,65,68],{"tool":63,"command":64},"npx","npx skills add Dicklesworthstone\u002Fpi_agent_rust --skill mistral-reference-architecture",{"tool":66,"command":67},"bunx","bunx skills add Dicklesworthstone\u002Fpi_agent_rust --skill mistral-reference-architecture",{"tool":69,"command":70},"pnpm","pnpm dlx skills add Dicklesworthstone\u002Fpi_agent_rust --skill mistral-reference-architecture","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Fplugins-community\u002Fplugins\u002Fsaas-packs\u002Fmistral-pack\u002Fskills\u002Fmistral-reference-architecture\u002FSKILL.md",true,[],[75,109,143,165,191,216],{"skillNo":76,"name":77,"nameZh":6,"description":78,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":79,"licenseFileUrl":80,"sourceHtmlUrl":81,"categories":82,"keywords":88,"publishedAt":108},"01M6FCR7G5A005P364Z6ZWCJDP","theme-factory","Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with colors\u002Ffonts that you can apply to any artifact that has been creating, or can generate a new theme on-the-fly.","Apache-2.0","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fcreative-design\u002Ftheme-factory\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fcreative-design\u002Ftheme-factory\u002FSKILL.md",[83],{"categoryNo":84,"categoryName":85,"taxonomyType":86,"taxonomyTypeDesc":87},"01JBSEEDCAT000000000000015","视觉设计","SCENARIO","使用场景",[89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107],"theme factory","factory","theme","docs","toolkit","generate","artifacts","SET","fly","slides","landing","html","styling","artifact","pages","themes","with","you","fonts","2026-11-11 15:11:14",{"skillNo":110,"name":111,"nameZh":6,"description":112,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":79,"licenseFileUrl":113,"sourceHtmlUrl":114,"categories":115,"keywords":119,"publishedAt":42},"01M6FEGPPK0ZTKCCM0R3E3KS33","web-artifacts-builder","Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn\u002Fui). Use for complex artifacts requiring state management, routing, or shadcn\u002Fui components - not for simple single-file HTML\u002FJSX artifacts.","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Futilities\u002Fweb-artifacts-builder\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Futilities\u002Fweb-artifacts-builder\u002FSKILL.md",[116],{"categoryNo":117,"categoryName":118,"taxonomyType":86,"taxonomyTypeDesc":87},"01JBSEEDCAT000000000000009","前端开发",[120,121,95,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,37,100,137,138,139,140,26,141,142],"web artifacts builder","web","artifacts builder","builder","frontend","css","components","react","component","routing","state management","state","shadcn","file","ui","Tools","Tailwind","single-file","simple","ui components","multi","jsx","suite",{"skillNo":144,"name":145,"nameZh":6,"description":146,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":79,"licenseFileUrl":147,"sourceHtmlUrl":148,"categories":149,"keywords":154,"publishedAt":42},"01M6FEE9VTK1W4GY21AKREJXRG","webapp-testing","Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fsecurity\u002Fwebapp-testing\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fsecurity\u002Fwebapp-testing\u002FSKILL.md",[150,153],{"categoryNo":151,"categoryName":152,"taxonomyType":86,"taxonomyTypeDesc":87},"01JBSEEDCAT000000000000008","测试与质量",{"categoryNo":117,"categoryName":118,"taxonomyType":86,"taxonomyTypeDesc":87},[155,156,157,124,158,159,121,160,93,161,134,162,41,163,164,105,26],"testing","webapp testing","webapp","screenshots","playwright","debugging","browser","logs","behavior","local",{"skillNo":166,"name":167,"nameZh":6,"description":168,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":169,"sourceHtmlUrl":170,"categories":171,"keywords":172,"publishedAt":42},"01M6FE20F7ZTQBFWKF4MPJ2SBX","neuropixels-analysis","Neuropixels neural recording analysis. Load SpikeGLX\u002FOpenEphys data, preprocess, motion correction, Kilosort4 spike sorting, quality metrics, Allen\u002FIBL curation, AI-assisted visual analysis, for Neuropixels 1.0\u002F2.0 extracellular electrophysiology. Use when working with neural recordings, spike sorting, extracellular electrophysiology, or when the user mentions Neuropixels, SpikeGLX, Open Ephys, Kilosort, quality metrics, or unit curation.","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fscientific\u002Fneuropixels-analysis\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fscientific\u002Fneuropixels-analysis\u002FSKILL.md",[],[173,174,175,176,177,178,179,180,37,181,182,183,184,185,186,187,105,188,189,190,26,25],"analysis","neuropixels analysis","spike","metrics","data","open","quality","user","recordings","Neural","motion","visual","quality metrics","unit","sorting","curation","recording","load",{"skillNo":192,"name":193,"nameZh":6,"description":194,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":79,"licenseFileUrl":195,"sourceHtmlUrl":196,"categories":197,"keywords":201,"publishedAt":42},"01M6FDP0PDK6F1GGX395C7625Z","skill-creator","Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Claude's capabilities with specialized knowledge, workflows, or tool integrations.","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fproductivity\u002Fskill-creator\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fproductivity\u002Fskill-creator\u002FSKILL.md",[198],{"categoryNo":199,"categoryName":200,"taxonomyType":86,"taxonomyTypeDesc":87},"01JBSEEDCAT000000000000023","Skill与智能体开发",[202,203,204,205,206,207,208,209,39,210,211,212,213,214,105,26,215,25,24],"skill creator","creator","workflows","create","update","capabilities","knowledge","tool","specialized","guide","new skill","existing skill","users","Existing",{"skillNo":217,"name":218,"nameZh":6,"description":219,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":220,"sourceHtmlUrl":221,"categories":222,"keywords":224,"publishedAt":42},"01M6FDM8Y7VK7NYG9SM7QPA3PW","notebooklm","Use this skill to query your Google NotebookLM notebooks directly from Claude Code for source-grounded, citation-backed answers from Gemini. Browser automation, library management, persistent auth. Drastically reduced hallucinations through document-only responses.","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fproductivity\u002Fnotebooklm\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fproductivity\u002Fnotebooklm\u002FSKILL.md",[223],{"categoryNo":199,"categoryName":200,"taxonomyType":86,"taxonomyTypeDesc":87},[218,225,226,227,228,229,230,161,231,232,37,233,234,235,236,26,237],"google","browser automation","gemini","automation","auth","code","library","management","only","document","query","Citation","source"]