home / skills / ntaksh42 / agents / environment-manager

environment-manager skill

/.claude/skills/environment-manager

This skill helps manage environment configurations and secrets across environments by generating .env templates and validating required variables.

npx playbooks add skill ntaksh42/agents --skill environment-manager

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
1.5 KB
---
name: environment-manager
description: Manage environment configurations, secrets, and .env files across environments. Use when configuring application environments or managing secrets.
---

# Environment Manager Skill

環境変数管理を支援するスキルです。

## 主な機能

- **.env ファイル生成**: テンプレート作成
- **環境変数検証**: 必須項目チェック
- **セキュリティ**: 機密情報の扱い
- **ドキュメント**: 変数の説明

## .env テンプレート

```bash
# Database
DATABASE_URL=postgresql://user:password@localhost:5432/myapp
DATABASE_POOL_SIZE=10

# Redis
REDIS_URL=redis://localhost:6379
REDIS_TTL=3600

# API Keys (Never commit actual keys!)
STRIPE_SECRET_KEY=sk_test_...
SENDGRID_API_KEY=SG...

# App Config
NODE_ENV=development
PORT=3000
LOG_LEVEL=debug

# JWT
JWT_SECRET=your-secret-key-here
JWT_EXPIRES_IN=7d
```

## .env.example

```bash
# Database Configuration
DATABASE_URL=postgresql://user:password@host:5432/dbname

# API Keys (Get from https://dashboard.stripe.com)
STRIPE_SECRET_KEY=

# Application
NODE_ENV=development
PORT=3000
```

## 環境変数検証

```javascript
// config/env.js
const requiredEnvVars = [
  'DATABASE_URL',
  'REDIS_URL',
  'JWT_SECRET'
];

function validateEnv() {
  const missing = requiredEnvVars.filter(key => !process.env[key]);

  if (missing.length > 0) {
    throw new Error(`Missing required environment variables: ${missing.join(', ')}`);
  }
}

validateEnv();
```

## バージョン情報
- Version: 1.0.0

Overview

This skill manages environment configurations, secrets, and .env files across development, staging, and production. It helps generate consistent .env templates, validate required variables at startup, and provide concise documentation for each variable. The goal is safer, more reproducible deployments and clearer secrets handling.

How this skill works

The skill creates .env and .env.example templates tailored to typical services (database, cache, APIs, auth). It runs validation routines to detect missing required variables and can flag insecure patterns like committing secrets. It also produces short descriptions for each variable so teams understand purpose and source.

When to use it

  • Initializing a new project and creating a baseline .env.example
  • Onboarding new developers so they know required environment variables
  • Before CI/CD deployment to ensure all required secrets are present
  • When rotating or auditing secrets to identify usage and exposure
  • Standardizing environment files across multiple services or microservices

Best practices

  • Keep .env files out of version control; commit only .env.example with placeholders
  • Store real secrets in a secure vault and inject them at runtime in CI/CD or hosting platform
  • Validate required environment variables early in application startup to fail fast
  • Document purpose, format, and source for each variable in the example file
  • Use different values per environment and avoid sharing production secrets with lower environments

Example use cases

  • Generate a .env.example for a web app that includes DB, Redis, API keys, and JWT settings
  • Run a startup check that throws a clear error listing missing required variables
  • Audit an existing repo to replace literal secrets with placeholders and create a migration plan to a secret store
  • Provide onboarding instructions and a minimal template so new developers can run the app locally
  • Integrate validation into CI to block deployments when required environment variables are missing

FAQ

How does validation behave in CI or local runs?

Validation lists missing required variables and fails early; integrate it into CI to prevent deployments with incomplete configs.

Should I commit real secrets to the repository?

No. Commit only templates (.env.example) with placeholders. Use a secrets manager or platform environment variables for real values.

Can the skill help document each variable?

Yes. It generates short descriptions for variables in the example file to clarify purpose, expected format, and recommended source.