windows-shell-reliability

Reliable command execution on Windows: paths, encoding, and common binary pitfalls.

31,392 stars

Best use case

windows-shell-reliability is best used when you need a repeatable AI agent workflow instead of a one-off prompt. It is especially useful for teams working in multi. Reliable command execution on Windows: paths, encoding, and common binary pitfalls.

Reliable command execution on Windows: paths, encoding, and common binary pitfalls.

Users should expect a more consistent workflow output, faster repeated execution, and less time spent rewriting prompts from scratch.

Practical example

Example input

Use the "windows-shell-reliability" skill to help with this workflow task. Context: Reliable command execution on Windows: paths, encoding, and common binary pitfalls.

Example output

A structured workflow result with clearer steps, more consistent formatting, and an output that is easier to reuse in the next run.

When to use this skill

  • Use this skill when you want a reusable workflow rather than writing the same prompt again and again.

When not to use this skill

  • Do not use this when you only need a one-off answer and do not need a reusable workflow.
  • Do not use it if you cannot install or maintain the related files, repository context, or supporting tools.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/windows-shell-reliability/SKILL.md --create-dirs "https://raw.githubusercontent.com/sickn33/antigravity-awesome-skills/main/plugins/antigravity-awesome-skills-claude/skills/windows-shell-reliability/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/windows-shell-reliability/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How windows-shell-reliability Compares

Feature / Agentwindows-shell-reliabilityStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/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.

Related Guides

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

31392
from sickn33/antigravity-awesome-skills

Provide systematic methodologies for discovering and exploiting privilege escalation vulnerabilities on Windows systems during penetration testing engagements.

shellcheck-configuration

31392
from sickn33/antigravity-awesome-skills

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

31392
from sickn33/antigravity-awesome-skills

PowerShell Windows patterns. Critical pitfalls, operator syntax, error handling.

posix-shell-pro

31392
from sickn33/antigravity-awesome-skills

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

nextjs-best-practices

31392
from sickn33/antigravity-awesome-skills

Next.js App Router principles. Server Components, data fetching, routing patterns.

network-101

31392
from sickn33/antigravity-awesome-skills

Configure and test common network services (HTTP, HTTPS, SNMP, SMB) for penetration testing lab environments. Enable hands-on practice with service enumeration, log analysis, and security testing against properly configured target systems.

neon-postgres

31392
from sickn33/antigravity-awesome-skills

Expert patterns for Neon serverless Postgres, branching, connection pooling, and Prisma/Drizzle integration

nanobanana-ppt-skills

31392
from sickn33/antigravity-awesome-skills

AI-powered PPT generation with document analysis and styled images

multi-agent-patterns

31392
from sickn33/antigravity-awesome-skills

This skill should be used when the user asks to "design multi-agent system", "implement supervisor pattern", "create swarm architecture", "coordinate multiple agents", or mentions multi-agent patterns, context isolation, agent handoffs, sub-agents, or parallel agent execution.

monorepo-management

31392
from sickn33/antigravity-awesome-skills

Build efficient, scalable monorepos that enable code sharing, consistent tooling, and atomic changes across multiple packages and applications.

monetization

31392
from sickn33/antigravity-awesome-skills

Estrategia e implementacao de monetizacao para produtos digitais - Stripe, subscriptions, pricing experiments, freemium, upgrade flows, churn prevention, revenue optimization e modelos de negocio SaaS.

modern-javascript-patterns

31392
from sickn33/antigravity-awesome-skills

Comprehensive guide for mastering modern JavaScript (ES6+) features, functional programming patterns, and best practices for writing clean, maintainable, and performant code.