agentleFS
roborracleroborracle/agent-workflow-kit/skills/env-config/SKILL.md

env-config

Skill0 starsChanged 3 months agoMITView on GitHub

Design and manage application configuration across environments. Covers environment variable conventions, startup validation, config parity checks, and .env.example maintenance.

  • Reads credentials

4 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

2 rules. 0 are common, 1 is distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 4 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Every variable in .env must exist in .env.example (with empty or default value)

    line 74
  2. Distinctive:

    Verify staging mirrors production config structure:

    line 87

“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Environment & Configuration Manager

Environment Variable Design

Naming Convention

[APP]_[CATEGORY]_[NAME]

APP_DB_HOST=localhost
APP_DB_PORT=5432
APP_REDIS_URL=redis://localhost:6379
APP_STRIPE_SECRET_KEY=sk_test_...
APP_LOG_LEVEL=info
APP_FEATURE_NEW_CHECKOUT=true

Required vs. Optional

// Required — fail fast at startup if missing
const DB_HOST = requireEnv('APP_DB_HOST');

// Optional — use sensible default
const LOG_LEVEL = process.env.APP_LOG_LEVEL || 'info';
const PORT = parseInt(process.env.PORT || '3000', 10);

Startup Validation Pattern

function validateConfig(): Config {
  const errors: string[] = [];

  const required = ['DATABASE_URL', 'SESSION_SECRET', 'API_KEY'];
  for (const key of required) {
    if (!process.env[key]) errors.push(`Missing required: ${key}`);
  }

  const port = parseInt(process.env.PORT || '3000', 10);
  if (isNaN(port) || port < 1 || port > 65535) {
    errors.push(`Invalid PORT: ${process.env.PORT}`);
  }

  if (errors.length > 0) {
    console.error('Configuration errors:\n' + errors.map(e => `  - ${e}`).join('\n'));
    process.exit(1);
  }

  return { /* validated config object */ };
}

.env File Management

.env.example Template

# Database
APP_DB_HOST=localhost         # Required — local or cloud DB host

# External Services
APP_STRIPE_SECRET_KEY=        # Required — get from Stripe dashboard

# Application
APP_LOG_LEVEL=info            # debug | info | warn | error

Rules

  • .env is ALWAYS in .gitignore — never committed
  • .env.example is ALWAYS committed — documents all variables
  • Every variable in .env must exist in .env.example (with empty or default value)
  • Comments in .env.example explain where to get each value
  • Mark required vs. optional clearly

Environment Parity

Configuration per Environment

VariableDevelopmentStagingProduction
LOG_LEVELdebuginfowarn
API keystest keystest keysproduction keys

Parity Check

Verify staging mirrors production config structure:

  • Same env vars defined (different values expected)
  • Same services connected (different instances)
  • Same feature flags available (different states OK)

Feature Flags

// Simple boolean flags from env vars
const FEATURES = {
  newCheckout: process.env.APP_FEATURE_NEW_CHECKOUT === 'true',
  betaApi: process.env.APP_FEATURE_BETA_API === 'true',
};

// Usage
if (FEATURES.newCheckout) { /* new path */ }

Anti-Patterns

  • Hardcoded values that differ between environments (URLs, ports, keys)
  • Reading process.env deep inside business logic (read at startup, pass as config)
  • Environment-specific if statements in code (if (NODE_ENV === 'production'))
  • Secrets in docker-compose.yml, CI config, or Dockerfiles
  • Using NODE_ENV for anything other than framework behavior

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.