← ClaudeAtlas

cross-platform-pythonlisted

Rules for Python host code (templates/*.py, root launchers, tests) so every change runs identically on Windows, Ubuntu, and macOS the first time — host detection, path flavor, subprocess discipline, UTF-8, process replacement, and platform-portable test expectations.
FoxsterDev/xuunity-mcp · ★ 3 · AI & Automation · score 76
Install: claude install-skill FoxsterDev/xuunity-mcp
# Cross-Platform Python Guidelines The Python host runs on macOS daily and on Windows/Linux only when a colleague or CI executes it. Every rule below was earned from a real Windows failure that macOS could not reproduce (2026-07 deep review: `docs/archive/reports/2026-07-10_windows_platform_deep_review.md`). Load this skill before writing or editing any Python in `templates/`, the root `*.py` launchers, or tests. --- ## 1. Host Detection Goes Through `server_core` - `server_core.is_windows_like_host()` for user-facing flavor decisions (rendered commands, launcher names, quoting). It is env-based and covers native cmd/PowerShell, MSYS/Git Bash, and Cygwin — `os.name` alone does not. - `server_host_platform.host_platform_kind()` for adapter routing (process listing, liveness). - Never branch on `sys.platform == "darwin"` as an implicit "POSIX else Windows" split; Linux must land in the POSIX branch deliberately. ## 2. Path Flavor Is Part of the Contract - Shell-facing strings: `server_core.quoted_shell_path()` / `render_launcher_cli()` — native form + quotes on Windows-like hosts, `as_posix()` elsewhere. Never embed bare `str(path)` in a command template (see cross-platform-shell skill rule 8). - Preserve `PurePath` flavor in helpers: wrapping an incoming `PureWindowsPath` in `Path(...)` on a POSIX host silently rewrites separators. - Durable values read later by native Windows tools must be host-native; values read by Git Bash must be POSIX (cross-platform-shell skill ru