Windows Agent Shell Traps
Field-tested rules for coding agents on Windows: Git Bash path rewriting, PowerShell quoting and encoding, and CRLF pitfalls.
Dev & CodingIntermediate★ 788⑂ 95AI score 9/10Last updated: Nov 21, 2026
What it does
- Forces you to establish which shell actually runs the command (Git Bash, Windows PowerShell 5.1, or pwsh) before debugging.
- Documents Git Bash's rewriting of leading-slash arguments,
/c/xpath translation, drive-letter casing bugs, and junction hazards withnpm --prefix. - Covers PowerShell traps: token splitting, judging success by
$LASTEXITCODE, empty-string env vars being deleted, and the 10-minute tool timeout. - Ships
check_text.py(mojibake, BOM, CRLF, invalid UTF-8,--fix-crlf) andprobe_argv.py(what arguments and pipe encodings a program really received).
Who it's for
- Developers running Claude Code, Cursor, or Codex on Windows.
- Cross-platform teams whose macOS/Linux scripts must also work on Windows.
- Anyone repeatedly hitting "works here, breaks there" failures.
Examples
gh api /repos/owner/namefails withinvalid API endpoint: "C:/Program Files/Git/repos/..."→ drop the leading slash or setMSYS_NO_PATHCONV=1.- Em-dashes and
§turn into mojibake after a PowerShellGet-Contentedit → runpython <skill dir>/scripts/check_text.py <files>, then restore withgit checkout <good-ref> -- <file>. - Vitest reports
No test suite foundwith exit 1 → uppercase the drive letter (C:/work/app) and usenpm --prefix <dir>.
· · · Install guide · · ·
Try it now, no install
Paste this into Claude to use the skill without installing anything.
Read the instructions in this file and follow them to help me: https://raw.githubusercontent.com/phuryn/product-engineering/HEAD/agent-harness/skills/windows-agent-shell/SKILL.md What I want: (describe your task here)
If Claude can't open the link, open it yourself and paste the contents instead.
↓ If it works for you, download the ZIP below and install it. Then it runs on its own — no pasting each time.
Install in the Claude app (no terminal)
- Download the ZIP with the button below.
- In Claude, open Settings → Capabilities and turn on 'Code execution and file creation'. (one time)
- Go to Customize → Skills → + → 'Upload a skill' and upload the ZIP.
Install in Claude Code
Let Claude do it — paste this into Claude Code
Install the skill I found on AI Skill Mart. Copy the agent-harness/skills/windows-agent-shell folder from the GitHub repo phuryn/product-engineering into my ~/.claude/skills/windows-agent-shell/. When it's done, tell me in one line what this skill can do.
Install with a command instead
git clone https://github.com/phuryn/product-engineering.git /tmp/product-engineering && mkdir -p ~/.claude/skills && cp -r /tmp/product-engineering/agent-harness/skills/windows-agent-shell ~/.claude/skills/⚠ This is a third-party skill. Check the source repository before installing.
- Open a terminal (Git Bash recommended on Windows).
- Clone the repo:
git clone https://github.com/phuryn/product-engineering.git - Create the skills folder:
mkdir -p ~/.claude/skills - Copy the skill:
cp -r product-engineering/agent-harness/skills/windows-agent-shell ~/.claude/skills/ - Verify
SKILL.mdplus thescripts/andreferences/folders came along. - Restart Claude Code and trigger it with a prompt like "my Windows output came back garbled".
- The bundled scripts need Python — confirm with
python --version.
View source on GitHub ↗License: MIT