Set Environment Variable

VerifiedCaution

Sets a specified environment variable to a given value. Useful for configuring runtime settings before executing other skills.

Sby Skills Guide Bot
DevOpsBeginner
506/2/2026
Claude CodeCursorWindsurfCopilotCodex
#environment-variables#configuration#system

Recommended for

Our review

Sets a specified environment variable to a given value in the nanobot's own environment.

Strengths

  • Simple and explicit input using JSON.
  • Clear error handling for invalid JSON, missing fields, and wrong types.
  • Immediate confirmation of the change.

Limitations

  • Does not persist beyond the nanobot session.
  • Only affects the nanobot's environment, not the host system.
When to use it

Use this skill when you need to temporarily configure environment variables for subsequent bot executions.

When not to use it

Avoid using it for permanent or system-wide environment changes.

Security analysis

Caution
Quality score85/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.

Findings
  • 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.

Examples

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'."
}
Related skills