env-check Skill
This skill allows the agent to precisely identify the host environment to avoid cross-platform command errors.
🛠️ Usage
Use this skill before running any OS-specific terminal commands if the environment is unknown.
Detection Logic
- Check OS: Use
ADDITIONAL_METADATA(preferred) orrun_commandwith$PSVersionTable(Windows) oruname -a(POSIX). - Check Shell: Identify if the terminal is
PowerShell,cmd,bash,zsh, etc. - Check Tool Availability: Verify if specific binaries like
rg,grep,jq, orgitare available in thePATH.
💻 Platform-Specific Command Mapping
| Task | Windows (PowerShell) | POSIX (Bash/Zsh) | Platform Tool (Best) |
| :--- | :--- | :--- | :--- |
| Search Text | Select-String -Pattern "query" -Path "file" | grep "query" "file" | grep_search |
| List Files | Get-ChildItem -Recurse | ls -R | list_dir |
| Read File | Get-Content "file" | cat "file" | view_file |
| JSON Parse | ConvertFrom-Json | jq | (N/A) |
🛡️ Best Practices
- Priority: ALWAYS prefer platform-native tools (
grep_search,list_dir,view_file) as they work consistently across all operating systems. - Fallback: If a shell command is necessary, use a conditional block to provide both Windows and POSIX equivalents.
- Verification: Never assume a tool exists. Use
Get-Command(Windows) orwhich(POSIX) to verify before execution.