# Env Doctor

> 项目跑前环境配置体检:检测缺失的 .env 文件、对比 .env.example 找出未配置的 key 和空值 key,提前报警别等运行时炸。当用户说「体检环境 / 检查 env / .env 缺了什么 / 跑前配置检查 / 环境变量有没有配好」时触发。

- **Type:** Skill
- **Install:** `agentstack add skill-yuaicode-ai-skills-env-doctor`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [YuAICode](https://agentstack.voostack.com/s/yuaicode)
- **Installs:** 0
- **Category:** [AI & ML](https://agentstack.voostack.com/c/ai-and-ml)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [YuAICode](https://github.com/YuAICode)
- **Source:** https://github.com/YuAICode/ai-skills/tree/main/skills/env-doctor

## Install

```sh
agentstack add skill-yuaicode-ai-skills-env-doctor
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# env-doctor — 环境配置体检

项目跑前先体检,缺啥提前报,别等运行时炸一脸。

## 何时触发

用户说以下任意一种:
- "体检环境 / 检查 env / 看看 env 配好没"
- ".env 缺了什么 / 环境变量有没有配好"
- "跑前配置检查 / 帮我检查一下环境配置"
- "为什么程序读不到环境变量"

## 用法

1. 跑体检脚本(纯 bash,无外部依赖):
   ```bash
   bash /bin/check-env.sh [项目目录]
   # 项目目录缺省 = 当前目录
   # 例:bash env-doctor/bin/check-env.sh ~/my-project
   ```

2. 脚本自动识别模板文件(.env.example / .env.sample / .env.template)并输出:
   - 有模板没有 .env → 警告,给出 `cp` 命令
   - 有模板有 .env → 列出**缺失的 key** 和**值为空的 key**
   - 无缺失 → 配置完整提示

3. 根据输出给用户中文说明:
   - **缺失 key**:在 .env.example 里有,但 .env 里没有该行
   - **空值 key**:key 存在但等号右侧为空(如 `DB_PASSWORD=`)
   - 建议编辑 .env 补全后再次运行体检确认

4. 常见坑提醒:
   > 有些项目(如 Go、Java、C)不会自动加载 .env 文件。
   > 跑程序前需手动导入:
   > ```bash
   > set -a; source .env; set +a
   > ```
   > 只在当前 shell 生效;新终端或子进程需重新导入。

## 退出码约定

| 退出码 | 含义 |
|--------|------|
| `0` | 配置完整,或无模板可对比 |
| `0` | 有模板但 .env 缺失(警告,不阻断) |
| `2` | 存在缺失 key 或空值 key,需用户补全 |
| `1` | 脚本本身出错(目录不存在等) |

## 硬规则

- **只读不改**:脚本只读取 .env 和模板文件,绝不修改任何文件(除非用户明确要求补全)。
- **不臆造 key 含义**:不猜测 key 该填什么值,只列出缺失和空值;若用户问某个 key 怎么填,结合项目上下文作答。
- **不联网、不扫历史**:纯本地体检。

## 边界

- 只解析 `KEY=VALUE` 格式的行;不处理 `export KEY=VAL`(export 前缀)的 shell 脚本风格(可扩展)。
- 不检测 .env 里多余的 key(只看 .env.example 里有的)。
- 不验证值的格式/有效性(如 URL 格式、token 长度),只看是否为空。

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [YuAICode](https://github.com/YuAICode)
- **Source:** [YuAICode/ai-skills](https://github.com/YuAICode/ai-skills)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** yes
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-yuaicode-ai-skills-env-doctor
- Seller: https://agentstack.voostack.com/s/yuaicode
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
