windows-shell-reliability
Reliable command execution on Windows: paths, encoding, and common binary pitfalls.
Best use case
windows-shell-reliability is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Reliable command execution on Windows: paths, encoding, and common binary pitfalls.
Teams using windows-shell-reliability should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/windows-shell-reliability/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How windows-shell-reliability Compares
| Feature / Agent | windows-shell-reliability | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Reliable command execution on Windows: paths, encoding, and common binary pitfalls.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Windows Shell Reliability Patterns > Best practices for running commands on Windows via PowerShell and CMD. ## When to Use Use this skill when developing or debugging scripts and automation that run on Windows systems, especially when involving file paths, character encoding, or standard CLI tools. --- ## 1. Encoding & Redirection ### CRITICAL: Redirection Differences Across PowerShell Versions Older Windows PowerShell releases can rewrite native-command output in ways that break later processing. PowerShell 7.4+ preserves the byte stream when redirecting stdout, so only apply the UTF-8 conversion workaround when you are dealing with older shell behavior or a log file that is already unreadable. | Problem | Symptom | Solution | |---------|---------|----------| | `dotnet > log.txt` | `view_file` fails in older Windows PowerShell | `Get-Content log.txt | Set-Content -Encoding utf8 log_utf8.txt` | | `npm run > log.txt` | Need a UTF-8 text log with errors included | `npm run ... 2>&1 | Out-File -Encoding UTF8 log.txt` | **Rule:** Prefer native redirection as-is on PowerShell 7.4+, and use explicit UTF-8 conversion only when older Windows PowerShell redirection produces an unreadable log. --- ## 2. Handling Paths & Spaces ### CRITICAL: Quoting Windows paths often contain spaces. | ❌ Wrong | ✅ Correct | |----------|-----------| | `dotnet build src/my project/file.fsproj` | `dotnet build "src/my project/file.fsproj"` | | `& C:\Path With Spaces\bin.exe` | `& "C:\Path With Spaces\bin.exe"` | **Rule:** Always quote absolute and relative paths that may contain spaces. ### The Call Operator (&) In PowerShell, if an executable path starts with a quote, you MUST use the `&` operator. **Pattern:** ```powershell & "C:\Program Files\dotnet\dotnet.exe" build ... ``` --- ## 3. Common Binary & Cmdlet Pitfalls | Action | ❌ CMD Style | ✅ PowerShell Choice | |--------|-------------|---------------------| | Delete | `del /f /q file` | `Remove-Item -Force file` | | Copy | `copy a b` | `Copy-Item a b` | | Move | `move a b` | `Move-Item a b` | | Make Dir | `mkdir folder` | `New-Item -ItemType Directory -Path folder` | **Tip:** Using CLI aliases like `ls`, `cat`, and `cp` in PowerShell is usually fine, but using full cmdlets in scripts is more robust. --- ## 4. Dotnet CLI Reliability ### Build Speed & Consistency | Context | Command | Why | |---------|---------|-----| | Fast Iteration | `dotnet build --no-restore` | Skips redundant nuget restore. | | Clean Build | `dotnet build --no-incremental` | Ensures no stale artifacts. | | Background | `Start-Process dotnet -ArgumentList 'run' -RedirectStandardOutput output.txt -RedirectStandardError error.txt` | Launches the app without blocking the shell and keeps logs. | --- ## 5. Environment Variables | Shell | Syntax | |-------|--------| | PowerShell | `$env:VARIABLE_NAME` | | CMD | `%VARIABLE_NAME%` | --- ## 6. Long Paths Windows has a 260-character path limit by default. **Fix:** If you hit long path errors, use the extended path prefix: `\\?\C:\Very\Long\Path\...` --- ## 7. Troubleshooting Shell Errors | Error | Likely Cause | Fix | |-------|-------------|-----| | `The term 'xxx' is not recognized` | Path not in $env:PATH | Use absolute path or fix PATH. | | `Access to the path is denied` | File in use or permissions | Stop process or run as Admin. | | `Encoding mismatch` | Older shell redirection rewrote the output | Re-export the file as UTF-8 or capture with `2>&1 | Out-File -Encoding UTF8`. | --- ## Limitations - Use this skill only when the task clearly matches the scope described above. - Do not treat the output as a substitute for environment-specific validation, testing, or expert review. - Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
Related Skills
windows-privilege-escalation
Provide systematic methodologies for discovering and exploiting privilege escalation vulnerabilities on Windows systems during penetration testing engagements.
shellcheck-configuration
Master ShellCheck static analysis configuration and usage for shell script quality. Use when setting up linting infrastructure, fixing code issues, or ensuring script portability.
powershell-windows
PowerShell Windows patterns. Critical pitfalls, operator syntax, error handling.
posix-shell-pro
Expert in strict POSIX sh scripting for maximum portability across Unix-like systems. Specializes in shell scripts that run on any POSIX-compliant shell (dash, ash, sh, bash --posix).
linux-shell-scripting
Provide production-ready shell script templates for common Linux system administration tasks including backups, monitoring, user management, log analysis, and automation. These scripts serve as building blocks for security operations and penetration testing environments.
busybox-on-windows
How to use a Win32 build of BusyBox to run many of the standard UNIX command line tools on Windows.
find-skills
Helps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express interest in extending capabilities. This skill should be used when the user is looking for functionality that might exist as an installable skill.
vercel-cli-with-tokens
Deploy and manage projects on Vercel using token-based authentication. Use when working with Vercel CLI using access tokens rather than interactive login — e.g. "deploy to vercel", "set up vercel", "add environment variables to vercel".
vercel-react-view-transitions
Guide for implementing smooth, native-feeling animations using React's View Transition API (`<ViewTransition>` component, `addTransitionType`, and CSS view transition pseudo-elements). Use this skill whenever the user wants to add page transitions, animate route changes, create shared element animations, animate enter/exit of components, animate list reorder, implement directional (forward/back) navigation animations, or integrate view transitions in Next.js. Also use when the user mentions view transitions, `startViewTransition`, `ViewTransition`, transition types, or asks about animating between UI states in React without third-party animation libraries.
vercel-react-native-skills
React Native and Expo best practices for building performant mobile apps. Use when building React Native components, optimizing list performance, implementing animations, or working with native modules. Triggers on tasks involving React Native, Expo, mobile performance, or native platform APIs.
deploy-to-vercel
Deploy applications and websites to Vercel. Use when the user requests deployment actions like "deploy my app", "deploy and give me the link", "push this live", or "create a preview deployment".
vercel-composition-patterns
React composition patterns that scale. Use when refactoring components with boolean prop proliferation, building flexible component libraries, or designing reusable APIs. Triggers on tasks involving compound components, render props, context providers, or component architecture. Includes React 19 API changes.