cross-platform
Skill4 starsChanged 59 days agoMITView on GitHub
Use when code, tests, scripts or agents must work on both Windows and Linux (including WSL), when CI runs on an operating system the local gates do not, when a Windows-hosted agent edits files or runs shell commands, or when something passes on one OS and fails on the other. Covers running the other OS's CI legs locally before a push, path and build-path assumptions, line endings and byte-exact edits, shell and console encoding traps, and git across the Windows/WSL boundary (never export GIT_DIR to test processes). Not for platform-specific product features.
3 other projects use a version of this.
Adopted by
Most recently taken up by
- Kangentic/kangentictheir own version, first seen Oct 5, 2026
- foxgeeek/adskillstheir own version, first seen Apr 24, 2026
- mylee04/code-notifytheir own version, first seen Feb 4, 2026
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 3
- mylee04/code-notify★ 289same name
- Kangentic/kangentic★ 124same name
- foxgeeek/adskills★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository14 other files it gives its agents.
- agent-fleetSkill
- architecture-auditSkill
- automating-agent-guardrailsSkill
- claude-cloud-sessionsSkill
- devlogSkill
- dotnet-engineeringSkill
- engineering-standardsSkill
- performance-diagnosisSkill
- reviewSkill
- roslyn-analysisSkill
- spec-compliance-auditSkill
- spec-oracleSkill
- test-gateSkill
- variant-analysisSkill
The file
Files
Cross-platform: Windows and Linux without surprises
A test that passes on one operating system proves nothing about the other. Paths, line endings, shells, console encodings, file locking and git configuration all differ, and each difference is invisible from the side you are on. Make the other side cheap to check before you push, and write code that never has to guess which side it's on.
Why: in one 24-hour stretch of a Windows-hosted, Linux-CI project, eight separate incidents came from these differences: a Windows path literal that was relative on Linux, build paths baked into binaries, git unable to read a worktree across the boundary, a line-ending setting visible to only one git, a git variable that let a test corrupt the shared repository, a text tool that silently rewrote a file's line endings, escapes mangled on their way into a shell, and a console that could not print a character. (Practice — not yet validated: the rules below each come from one incident.)
When to use
- CI runs on an OS your local gates don't (Linux CI with Windows development, or the reverse).
- A test, script or tool touches paths, processes, shells, files, git, environment variables or encodings.
- An agent on Windows edits files or composes shell commands.
- Something passes on one OS and fails on the other.
1. Run the other OS's CI legs locally, before the push
- Every gate runs the other OS's legs, landers and implementers alike, when the cost allows. Measure it: in one project the whole Linux test population ran under WSL in about 3–4 minutes, so no selection of "platform-sensitive changes" was worth its misses.
- Build and test a clone on the target OS. Clone the committed HEAD (
git clone --sharedborrows the object store read-only) onto the target's own filesystem, then build and test it there, the way CI does. Don't run binaries built on the other OS: anything that embeds build paths breaks (see 2). - Export nothing into the original tree. The gate's own reads pass their git settings inline (
git -c …). - Keep a drift test that holds the local legs equal to the test projects the CI jobs run, and see it fail once on a planted gap.
Why: a new test was green in every Windows gate and red in CI's Linux unit job, a ~30-minute round trip and a
dropped change. The local Linux leg reproduced exactly that one red in about 2.5 minutes. agent-fleet/references/landing.md carries
the fleet rule. (Practice — not yet validated.)
1b. CI's environment is a build input: pin it, declare it, reproduce it locally
The invariant: CI should never fail when the same code was tested locally by the same processes. CI is the verification of the local process, never its first run. So every CI red is a defect in the LOCAL process as well as in the code: find why the local gate did not see it and fix that in the same change (a missing leg, an unpinned tool, a setting CI has and the local run lacks), then sweep for the others like it. Keep a drift test that maps every CI job to a local leg or to a recorded reason it cannot run locally.
- Pin the runner image and keep the local environment the same release. A floating label (
ubuntu-latest) moves when the provider decides, so no local gate can match it. Pin the image (ubuntu-26.04) and keep the local distro on the same release (a WSL distro can be upgraded in place). The provider's own migration notice is the warning: read it. - A tool that reads text with the platform's default charset has a hidden input. A parser generator on the JVM read a
grammar as UTF-8 locally (Java 18+ defaults to UTF-8) and as Cp1252 on the Windows CI runner, so a set of Unicode
characters became repeated Latin characters: an error only in CI, invisible to every local gate. Declare the encoding in
the tool's invocation (
-encoding UTF-8) and use UTF-8 everywhere, rather than avoiding non-ASCII text. Reproduce the CI behaviour locally with the JVM option-Dfile.encoding=COMPAT, which makes the JVM use the native charset, and keep a drift test that the invocation passes the encoding. Write characters that do not display (controls, noncharacters) as Unicode escapes so a reader can see them. - Run every CI job that can run locally. A CI job with no local equivalent (here a guard job whose conformance loop ran only on CI) is the next CI-only red. Survey the differences once (runner image, SDK, JDK and shell patch versions, Debug versus Release, locale and time zone, compile caches, shard composition, jobs and audits with no local counterpart) and settle each as identical, reproduced locally, or irreducible with the reason recorded.
Why: two clusters were dropped from landing trains in a day for failures that only CI could see (the charset, and the guard job), each costing a ~30-minute CI round trip. (Practice — not yet validated: two measured incidents; the pin and the survey are recent.)
2. Paths: never assume the host's shape
- Never feed a path literal from one OS to another OS's path API.
Path.GetFullPath(@"E:\repo\x")on Linux is a RELATIVE path under the current directory. A test that plants a path must plant the form that is real on the OS it runs on, so it proves the code on each OS rather than only on the author's. - Build paths are embedded.
[CallerFilePath], source-relative fixture lookups, debug symbols and some generators bake the BUILD machine's absolute paths into the binary. Binaries built on Windows and run on Linux resolveE:\…as relative. Measured: 363 false test failures. Build on the OS that runs the tests. - Case and separators. Linux file names are case-sensitive, and Windows accepts both separators. Compare paths with the platform's rules, and join them with the platform's API.
- Drive letters and backslashes in tests are the first thing to search for when a test fails only on Linux.
(Practice — not yet validated.)
3. Line endings and byte-exact edits
- Know which files are CRLF, and edit them as BYTES: read bytes, replace, write bytes, then check that the diff
touches only the intended lines. Line-oriented text tools can normalize every ending. Measured: a one-line
sededit to a CRLF log turned its whole top section into LF, a 493-line diff for a 2-line change. - Some files must stay LF. Shell scripts run by bash, and scripts a tool refuses to run with CR in them: a
workflow runner rejected a script whose CRLF read as "control characters". On Windows, Python's
write_textemits CRLF, so write bytes or passnewline="\n". Pin the rule in.gitattributes(*.sh text eol=lf). core.autocrlflives where the other git can't see it. Git for Windows sets it in its SYSTEM config, so Linux git on the same tree (through WSL) reports every CRLF-checked-out file as modified. Measured: 9,543 "changes" on a clean tree. Pass-c core.autocrlf=trueinline when reading a Windows checkout from Linux.- BOMs. An encoding that adds a byte-order mark (Python's
utf-8-sigwhen writing) changes the file's first bytes, and a parser or a diff sees them.
(Practice — not yet validated.)
4. Shells, commands and consoles
- Write per-OS commands explicitly; never translate one OS's command string into another's. A "cross-platform"
helper that replaced
>nulwith>/dev/nullleft the cmd-onlyexit /b 7untouched, and on Linuxshreturned exit code 2, not 7. A substitution covers only the tokens you thought of. - Don't send escape-heavy scripts through heredocs or nested quoting. Tool and shell layers each get a chance to rewrite backslashes. Write the script to a file with a file-writing tool and run the file.
- Console encoding. A Windows console's default code page (cp1252) cannot print many characters, and a script
that prints them crashes, not the code under test. Set
PYTHONIOENCODING=utf-8or reconfigure stdout to UTF-8 in the script. - Environment variables. Their names are case-insensitive on Windows and case-sensitive on Linux.
- Process semantics. Exit codes, signals and file locking differ: Windows locks an open file against deletion, and Linux does not. A test that depends on locking or ACLs is proven only on the OS it runs on.
(Practice — not yet validated.)
5. Git across the Windows/WSL boundary
- A Windows worktree is not readable by Linux git as-is. Its
.gitis a file naming a Windows gitdir (gitdir: E:/repo/.git/worktrees/x), and a tree under/mnttrips git's ownership check (safe.directory). - ⛔ Never EXPORT
GIT_DIRorGIT_WORK_TREEinto processes that run tests. A test that creates its own scratch repository (git init, a commit,git worktree addin a temp directory) is silently redirected to the REAL repository.- Measured:
core.worktreewas written into the shared.git/config, and every git command in every checkout failed until a person removed it. An agent was (rightly) denied the permission to change shared config. - Pass git settings inline for your own reads, and run tests in a clone (1).
- Measured:
- Tests that create repositories must be hermetic. Drop every variable
git rev-parse --local-env-varslists before running git in a scratch repository. - A tripwire. A gate can snapshot the real repository's
HEADandcore.worktreebefore running and fail loudly if either changed.
(Practice — not yet validated.)
Checklist before pushing a change that touches paths, processes, files, shells or git
- The other OS's legs ran locally, on a clone built there, and are green.
- CI's runner image is pinned and the local environment is the same release; tools that read text declare their encoding; every CI job that can run locally does.
- No path literal from one OS reaches another OS's path API; tests plant host-native paths.
- Nothing depends on build-machine paths, or the tests are built on the OS that runs them.
- CRLF files were edited as bytes, and the diff touches only the intended lines.
- Scripts that must be LF are LF, pinned in
.gitattributes. - Per-OS commands are written explicitly, not translated.
- No git variables are exported to child processes; scratch-repository tests scrub git's local variables.
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.

