Env Loader for Openclaw

A shell-agnostic environment variable loader that generates robust, POSIX-compatible scripts to safely parse and export .env files without shell-specific parsing bugs.

wuhaichao87
v1.0.0
May 19, 2026
0
754
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install env-loader

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install env-loader using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is Env Loader?

Env Loader is a specialized tool designed to solve standard development and infrastructure parsing issues across various Unix shell environments. Standard commands like source .env behave inconsistently depending on the target system shell: zsh strips quotes correctly, bash and dash preserve quotes literally, and standard sourcing does not automatically export variables to child processes. This can cause silent application crashes and subtle deployment environment bugs.

As one of the standard Openclaw Skills, this utility bypasses these inconsistencies by generating a POSIX-compliant script that manually parses key-value pairs. By enforcing rigorous parsing logic instead of raw execution, Env Loader strips out double and single quotes consistently, validates key formatting, and guarantees explicit variable exports across bash, zsh, dash, and ash.

Env Loader Use Cases

  • Standardizing container and VM deployments where underlying default shell engines (like bash vs ash) differ.
  • Fixing silent variables bugs in CI/CD build scripts caused by quoted strings, spaces, or custom comments in .env configurations.
  • Verifying and validating .env variables proactively during multi-shell application initialization routines.
  • Replacing unsafe direct eval or source routines with sanitized, POSIX-compliant loader code blocks.

How Env Loader Works

  1. Code Generation: The utility generates a lightweight load-env.sh script specifically compiled for POSIX-compliant processing.
  2. Manual Key-Value Parsing: Instead of executing the environment file, the loader script reads it line by line to parse assignments safely.
  3. Validation & Normalization: The script evaluates key names against standard POSIX patterns, removing bounding quotes and skipping comments or invalid assignments.
  4. Context Exporting: The parser exports loaded keys sequentially to ensure that all child threads and subshells possess consistent access to variables.

Env Loader Setup

1. Generate the POSIX Loader Script

Generate your local loader helper using the provided automation tool:

bash ~/.openclaw/skills/env-loader/scripts/generate-loader.sh /path/to/project

This automatically outputs a localized load-env.sh script to your targeted directory.

2. Sourcing Environment Variables

Modify your launch, setup, or run scripts to load variables securely through the generated utility:

. ./load-env.sh .env

3. Validate Configuration Files

Verify that your configuration values are structurally valid and safe for deployment:

bash ~/.openclaw/skills/env-loader/scripts/validate-env.sh /path/to/.env

Env Loader Data Schema & Taxonomy

Generated Files

File Name Directory Details
load-env.sh Project Target Self-contained, POSIX-compliant parsing runtime.

Key Validation Pattern

The configuration tool enforces strict POSIX compliance during runtime evaluation:

  • Valid Variable Names: [A-Za-z_][A-Za-z0-9_]* (Only alphanumeric characters and underscores, starting with a non-numeric character).
  • Handling of Whitespace: Trailing spaces inside variable definitions are standardized based on bounding quotes.

Env Loader Advanced Features

  • Zero External Shell Dependencies: Avoids bashisms or zsh-specific helper modules, remaining executable under minimalistic BusyBox or Alpine ash shells.
  • Built-in Configuration Validation: Provides preemptive feedback on syntax flaws, unquoted special characters, or incorrect inline commentary.
  • Secure Parsed Sourcing: Eliminates potential execution injections by ensuring no part of the targeted configuration is executed directly.
  • Enhanced Portability: Fully compatible with automated devops toolchains utilizing Openclaw Skills to guarantee predictable execution cross-environment.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*