OS

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.zip

Installs 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.
246 charsno explicit “when” trigger
Beginner

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

You give it
A command or file operation request
You get back
OS-appropriate command execution, file operations, and path constructions

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:

AspectWindows (PowerShell)Linux / macOS (bash)
Path separator\/
Environment variable$env:VAR$VAR or ${VAR}
Home dir$env:USERPROFILE$HOME
Temp dir$env:TEMP/tmp
Line endingCRLFLF
Case sensitivityCase-insensitive pathsCase-sensitive (Linux)
Executable extension.exe, .ps1no extension
Shell syntax&&, `
Quotingdouble for interpolation, single for literalsame
File toolsbacktick escape, double-quote paths with spacessingle-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-ChildItem instead of mkdir, rm, ls for scripted operations
  • Prefer Test-Path over [ -f ] or [ -d ]
  • Git: LF/CRLF warnings are cosmetic — don't worry about them
  • Node/Python: use npx.cmd / python not npx / python3
  • Never use sudo, apt, brew, chmod, chown, systemctl, or kill -9

Linux-Specific

  • Always prefer single quotes for paths to avoid shell expansion
  • ~ expands to home directory
  • Use /tmp for temp work
  • Never use C:\ paths, $env:, or Get-ChildItem
  • No .exe extension needed
  • Be careful with case-sensitive filenames

macOS-Specific

  • Same as Linux but note brew may be available
  • $TMPDIR instead 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.

SkillInstallsUpdatedSafetyDifficulty
os-awareness (this skill)01moReviewBeginner
applescript288moReviewAdvanced
bazel-build-optimization142moNo flagsAdvanced
home-assistant-manager98moReviewAdvanced

Try saying

Example prompts that trigger this skill in your AI assistant.

Search skills

Search the agent skills registry