一键导入
env-setup
Scan codebase for environment variables, generate .env.example, validate .env, and ensure .gitignore safety
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Scan codebase for environment variables, generate .env.example, validate .env, and ensure .gitignore safety
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
旅行信息查询 - 去哪儿/携程/飞猪数据查询(Expedia 中国版)
高德地图 JSAPI v2.0 (WebGL) 开发技能。涵盖地图生命周期管理、强制安全配置、3D 视图控制、覆盖物绘制及 LBS 服务集成。
高德地图综合服务,支持POI搜索、路径规划、旅游规划、周边搜索和热力图数据可视化
Token-efficient agent behavior — response sizing, context pruning, tool efficiency, and delegation
Write-Ahead Log protocol for agent state persistence. Prevents losing corrections, decisions, and context during conversation compaction. Use when: (1) receiving a user correction — log it before responding, (2) making an important decision or analysis — log it before continuing, (3) pre-compaction memory flush — flush the working buffer to WAL, (4) session start — replay unapplied WAL entries to restore lost context, (5) any time you want to ensure something survives compaction.
Scan OpenClaw skills for security vulnerabilities before installing them. Use when evaluating a new skill from ClawHub or any third-party source. Detects credential stealers, data exfiltration, malicious URLs, obfuscated code, and supply chain attacks.
| name | env-setup |
| description | Scan codebase for environment variables, generate .env.example, validate .env, and ensure .gitignore safety |
| version | 1.0.0 |
| author | Sovereign Skills |
| tags | ["openclaw","agent-skills","automation","productivity","free","env","environment","configuration","security"] |
| triggers | ["scan env vars","generate env example","check env","environment setup","env audit"] |
Scan your codebase for all referenced environment variables, generate .env.example, validate your current .env, and ensure secrets aren't committed.
Search for env var references across all common patterns:
# Node.js / JavaScript / TypeScript
grep -rn "process\.env\.\w\+" --include="*.js" --include="*.ts" --include="*.jsx" --include="*.tsx" . | grep -v node_modules | grep -v dist
# Python
grep -rn "os\.environ\|os\.getenv\|environ\.get" --include="*.py" . | grep -v __pycache__ | grep -v .venv
# Rust
grep -rn "env::var\|env::var_os\|dotenv" --include="*.rs" . | grep -v target
# Go
grep -rn "os\.Getenv\|os\.LookupEnv\|viper\." --include="*.go" . | grep -v vendor
# Docker / docker-compose
grep -rn "\${.*}" --include="*.yml" --include="*.yaml" docker-compose* 2>/dev/null
# General .env references in config files
grep -rn "env\." --include="*.toml" --include="*.yaml" --include="*.yml" . 2>/dev/null
Windows PowerShell alternative:
Get-ChildItem -Recurse -Include *.js,*.ts,*.jsx,*.tsx -Exclude node_modules,dist | Select-String "process\.env\.\w+"
Get-ChildItem -Recurse -Include *.py -Exclude __pycache__,.venv | Select-String "os\.environ|os\.getenv"
Parse grep output to extract unique variable names:
process.env.DATABASE_URL → DATABASE_URLos.environ.get("SECRET_KEY", "default") → SECRET_KEY (default: default)os.getenv("API_KEY") → API_KEYenv::var("RUST_LOG") → RUST_LOGDeduplicate and sort alphabetically. Note which file and line each var is referenced in.
Categorize each variable:
| Category | Pattern | Examples |
|---|---|---|
| 🔴 Secrets | *KEY*, *SECRET*, *TOKEN*, *PASSWORD*, *CREDENTIAL* | API_KEY, JWT_SECRET |
| 🟡 Service URLs | *URL*, *HOST*, *ENDPOINT*, *URI* | DATABASE_URL, REDIS_HOST |
| 🟢 Configuration | *PORT*, *ENV*, *MODE*, *LEVEL*, *DEBUG* | PORT, NODE_ENV, LOG_LEVEL |
| ⚪ Other | Everything else | APP_NAME, MAX_RETRIES |
Create .env.example with descriptions, categories, and safe defaults:
# ============================================
# Environment Configuration
# Generated by env-setup skill
# ============================================
# --- App Configuration ---
NODE_ENV=development
PORT=3000
LOG_LEVEL=info
# --- Database ---
DATABASE_URL=postgresql://user:password@localhost:5432/dbname
# --- Authentication (🔴 SECRET — never commit real values) ---
JWT_SECRET=change-me-in-production
API_KEY=your-api-key-here
# --- External Services ---
REDIS_URL=redis://localhost:6379
Rules:
change-me, your-xxx-here)🔴 SECRET warning on sensitive varsIf .env exists, compare against discovered variables:
## .env Validation Report
### ❌ Missing (required by code but not in .env)
- `STRIPE_SECRET_KEY` — referenced in src/billing.ts:14
- `SMTP_PASSWORD` — referenced in src/email.ts:8
### ⚠️ Unused (in .env but not referenced in code)
- `OLD_API_ENDPOINT` — may be safe to remove
### ✅ Present and referenced
- `DATABASE_URL` ✓
- `PORT` ✓
- `NODE_ENV` ✓
Check that .env is in .gitignore:
grep -q "^\.env$\|^\.env\.\*" .gitignore 2>/dev/null
If not found, offer to add:
# Environment files
.env
.env.local
.env.*.local
Also check git history for accidentally committed .env files:
git log --all --diff-filter=A -- .env .env.local .env.production 2>/dev/null
If found, warn the user that secrets may be in git history and suggest git filter-branch or BFG Repo-Cleaner.
# Environment Variable Report
| Metric | Count |
|--------|-------|
| Total vars found | 15 |
| 🔴 Secrets | 4 |
| ❌ Missing from .env | 2 |
| ⚠️ Unused in .env | 1 |
| ✅ Properly configured | 12 |
| .gitignore protection | ✅ |
NEXT_PUBLIC_* (client-exposed); flag these distinctlydocker-compose.yml environment: section too.env.development, .env.production, .env.test — validate all.env.example and a starter .env${VAR:-default} in shell scripts — extract VAR| Error | Resolution |
|---|---|
| No env vars found | Project may not use env vars — confirm with user |
| .env has syntax errors | Flag lines that don't match KEY=value pattern |
| Binary files in scan | Exclude with --binary-files=without-match |
| Permission denied on .env | Check file permissions; may need elevated access |
Built by Clawb (SOVEREIGN) — more skills at [coming soon]