os-awareness
Forces the agent to identify the host operating system before executing commands or file operations.
Install
mkdir -p .claude/skills/os-awareness && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/16315" && unzip -o skill.zip -d .claude/skills/os-awareness && rm skill.zipInstalls to .claude/skills/os-awareness
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Forces the AI to detect, confirm, and remember the host operating system before any command execution, file operation, or path construction. Prevents Linux-isms on Windows, wrong path separators, incorrect shebangs, and incompatible shell syntax.Key capabilities
- →Detect the host operating system (Windows, macOS, Linux)
- →Remember the detected OS for the entire session
- →Adapt path separators based on the OS
- →Adjust environment variable syntax for the OS
- →Provide OS-specific command and tool usage guidance
How it works
The skill detects the host operating system at the start of a session and retains this information. It then uses the detected OS to guide command execution, file operations, and path constructions, adapting syntax and tools accordingly.
Inputs & outputs
When to use os-awareness
- →Executing shell commands on mixed-OS environments
- →Building cross-platform scripts
- →Standardizing path separators and shell syntax
About this skill
OS Awareness
Rule 1: Detect Before You Act
Before running any command, reading any file, or writing any path, explicitly know what OS you're on. Do not assume.
If you don't know, run one of these at the very start of the session:
- Windows:
[System.Environment]::OSVersion.VersionString - macOS / Linux:
uname -a
Rule 2: Remember the OS for the Entire Session
Once detected, keep it in context. Do not re-detect unless you're in a new session or a subagent that wasn't told.
Key differences to track:
| Aspect | Windows (PowerShell) | Linux / macOS (bash) |
|---|---|---|
| Path separator | \ | / |
| Environment variable | $env:VAR | $VAR or ${VAR} |
| Home dir | $env:USERPROFILE | $HOME |
| Temp dir | $env:TEMP | /tmp |
| Line ending | CRLF | LF |
| Case sensitivity | Case-insensitive paths | Case-sensitive (Linux) |
| Executable extension | .exe, .ps1 | no extension |
| Shell syntax | &&, ` | |
| Quoting | double for interpolation, single for literal | same |
| File tools | backtick escape, double-quote paths with spaces | single-quote paths |
Rule 3: OS-Specific Gotchas
Windows-Specific
- Always quote paths with spaces:
"C:\Program Files\..."— pwsh will split on spaces without quotes - Use
New-Item,Remove-Item,Get-ChildIteminstead ofmkdir,rm,lsfor scripted operations - Prefer
Test-Pathover[ -f ]or[ -d ] - Git: LF/CRLF warnings are cosmetic — don't worry about them
- Node/Python: use
npx.cmd/pythonnotnpx/python3 - Never use
sudo,apt,brew,chmod,chown,systemctl, orkill -9
Linux-Specific
- Always prefer single quotes for paths to avoid shell expansion
~expands to home directory- Use
/tmpfor temp work - Never use
C:\paths,$env:, orGet-ChildItem - No
.exeextension needed - Be careful with case-sensitive filenames
macOS-Specific
- Same as Linux but note
brewmay be available $TMPDIRinstead of/tmp(usually)- Case-insensitive filesystem by default (like Windows)
Rule 4: Subagents Must Be Told
When spawning a subagent via task, include the OS info in the prompt so the subagent doesn't have to re-detect.
Example: "The host OS is Windows 11 (pwsh). Use PowerShell syntax and Windows paths."
Cross-references
-
anti-global-install — OS detection prevents wrong install paths on Windows.
-
portable-self-contained — Portable environment setup depends on OS-aware paths.
-
toolchain-fallback — Toolchain paths and fallback strategies differ per OS; OS-aware detection is required.
-
anti-global-install — OS detection determines correct install paths vs global defaults.
-
skill-loader — Apply the capped selection policy when deciding which platform-aware skills should also be active for cross-platform tasks.
Bundled OS detection script
A bundled script at scripts/detect-os.ps1 (PowerShell) returns the host OS environment:
.\scripts\detect-os.ps1 # human-readable report
.\scripts\detect-os.ps1 -Json # JSON for programmatic use
Returns: platform (Windows/macOS/Linux), shell, path separator, case sensitivity, line ending convention, and syntax notes for each OS.
To use as a project-local tool:
cp <skill-path>/os-awareness/scripts/detect-os.ps1 .ai_scripts/
.ai_scripts\detect-os.ps1 -Json
When not to use it
- →When assuming the OS without explicit detection
- →When using Linux-specific commands on Windows
- →When using Windows-specific commands on Linux/macOS
Limitations
- →Does not assume OS; requires explicit detection.
- →Subagents must be explicitly told the OS information.
- →Bundled script for detection is PowerShell-based.
How it compares
This skill proactively detects and remembers the operating system to ensure all subsequent commands and path constructions are OS-appropriate, preventing errors that arise from cross-platform syntax differences, unlike manually adjusting fo
Compared to similar skills
os-awareness side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| os-awareness (this skill) | 0 | 1mo | Review | Beginner |
| applescript | 28 | 8mo | Review | Advanced |
| bazel-build-optimization | 14 | 2mo | No flags | Advanced |
| home-assistant-manager | 9 | 8mo | Review | Advanced |
Try saying
Example prompts that trigger this skill in your AI assistant.
You might also like
applescript
martinholovsky
Expert in AppleScript and JavaScript for Automation (JXA) for macOS system scripting. Specializes in secure script execution, application automation, and system integration. HIGH-RISK skill due to shell command execution and system-wide control capabilities.
bazel-build-optimization
wshobson
Optimize Bazel builds for large-scale monorepos. Use when configuring Bazel, implementing remote execution, or optimizing build performance for enterprise codebases.
home-assistant-manager
komal-SkyNET
Expert-level Home Assistant configuration management with efficient deployment workflows (git and rapid scp iteration), remote CLI access via SSH and hass-cli, automation verification protocols, log analysis, reload vs restart optimization, and comprehensive Lovelace dashboard management for tablet-optimized UIs. Includes template patterns, card types, debugging strategies, and real-world examples.
swarm-advanced
ruvnet
Advanced swarm orchestration patterns for research, development, testing, and complex distributed workflows
windows-expert
jackspace
Expert guidance for Windows, PowerShell, WSL interop, and cross-platform development
bash-linux
davila7
Bash/Linux terminal patterns. Critical commands, piping, error handling, scripting. Use when working on macOS or Linux systems.