Environment Doc Author
by @zshtolors
Verify real local environment facts before an agent uses machine-specific commands, runtimes, compilers, services, or startup scripts, then create or refresh...
clawhub install environment-securityπ About This Skill
name: environment-doc-author description: Verify real local environment facts before an agent uses machine-specific commands, runtimes, compilers, services, or startup scripts, then create or refresh environment baseline JSON and related environment policy, AGENTS, or skill documents from those verified facts.
Environment Doc Author
Overview
Use this skill to turn the current machine state into reusable environment guardrails. Probe the machine first, keep a machine-readable baseline JSON, and render human-readable policy fragments from verified facts only.
Use it not only when you need to generate or refresh environment documents, but also when an agent task depends on local commands, local runtimes, local package managers, local services, startup scripts, or machine-specific install roots.
This skill supports two standalone implementations:
scripts/detect_environment.js
- scripts/render_environment_docs.js
- Pure Node.js.
scripts/detect_environment.py
- scripts/render_environment_docs.py
- Requires Python 3.7+.When To Use
java, mvn, node, npm, python, go, cargo, docker, kubectl, dotnet, bundle, composer, or similar tools.environment-baseline.json, ENVIRONMENT_POLICY.md, AGENTS.environment.md, AGENTS.md environment sections, or reusable environment skill snippets.AGENTS.md, default to writing a separate environment snippet such as AGENTS.environment.md instead of overwriting the existing file.Input Constraints
.cmd/.bat script, and the real install directory.AGENTS.md unless the user explicitly asks for that file to be updated.Execution Flow
1. Read the existing baseline before probing
environment-baseline.json
- ENVIRONMENT_POLICY.md
- AGENTS.md or a dedicated environment snippet
2. Create the initial baseline when none exists
AGENTS.md already exists, write a separate environment snippet by default and keep merge work explicit and local to the relevant section.JavaScript:
node scripts/detect_environment.js --output ./environment-baseline.json
node scripts/render_environment_docs.js ./environment-baseline.json \
--policy-out ./ENVIRONMENT_POLICY.md \
--agents-out ./AGENTS.environment.md \
--skill-snippet-out ./SKILL.environment.md
Python:
python3 scripts/detect_environment.py --output ./environment-baseline.json
python3 scripts/render_environment_docs.py ./environment-baseline.json \
--policy-out ./ENVIRONMENT_POLICY.md \
--agents-out ./AGENTS.environment.md \
--skill-snippet-out ./SKILL.environment.md
Windows note for Python:
python command is new enough.3. Use targeted verification when a baseline already exists
JavaScript:
node scripts/detect_environment.js \
--baseline ./environment-baseline.json \
--tools java,maven \
--output ./environment-baseline.jsonnode scripts/render_environment_docs.js ./environment-baseline.json \
--policy-out ./ENVIRONMENT_POLICY.md \
--agents-out ./AGENTS.environment.md
Python:
python3 scripts/detect_environment.py \
--baseline ./environment-baseline.json \
--tools java,maven \
--output ./environment-baseline.jsonpython3 scripts/render_environment_docs.py ./environment-baseline.json \
--policy-out ./ENVIRONMENT_POLICY.md \
--agents-out ./AGENTS.environment.md
4. Extend the probe set only when the task requires it
javac
- Maven
- Gradle
- Node
- npm
- pnpm
- Yarn
- Python
- Go
- Rust (rustc, Cargo, Rustup)
- Clang, Clang++, GCC, G++, CMake, Make, Ninja
- Ruby, RubyGems, Bundler
- PHP, Composer
- .NET SDK
- Docker
- kubectl
- JAVA_HOME
- MAVEN_HOME
- GRADLE_HOME, GOROOT, GOPATH, CARGO_HOME, RUSTUP_HOME, DOTNET_ROOT, CC, CXX
- common runtime managers such as NVM_DIR, PYENV_ROOT, RBENV_ROOT, SDKMAN_DIR, HOMEBREW_PREFIX, VIRTUAL_ENV
- important PATH entries
5. Apply the hard rules consistently
environment-baseline.json plus fresh verification over memory or generic platform assumptions.Output Contract
environment-baseline.json: machine-readable source of truth for detected facts
- ENVIRONMENT_POLICY.md: human-readable policy and approved environment inventory
- AGENTS.environment.md or AGENTS.md snippet: hard rules for agents
- SKILL.environment.md snippet: environment section that can be reused in other skills
Resources
scripts/detect_environment.js
Standalone Node.js detector. Probes the current machine, merges with an existing baseline when requested, and emits normalized JSON.
scripts/render_environment_docs.js
Standalone Node.js renderer. Generates localized ENVIRONMENT_POLICY.md, AGENTS snippets, and skill snippets from the baseline JSON.
scripts/detect_environment.py
Python detector. Probes the current machine, merges with an existing baseline when requested, and emits normalized JSON.
scripts/render_environment_docs.py
Python renderer. Generates localized ENVIRONMENT_POLICY.md, AGENTS snippets, and skill snippets from the baseline JSON.
references/document-contracts.md
Use when you need the exact structure and maintenance rules for the generated docs.
references/probe-file.md
Use when you need to extend the default detector for services, databases, compilers, startup scripts, or project-specific tools.