# Cross-Platform Code — Linux, macOS, Windows & Docker

> Makes code, tests and Docker builds behave the same on Linux, macOS and native Windows, and catches POSIX-only assumptions.

Cross-Platform Code — Linux, macOS, Windows & Docker is a free AI agent skill on Agensi by Cristhian Zanforlin Lousa, in DevOps & Cloud. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: Free
- Creator: [Cristhian Zanforlin Lousa](https://www.agensi.io/creators/cristhian-zanforlin-lousa)
- Category: [DevOps & Cloud](https://www.agensi.io/skills/devops-cloud)
- Uses: 3
- Version: 1.0
- Last updated: 2026-10-15
- Security: scan passed (2026-10-08); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/cross-platform-code-linux-macos-windows-docker
- Tags: devops, code-review, cross-platform, windows, macos, linux, portability, docker

## About this skill

**Ensuring Cross-Platform** treats "it works on my machine" as unfinished work. Code is done when it behaves the same on every supported platform and tests on every one of those platforms prove it.

**The problems it solves**
- Paths built with `"/"` string concatenation, `open()` with no encoding, and `shell=True` calls to `rm`, `gzip` or `grep`
- Hardcoded `/tmp` and `~/.config`, and timestamps or user input that put `:` or `CON` into Windows filenames
- CI that only runs on Linux, so Windows bugs ship
- Docker images that build differently depending on the host OS

**How it works:** before any filesystem, shell, environment or subprocess code is written, the agent answers a five-question platform check. It then applies the required patterns: path APIs, explicit UTF-8, no shell, tolerant line-ending reads, OS-aware temp/cache/config dirs, filename validation, UTC at boundaries, and prebuilt native dependencies. When code is genuinely OS-specific, it goes behind one protocol with a runtime factory and fails loudly on unsupported platforms instead of falling back silently. Work is checked against a checklist covering code, tests, Docker and docs before delivery, and a CI matrix with `fail-fast: false` is required.

Default targets are Linux, macOS, native Windows (WSL doesn't count) and Docker amd64/arm64. You can narrow them per project.

**What's inside**
- `references/patterns.md`: the required patterns in Python, TypeScript, Go and Java
- `references/anti-patterns.md`: a table of POSIX-only mistakes and their portable fixes
- `references/platform-specific-code.md`: the protocol + factory pattern, runtime detection, the branch map
- `references/docker.md`: image hygiene, a `.dockerignore` baseline, volume mounts, multi-arch builds

**When it triggers:** code that touches files, shell, subprocesses, encoding, time, paths, native dependencies or CI, or any mention of Windows, macOS, portability or Docker.

Free and MIT-licensed, part of the claude-skills-czl collection.

**Source on GitHub:** [this skill](https://github.com/Cristhianzl/claude-skills-czl/tree/main/configs/agnostic/skills/ensuring-cross-platform) · [full repository](https://github.com/Cristhianzl/claude-skills-czl)

## Known limitations

It cannot run macOS or Windows tests from a Linux machine; those platforms stay marked as pending until your CI matrix runs them. Defaults to Linux, macOS, native Windows and Docker until you narrow the targets in learnings/.

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the Cross-Platform Code — Linux, macOS, Windows & Docker skill from Agensi" and describe your task.
3. Your agent loads the skill from Agensi when it needs it. Nothing is downloaded.

## Frequently asked questions

### How does this skill prevent OS-specific bugs during the coding process?

This skill eliminates 'it works on my machine' issues by forcing the agent to use cross-platform path APIs, explicit encoding, and OS-aware directory handling instead of POSIX-only assumptions like hardcoded slashes or shell commands.

### Which operating systems and environments are supported by default?

The skill supports Linux, macOS, and native Windows environments, along with Docker amd64/arm64 architectures; you can also customize or narrow these targets to fit your specific project requirements.

### What specific resources are included in this skill package?

You receive a comprehensive suite of references including code patterns for Python, TypeScript, Go, and Java, an anti-pattern guide for POSIX-only mistakes, and protocols for handling OS-specific logic and Docker hygiene.

### When does the agent know to apply these cross-platform rules?

The skill automatically triggers whenever the agent encounters tasks involving filesystems, shell commands, subprocesses, time formatting, or CI/CD configuration.

### Does this skill help with setting up Continuous Integration (CI)?

Yes, it requires a CI matrix with 'fail-fast: false' to ensure code is validated across all targeted platforms simultaneously, catching Windows or macOS bugs before they ship.

### What are the licensing and compatibility requirements for this skill?

This is a free, MIT-licensed skill that can be integrated into AI agents supporting custom skill configurations, with the full source code available on GitHub for transparency and easy updates.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
