Token导航 LogoToken导航TokenDH.com
研究检索敏感数据github未标认证来源可访问许可证需确认审计通过

environment-awareness环境意识

Agent Skill

environment-awareness 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

261

周安装

11

GitHub Stars

24

下载量

92
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:environment-awareness(环境意识)
来源仓库:https://github.com/noobygains/godmode
仓库路径:skills/environment-awareness
安装命令:
npx skills add https://github.com/noobygains/godmode --skill environment-awareness
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/noobygains/godmode --skill environment-awareness

简介

environment-awareness 防止 AI Agent 在不了解系统环境的情况下盲目执行命令,提升操作安全性。

  • 适用于 Codex、Claude、Cursor、Gemini CLI 中需跨 OS、包管理器或虚拟环境协作的任务场景。
  • 强制在运行任何 shell 命令前先检测操作系统、shell 类型和 Python/Node 版本等关键信息。
  • 遵循‘一次探测,十次避免’原则,禁止无环境确认的自动化脚本执行,尤其涉及生产系统时需双重校验。
  • 适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

SKILL.md

Environment Awareness

Overview

The most common AI agent failure mode: running Linux commands on Windows, using npm when the project uses pnpm, ignoring active virtual environments. Every wrong command wastes time and can cause real damage.

Core principle: DETECT the environment before issuing ANY shell command. One probe now prevents ten failed commands later.

No exceptions. No workarounds. No shortcuts.

The Prime Directive

NO SHELL COMMANDS WITHOUT KNOWING THE TARGET ENVIRONMENT

If you have not confirmed OS, shell, and package manager, you are not authorized to run commands.

When to Use

Mandatory at session start:

  • First interaction in any new conversation
  • Switching to a different project or repository
  • After entering a container, VM, or remote machine

Also required when:

  • A command fails with "not found" or "not recognized"
  • Installing dependencies or running build scripts
  • Writing platform-specific code (file paths, process management, networking)
  • Diagnosing "works on my machine" problems

Do not skip when:

  • You think you already know the environment (verify, do not assume)
  • The user mentions their OS casually (confirm shell and toolchain too)
  • Working in CI/CD (runners have different environments than local machines)

The Entry Protocol

BEFORE running any shell command:

1. PLATFORM: Have you confirmed OS and architecture?
2. SHELL: Do you know which shell is interpreting your commands?
3. PACKAGE MANAGER: Have you checked for lockfiles?
4. RUNTIMES: Do you know which language runtimes are available?
5. VIRTUAL ENV: Are there active virtual environments or version managers?

If any answer is NO: probe first, command second.

Detection Flowchart

digraph env_detect {
    rankdir=TB;
    node [shape=box, style=filled, fillcolor="#e8e8e8"];

    start [label="Session Start", shape=oval, fillcolor="#ccffcc"];
    os [label="1. Detect OS\nprocess.platform\nor uname", shape=diamond, fillcolor="#ffffcc"];
    shell [label="2. Detect Shell\n$SHELL / $PSVersionTable\n/ COMSPEC", shape=diamond, fillcolor="#ffffcc"];
    pkg [label="3. Detect Package Manager\nCheck lockfiles\nin project root", shape=diamond, fillcolor="#ffffcc"];
    runtime [label="4. Detect Runtimes\nnode/python/go\n--version", shape=diamond, fillcolor="#ffffcc"];
    venv [label="5. Check Virtual Envs\nVIRTUAL_ENV / CONDA\nnvm / rbenv", shape=diamond, fillcolor="#ffffcc"];
    container [label="6. Container Check\n/.dockerenv\nor cgroup", shape=diamond, fillcolor="#ffffcc"];
    ready [label="Environment Known\nProceed with\ncorrect commands", shape=oval, fillcolor="#ccffcc"];

    start -> os -> shell -> pkg -> runtime -> venv -> container -> ready;
}

Detection Checklist

Run this sequence once per session. Results inform every subsequent command.

1. Operating System

MethodWorks OnCommand
Environment variableClaude Code / NodeCheck process.platform in tool context
unameLinux, macOS, Git Bashuname -s
System infoWindows (any shell)systeminfo or ver

Key distinctions:

  • win32 = Windows (regardless of 32/64-bit)
  • darwin = macOS
  • linux = Linux or WSL (check further with grep -i microsoft /proc/version for WSL)

2. Shell

NEVER assume bash. Windows alone has CMD, PowerShell, Git Bash, and WSL.

CheckCommandReveals
Shell variableecho $SHELLDefault shell (Unix)
PowerShell test$PSVersionTablePowerShell version
Process nameecho $0Current shell (Unix)
COMSPECecho %COMSPEC%CMD path (Windows)

Critical: On Windows, the Claude Code / AI agent shell context is often Git Bash, but the user's terminal may be PowerShell. Commands you generate for the user to copy must match THEIR shell.

3. Package Manager

Detection priority -- check lockfiles first:

LockfilePackage Manager
bun.lockb or bun.lockbun
pnpm-lock.yamlpnpm
yarn.lockyarn
package-lock.jsonnpm

If no lockfile found:

  1. Check packageManager field in package.json
  2. Check for global install: which pnpm || which yarn || which bun
  3. Default to npm only as last resort

For non-JS projects:

FileManager
Pipfile.lockpipenv
poetry.lockpoetry
uv.lockuv
requirements.txtpip
go.sumgo modules
Cargo.lockcargo
Gemfile.lockbundler

4. Runtime Versions

Probe on first use, not eagerly. Only check what the project actually needs.

node --version      # Node.js
python3 --version   # Python (use python3, not python, on macOS/Linux)
go version          # Go
rustc --version     # Rust
java --version      # Java
ruby --version      # Ruby

5. Virtual Environments

SignalIndicates
$VIRTUAL_ENV is setPython venv/virtualenv active
$CONDA_DEFAULT_ENV is setConda environment active
.python-version filepyenv version pinned
.nvmrc or .node-version fileNode version pinned
.ruby-version filerbenv/rvm version pinned
.tool-versions fileasdf version manager

When a version manager is detected: Use its commands (nvm use, pyenv shell) instead of assuming the global runtime is correct.

6. Container Detection

CheckInside Container?
/.dockerenv existsDocker
grep -q container /proc/1/cgroup 2>/dev/nullDocker/Podman
$container env var is setPodman
printenv KUBERNETES_SERVICE_HOSTKubernetes pod

System Inventory

After confirming the platform and shell, discover what tools, databases, cloud CLIs, and services the user has installed. This inventory feeds directly into planning -- if the user has SQLite but not PostgreSQL, or Docker but not Podman, downstream skills like deployment-advisor and task-planning can make smarter recommendations instead of guessing.

When to Run

  • Always: Git, GitHub CLI (needed by many GodMode skills)
  • If the project touches data: Database CLIs
  • If the project will be deployed: Cloud and container tools
  • If the project processes media or structured data: ffmpeg, jq, curl
  • Never run the full list blindly. Match checks to project type. A static site does not need a MongoDB probe.

Inventory Checks

Run each relevant check silently, redirecting stderr so missing tools do not produce noise:

Databases:

ToolCheckNotes
PostgreSQLpsql --version 2>/dev/nullCheck for pg_dump too if backups matter
MySQL / MariaDBmysql --version 2>/dev/nullMariaDB identifies itself in the version string
SQLitesqlite3 --version 2>/dev/nullOften pre-installed on macOS and Linux
MongoDBmongod --version 2>/dev/nullAlso check mongosh for the modern shell
Redisredis-server --version 2>/dev/nullAlso check redis-cli

Cloud & Hosting CLIs:

ToolCheck
AWS CLIaws --version 2>/dev/null
Google Cloudgcloud --version 2>/dev/null
Azure CLIaz --version 2>/dev/null
Vercelvercel --version 2>/dev/null
Supabasesupabase --version 2>/dev/null
Fly.iofly version 2>/dev/null
Netlifynetlify --version 2>/dev/null
Railwayrailway --version 2>/dev/null

Container Tools:

ToolCheck
Dockerdocker --version 2>/dev/null
Docker Composedocker compose version 2>/dev/null
Podmanpodman --version 2>/dev/null

Developer Tools:

ToolCheck
Gitgit --version 2>/dev/null
GitHub CLIgh --version 2>/dev/null
curlcurl --version 2>/dev/null
jqjq --version 2>/dev/null
ffmpegffmpeg -version 2>/dev/null

Reporting Format

Report findings concisely. Do not dump raw version output -- extract the version number and summarize:

Available: PostgreSQL 16.2, Docker 27.1, gh 2.45, SQLite 3.43
Not found: Redis, AWS CLI, Podman

Principles

  1. Silence errors and force exit code 0. Always redirect stderr to /dev/null AND append ; true at the end of chained version checks. Missing tools produce non-zero exit codes that surface as red errors in Claude Code. A missing tool is information, not a failure — the output must never show red. # WRONG: last missing tool causes exit 127 (red error in Claude Code) psql --version 2>/dev/null; redis-server --version 2>/dev/null; mongod --version 2>/dev/null # RIGHT: force clean exit regardless of which tools are missing psql --version 2>/dev/null; redis-server --version 2>/dev/null; mongod --version 2>/dev/null; true
  2. Scope to project. Only check categories relevant to the codebase. Read the project's config files, Dockerfile, CI config, or deployment manifests to decide what matters.
  3. Check once, reference often. Store results in your working context. Do not re-probe mid-session unless the user installs something new.
  4. Feed downstream skills. The inventory directly informs deployment-advisor (what can we deploy to?), task-planning (what constraints exist?), and project-bootstrap (what do we need to install?).

Platform-Specific Command Mappings

Use the correct command for the detected environment:

OperationLinux/macOSWindows CMDWindows PowerShellGit Bash on Windows
List filesls -ladirGet-ChildItemls -la
Find process`ps aux \grep`tasklistGet-Process`ps aux \grep`
Set env varexport VAR=valset VAR=val$env:VAR = "val"export VAR=val
Null device/dev/nullNUL$null/dev/null
Path separator:;;:
Delete filerm filedel fileRemove-Item filerm file
Find filesfind. -namedir /s /bGet-ChildItem -Recursefind. -name
Check portlsof -i:PORTnetstat -anGet-NetTCPConnectionnetstat -an

When to Probe vs Assume

CategoryActionReason
OSALWAYS probeAffects every command's syntax
ShellALWAYS probeDetermines quoting, piping, redirection
Package managerALWAYS probeWrong manager corrupts lockfile
Runtime versionsProbe on first useOnly matters when running that runtime
Virtual environmentsProbe when relevantWrong env installs to wrong location
ContainerProbe when behavior is unexpectedContainers lack many host tools

Cognitive Traps

RationalizationWhat Is Actually True
"It's probably Linux"30% of developers use Windows. macOS is another 25%. Probe first.
"bash is universal"Windows CMD and PowerShell have fundamentally different syntax. Git Bash exists but is not guaranteed.
"npm is the default"Using npm in a pnpm project corrupts the lockfile and breaks CI.
"I'll fix it if the command fails"A failed rm -rf with wrong path syntax can still delete data. Failed installs leave broken state.
"The user said Windows, so PowerShell"Could be CMD, Git Bash, WSL, or Cygwin. Confirm the shell, not just the OS.
"CI and local are the same"CI runners use different OS, different shell, different tool versions. Probe there too.

Guardrails -- HALT and Detect

Stop and run detection if you catch yourself:

  • Running ls without knowing if the shell supports it
  • Using /dev/null without confirming Unix-like shell
  • Running npm install without checking for other lockfiles
  • Using python instead of python3 without version checking
  • Assuming ~ expands correctly (it does not in CMD)
  • Writing path strings with / without confirming OS
  • Using grep flags without confirming GNU vs BSD
  • Piping commands without knowing if the shell supports |

Every item on this list means: halt command execution. Probe first.

Integration

Complementary skills:

  • godmode:project-bootstrap -- Environment detection runs during project setup
  • godmode:fault-diagnosis -- Environment mismatch is a common root cause of mysterious failures
  • godmode:workspace-isolation -- Worktree and container setup needs correct platform commands
  • godmode:deployment-advisor -- System inventory results feed directly into deployment recommendations and platform selection

The Bottom Line

One detection probe now > ten failed commands later

Know the OS. Know the shell. Know the package manager. Before the first command. Every single session.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

35.11%
按下载量换算32

Claude

27.31%
按下载量换算25

Cursor

18.35%
按下载量换算17

Gemini CLI

9.83%
按下载量换算9

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills