Définir une variable d'environnement

VérifiéPrudence

Permet de définir une variable d'environnement avec un nom et une valeur spécifiques. Utile pour configurer l'environnement d'exécution avant d'autres opérations.

Spar Skills Guide Bot
DevOpsDébutant
6002/06/2026
Claude CodeCursorWindsurfCopilotCodex
#environment-variables#configuration#system

Recommandé pour

Notre avis

Définit une variable d'environnement spécifiée avec une valeur donnée dans l'environnement du nanobot.

Points forts

  • Interface simple et explicite en entrée JSON.
  • Gestion des erreurs claire (JSON invalide, champs manquants, types incorrects).
  • Confirmation immédiate de la modification.

Limites

  • Ne persiste pas au-delà de la session du nanobot.
  • N'affecte que l'environnement du nanobot, pas le système hôte.
Quand l'utiliser

Utilisez cette compétence lorsque vous avez besoin de configurer temporairement des variables d'environnement pour les exécutions ultérieures du bot.

Quand l'éviter

Évitez de l'utiliser pour des modifications d'environnement persistantes ou globales.

Analyse de sécurité

Prudence
Score qualité85/100

The skill allows arbitrary environment variable setting, which can alter system behavior and potentially be exploited if input is user-controlled or malicious. It does not directly execute harmful commands, but the impact depends on how the environment is used by subsequent processes.

Points d'attention
  • No restrictions on which environment variables can be set; could overwrite critical variables like PATH, HOME, or inject malicious values if input is not trusted.

Exemples

Set API key
Set the environment variable MY_API_KEY to value abc123
Configure database URL
Set environment variable DATABASE_URL to postgresql://localhost:5432/mydb
---
name: environment-variable-set
description: Sets a specified environment variable to a given value.
metadata:
  nanobot:
    emoji: ⚙️
    category: system
    tags:
      - environment
      - configuration
      - system
  dependencies: []
---

## Instructions

This skill allows you to set environment variables.  Environment variables are key-value pairs that provide configuration information to running processes.  This skill modifies the environment of the nanobot itself.

**Input:**

The input to this skill is a JSON object with the following structure:

```json
{
  "variable_name": "string",
  "variable_value": "string"
}
  • variable_name: The name of the environment variable to set. This must be a string.
  • variable_value: The value to assign to the environment variable. This must be a string.

Process:

  1. Parse the input JSON object.
  2. Extract the variable_name and variable_value from the parsed JSON.
  3. Set the environment variable with the specified name to the specified value. This will affect subsequent skill executions and any internal processes the nanobot uses.
  4. Confirm the setting of the environment variable.

Output:

The output of this skill is a simple confirmation message:

{
  "status": "success",
  "message": "Environment variable '{variable_name}' set to '{variable_value}'."
}

Error Handling:

  • If the input is not valid JSON, return an error:

    {
      "status": "error",
      "message": "Invalid JSON input."
    }
    
  • If variable_name or variable_value are missing from the JSON, return an error:

    {
      "status": "error",
      "message": "Missing 'variable_name' or 'variable_value' in input."
    }
    
  • If variable_name or variable_value are not strings, return an error:

    {
      "status": "error",
      "message": "'variable_name' and 'variable_value' must be strings."
    }
    

Example:

Input:

{
  "variable_name": "MY_API_KEY",
  "variable_value": "abcdef123456"
}

Output:

{
  "status": "success",
  "message": "Environment variable 'MY_API_KEY' set to 'abcdef123456'."
}
Skills similaires