windows-shell-interop
Skill23 starsChanged 8 days agoApache-2.0View on GitHub
Use for UnicodeEncodeError, console mojibake (cp1252), PowerShell 5.1 vs 7, or a path/quoting trap across PowerShell, Git Bash, cmd and Windows paths. Not a Linux-only script. Compose volumes -> docker-compose.
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 53
Read references/encoding_fix_ladder.md when a UnicodeEncodeError or mojibake needs the cheapest robust fix, ordered by cost.
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Resolve the execution boundary first
Identify the interpreter, working directory, filesystem and process domain: PowerShell, cmd, Git Bash, WSL or container. Do not pass a Windows path to a Linux tool as though it were a Linux path. Shared visibility of files is not shared process, credential, lock or dependency state.
Prefer native Windows tooling over WSL. Where a project's own scripts still run in WSL, one command name can resolve to two programs: inside WSL, pwsh is the distro's Linux PowerShell and pwsh.exe is Windows PowerShell 7 through interop. On Windows itself, PowerShell 7 may be a Microsoft Store install reached only through an alias in %LOCALAPPDATA%\Microsoft\WindowsApps, with no C:\Program Files\PowerShell\7 — probe with Get-Command pwsh, never a guessed install path. A Windows script that drives Windows tools runs as pwsh.exe -NoProfile -File <script> with a Windows-style -File path (wslpath -w from a Linux absolute path). A Windows SDK executed by a Linux interpreter over a /mnt/* path reads through 9P: measured minutes per call, not a universal SLA — do not run it that way for anything latency-sensitive.
Prefer native file operations or direct argv. For complicated shell logic, use an owned script with an explicit target rather than nested quoting. Keep file encoding explicit where needed and inspect pipe/console behavior instead of assuming one encoding for every Windows process: a Python script run bare on Windows inherits the console's code page (often cp1252), so UnicodeEncodeError and mojibake on non-ASCII output are console-encoding symptoms, not a broken string — run it as python -X utf8 script.py instead of python script.py.
Preserve the actual child exit code before formatting output. Catch only an expected condition that has a valid recovery; file absence and access denied are different. Do not use empty catch blocks, trailing successful commands or shell pipelines to conceal failure.
Traps measured on this kind of host
- Git Bash (MSYS) rewrites an argument that starts with
/into a Windows path:tasklist /FI ...and a value like/root/xarrive asC:/Program Files/Git/..., and the command fails or writes the wrong value quietly. Run Windows tools from PowerShell, or prefix that one command withMSYS_NO_PATHCONV=1, and read the result back. - Stopping a shell (a tool timeout, a task stop,
timeout Nin Git Bash) does not stop the processes it started: a dev server keeps its port. Record the PID of what you launched, confirm it is still yours (same process start time), stop its tree (taskkill /PID <pid> /T /F), then confirm the port is free (Get-NetTCPConnection -LocalPort <n>). Never kill by port or name alone: that process may belong to someone else. - Text with backslash escapes or non-ASCII goes into a file through the runtime's file-writing tool, not a heredoc or
echo: the shell layer may rewrite both.
Read references/encoding_fix_ladder.md when a UnicodeEncodeError or mojibake needs the cheapest robust fix, ordered by cost; read references/shell_equivalents_cheatsheet.md when the same operation needs an equivalent PowerShell, Git Bash and Python-file spelling.
Test the relevant portability contract
Reproduce the actual command with the path or encoding that failed. For reusable interop code, include the applicable spaces, Unicode, failure exit and path-domain negative case. Do not build an exhaustive cross-product of all shells for a one-time read command. Do not claim Windows behavior from a Linux-only test.
Preserve reparse points and unknown ownership; keep Windows and Linux dependency environments separate. No new daemon, global shell configuration or dependency installation merely to complete a local task. Remove only owned temporary artifacts.
In this repository21 other files it gives its agents.
- claude-code-orchestratorSkill
- codebase-designSkill
- code-reviewSkill
- codex-subagent-routingSkill
- diagnosing-bugsSkill
- docker-composeSkill
- exhaustive-repo-cleanup-auditSkill
- gemini-cli-orchestratorSkill
- grok-build-orchestratorSkill
- kill-slopSkill
- kimi-cli-orchestratorSkill
- layered-testing-executorSkill
- legacy-code-changeSkill
- pragmatic-engineeringSkill
- refactoring-catalogSkill
- security-reviewSkill
- tddSkill
- test-auditSkill
- testing-e2e-playwrightSkill
- worktree-lifecycleSkill
- xp-agile-deliverySkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

