← ClaudeAtlas

portability-auditlisted

Audit a codebase for Windows/POSIX portability hazards and fix them — hardcoded path separators, CRLF/LF assumptions, shelling out to POSIX-only commands, reserved Windows filenames, case-sensitivity collisions, exec-bit and signal differences. Use when the user says "make this work on Windows/Linux/Mac", "a Windows user reported it's broken", "cross-platform", "why does this fail on Windows", or before publishing a CLI/dev tool to an audience that includes both platforms. Also use proactively when you notice platform-specific code in a project that claims to be cross-platform.
0xmortuex/claude-code-skills · ★ 0 · AI & Automation · score 72
Install: claude install-skill 0xmortuex/claude-code-skills
# portability-audit Most "cross-platform" tools were only ever run on their author's platform, and the first user on the other one hits a wall of dumb, fixable breakage. The hazards are boring and finite — this is a *sweep with a checklist*, not detective work. Grep for each class, verify each hit is a real problem in context, fix it with the idiomatic construct. ## The hazard classes (sweep in this order — ordered by how often they actually break) **1. Shelling out to platform-specific commands.** Search subprocess/exec/spawn/system/backtick calls for `rm -rf`, `cp`, `mv`, `mkdir -p`, `which`, `grep`, `sed`, `awk`, `touch`, `cat`, `curl | sh`, `chmod`. Each has a stdlib replacement (`shutil.rmtree`, `fs.rm`, `os.makedirs`…) — prefer that over a Windows-conditional. Also: `sh -c` doesn't exist on Windows; `shell=True` means *different shells* on each platform, and `cmd.exe` quoting is its own hazard. **2. Path construction and comparison.** - Hardcoded separators: strings built with `'/'` mostly work on Windows APIs but break on display, comparison, and mixed input; `'\\'` breaks everywhere else. Use the path library (`pathlib`, `path.join`/`path.sep`, `filepath.Join`). - Splitting on `'/'` or `':'` (PATH uses `';'` on Windows — use the stdlib's `os.pathsep`, `path.delimiter`). - Comparing paths as strings: case-insensitive filesystems (Windows, default macOS) mean `C:\Foo` == `c:\foo`; normalize before comparing. - Hardcoded `/tmp`, `~`, `$HOME` (use the platform temp/ho