Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

mistral-multi-env-setup

БесплатноБез исполняемых скриптовНе проверен

Configure Mistral AI across development, staging, and production environments. Use when setting up multi-environment deployments, configuring per-environment…

majiayu000от majiayu000★ 31 звезда на GitHub

Об этом скилле

Mistral AI Multi-Environment Setup

Overview

Configure Mistral AI across development, staging, and production environments.

Prerequisites

  • Separate Mistral AI API keys per environment
  • Secret management solution (Vault, AWS Secrets Manager, GCP Secret Manager)
  • CI/CD pipeline with environment variables
  • Environment detection in application

Environment Strategy

Environment Purpose API Keys Model Selection
Development Local dev Test keys mistral-small-latest
Staging Pre-prod testing Staging keys Same as prod
Production Live traffic Production keys Optimized selection

Instructions

Step 1: Configuration Structure

config/
├── mistral/
│   ├── base.ts           # Shared configuration
│   ├── development.ts    # Dev overrides
│   ├── staging.ts        # Staging overrides
│   └── production.ts     # Prod overrides

Step 2: Base Configuration

// config/mistral/base.ts
export const baseConfig = {
  defaultModel: 'mistral-small-latest',
  timeout: 30000,
  maxRetries: 3,
  cache: {
    enabled: true,
    ttlSeconds: 300,
  },
  rateLimits: {
    requestsPerMinute: 60,
    tokensPerMinute: 500000,
  },
};

Step 3: Environment-Specific Configs

// config/mistral/development.ts
import { baseConfig } from './base';

export const developmentConfig = {
  ...baseConfig,
  apiKey: process.env.MISTRAL_API_KEY_DEV,
  debug: true,
  cache: {
    enabled: false, // Disable cache in dev for testing
    ttlSeconds: 60,
  },
  rateLimits: {
    requestsPerMinute: 10,
    tokensPerMinute: 100000,
  },
};
// config/mistral/staging.ts
import { baseConfig } from './base';

export const stagingConfig = {
  ...baseConfig,
  apiKey: process.env.MISTRAL_API_KEY_STAGING,
  debug: false,
  cache: {
    enabled: true,
    ttlSeconds: 300,
  },
};
// config/mistral/production.ts
import { baseConfig } from './base';

export const productionConfig = {
  ...baseConfig,
  apiKey: process.env.MISTRAL_API_KEY_PROD,
  debug: false,
  timeout: 60000,
  maxRetries: 5,
  cache: {
    enabled: true,
    ttlSeconds: 600,
  },
};

Step 4: Environment Detection

// config/mistral/index.ts
import { developmentConfig } from './development';
import { stagingConfig } from './staging';
import { productionConfig } from './production';

type Environment = 'development' | 'staging' | 'production';

const configs = {
  development: developmentConfig,
  staging: stagingConfig,
  production: productionConfig,
};

export function detectEnvironment(): Environment {
  const env = process.env.NODE_ENV || 'development';

  if (env === 'production') return 'production';
  if (env === 'staging' || process.env.VERCEL_ENV === 'preview') return 'staging';
  return 'development';
}

export function getMistralConfig() {
  const env = detectEnvironment();
  const config = configs[env];

  if (!config.apiKey) {
    throw new Error(`MISTRAL_API_KEY not set for environment: ${env}`);
  }

  return {
    ...config,
    environment: env,
  };
}

Step 5: Secret Management

Local Development (.env.local)

# .env.local (git-ignored)
MISTRAL_API_KEY_DEV=your-dev-api-key

GitHub Actions (secrets)

# .github/workflows/deploy.yml
jobs:
  deploy-staging:
    environment: staging
    env:
      MISTRAL_API_KEY_STAGING: ${{ secrets.MISTRAL_API_KEY_STAGING }}

  deploy-production:
    environment: production
    env:
      MISTRAL_API_KEY_PROD: ${{ secrets.MISTRAL_API_KEY_PROD }}

AWS Secrets Manager

# Store secrets
aws secretsmanager create-secret \
  --name mistral/production/api-key \
  --secret-string "your-api-key"

# Retrieve in code
aws secretsmanager get-secret-value \
  --secret-id mistral/production/api-key
import { SecretsManager } from '@aws-sdk/client-secrets-manager';

const sm = new SecretsManager({ region: 'us-east-1' });

async function getMistralApiKey(env: string): Promise<string> {
  const { SecretString } = await sm.getSecretValue({
    SecretId: `mistral/${env}/api-key`,
  });
  return SecretString!;
}

GCP Secret Manager

# Store secret
echo -n "your-api-key" | gcloud secrets create mistral-api-key-prod --data-file=-

# Grant access
gcloud secrets add-iam-policy-binding mistral-api-key-prod \
  --member="serviceAccount:[email protected]" \
  --role="roles/secretmanager.secretAccessor"
import { SecretManagerServiceClient } from '@google-cloud/secret-manager';

const client = new SecretManagerServiceClient();

async function getMistralApiKey(env: string): Promise<string> {
  const [version] = await client.accessSecretVersion({
    name: `projects/my-project/secrets/mistral-api-key-${env}/versions/latest`,
  });
  return version.payload?.data?.toString()!;
}

Step 6: Environment Isolation

// Prevent accid
Полный SKILL.md на GitHub

Установить mistral-multi-env-setup в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Read
Write
Edit
Bash(aws:*)
Bash(gcloud:*)
Bash(vault:*)

Вложенные файлы

metadata.json

FAQ

Что делает скилл mistral-multi-env-setup?

Configure Mistral AI across development, staging, and production environments. Use when setting up multi-environment deployments, configuring per-environment secrets, or implementing environment-specific Mistral AI configurations. Trigger with phrases like "mistral environments", "mistral staging", "mistral dev prod", "mistral environment setup", "mistral config by env".

Как установить скилл mistral-multi-env-setup?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл mistral-multi-env-setup запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить mistral-multi-env-setup с