agentleFS
SonghongleiSonghonglei/better-agent-skills/skills/hello-env/SKILL.md

hello-env

Skill4 starsChanged 5 months agoMITView on GitHub

Zero-dependency Bash environment health check for Linux, macOS, containers, and K8s pods. Reports OS, current user, Node.js, Python3, basic tools (git/curl/jq/make/docker) with paths and versions, network (hostname, IP, inferred subnet), container/K8s detection with a configurable env-var probe, workdir and git status, optional config-file check, and PVC remount detection (device-number plus watch-dir count snapshot diff to catch silent K8s PersistentVolume reattach to a fresh disk). Three-layer config — CLI flags override env vars override defaults. Trigger when user wants to check the environment, verify a dev box is healthy, detect container or K8s context, look up local IP or subnet, see Node and Python versions, list installed basic tools, or watch for silent PVC rotation in K8s pods. Also triggers on 检查我的环境, 环境自检, hello-env, 查看系统信息, 环境有没有问题, IP 是多少, 在什么环境, PVC 换卷了吗, 基础工具检查, node 版本, 当前用户是谁.

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    If neither, you get a hint:

    line 146

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “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

hello-env

A zero-dependency Bash health check for any dev environment — host, container, or K8s pod.

一个零依赖的开源环境自检脚本,适用于本地、容器、K8s Pod 环境。

Pure bash. No Python, no npm, no third-party packages. Works on macOS, Linux, and inside containers.

Compatibility

PlatformStatus
Linux (any distro)✅ Full
macOS (bash 3.2.57+ default)✅ Full — uses ${!var} indirect expansion (no eval; bash 2.0+)
Windows (WSL / WSL2)✅ Full (effectively Linux)
Windows (Git Bash / MSYS / Cygwin)⚠️ Partial — OS/user/tools/network checks work; cgroup container detection and PVC monitoring are skipped (Linux-only kernel features)
Windows (PowerShell / cmd)❌ Not supported by design (bash script)
Agent PlatformStatus
Claude Code✅ Standard SKILL.md, drops in
Codex✅ Same
OpenClaw✅ Native format
Cursor / Cline / others✅ Generic Markdown + bash, no platform hooks

Quick start

# Run with defaults (current directory as workdir, default K8s probe vars)
bash scripts/check-env.sh

# Custom workdir
bash scripts/check-env.sh --workdir /opt/myapp

# Probe extra environment variables (comma-separated)
bash scripts/check-env.sh --probe-env "MY_REGION,MY_TIER,DEPLOY_ENV"

# Force PVC monitoring (when K8s probe vars are absent but you still want it)
bash scripts/check-env.sh --force-pvc

# Combine
bash scripts/check-env.sh \
  --workdir /opt/myapp \
  --watch-dir /opt/myapp/plugins \
  --config /etc/myapp/config.json \
  --probe-env "MY_REGION,MY_TIER" \
  --force-pvc

What it checks

#ModuleOutput
1OSmacOS / Linux distro + version
2Current Userwhoami + UID/GID
3Node.jsPath (which node) + version
4Python3Path + version
5Basic Toolsgit, curl, jq, docker, make — present / missing
6NetworkHostname + IP + inferred private subnet (10.x / 172.16-31.x / 192.168.x)
7Container / K8sProbes configurable env vars; defaults to KUBERNETES_SERVICE_HOST + K8S_NAMESPACE; falls back to /.dockerenv / cgroup heuristics
8WorkdirPath exists + git initialized check
9Config fileOnly checked if --config <path> provided
10PVC persistenceMount device-number + watch-dir count snapshot diff (auto when K8s probe hits, or --force-pvc)

Output legend: ✅ ok · ℹ️ info · ⚠️ warning · ❌ failure


CLI flags

FlagDefaultDescription
--workdir <path>pwdWorking directory to check (existence + git init)
--watch-dir <path><workdir>Directory whose subfolder count is snapshotted for PVC monitoring
--config <path>(unset)Optional config file to check existence
--probe-env "A,B,C"KUBERNETES_SERVICE_HOST,K8S_NAMESPACEComma-separated env vars to probe for container/K8s context
--force-pvcoffForce PVC monitoring even when no K8s indicator is found
--snapshot-dir <path><workdir>/.hello-envWhere to store device/count snapshots
-h, --help—Show inline help

Environment variables (lower priority than CLI flags)

VariableEquivalent flag
HELLO_ENV_WORKDIR--workdir
HELLO_ENV_WATCH_DIR--watch-dir
HELLO_ENV_CONFIG--config
HELLO_ENV_PROBE_ENV--probe-env
HELLO_ENV_FORCE_PVC=1--force-pvc
HELLO_ENV_SNAPSHOT_DIR--snapshot-dir

PVC remount detection (why this matters)

K8s PersistentVolumes can silently get reattached to a fresh disk during pod restarts or node failover. Symptoms users typically see:

"All the files I created yesterday are gone after the pod restarted."

This script catches it early by snapshotting on each run:

  • <snapshot-dir>/last-device — the mount device for <workdir>
  • <snapshot-dir>/last-watch-count — find <watch-dir> -maxdepth 1 -mindepth 1 -type d | wc -l

Next run decides:

DeviceWatch-dir countVerdict
changedany⚠️ Likely PVC remount
unchangeddecreasedℹ️ Probably manual removal
unchangednot decreased✅ Healthy

When PVC monitoring activates:

  • Any of the env vars listed in --probe-env is set, OR
  • --force-pvc / HELLO_ENV_FORCE_PVC=1 is on

If neither, you get a hint:

ℹ️ Not detected as containerized environment. Use --force-pvc to enable PVC monitoring anyway.


Examples

CI runner sanity check

bash scripts/check-env.sh --workdir "$CI_PROJECT_DIR" --probe-env "CI,GITLAB_CI,GITHUB_ACTIONS"

K8s pod with custom labels

bash scripts/check-env.sh \
  --probe-env "KUBERNETES_SERVICE_HOST,K8S_NAMESPACE,MY_REGION,MY_TIER" \
  --watch-dir /workspace/plugins

Local Docker container without K8s

bash scripts/check-env.sh --force-pvc --workdir /app

Exit codes

  • 0 — All checks ran (warnings allowed)
  • Non-zero only on argument parsing errors

This is a diagnostic tool, not a gate. It reports — it doesn't block.

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.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

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.