skills/cross-platform-compatibility/SKILL.md
Handle cross-platform compatibility including file paths, environment detection, platform-specific dependencies, and testing across Windows, macOS, and Linux. Use when dealing with platform-specific code or OS compatibility.
npx skillsauth add aj-geddes/useful-ai-prompts cross-platform-compatibilityInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Comprehensive guide to writing code that works seamlessly across Windows, macOS, and Linux. Covers file path handling, environment detection, platform-specific features, and testing strategies.
Minimal working example:
// ❌ BAD: Hardcoded paths with platform-specific separators
const configPath = "C:\\Users\\user\\config.json"; // Windows only
const dataPath = "/home/user/data.txt"; // Unix only
// ✅ GOOD: Use path module
import path from "path";
import os from "os";
// Platform-independent path construction
const configPath = path.join(os.homedir(), "config", "app.json");
const dataPath = path.join(process.cwd(), "data", "users.txt");
// Resolve relative paths
const absolutePath = path.resolve("./config/settings.json");
// Get path components
const dirname = path.dirname("/path/to/file.txt"); // '/path/to'
const basename = path.basename("/path/to/file.txt"); // 'file.txt'
const extname = path.extname("/path/to/file.txt"); // '.txt'
// Normalize paths (handle .. and .)
const normalized = path.normalize("/path/to/../file.txt"); // '/path/file.txt'
Detailed implementations in the references/ directory:
| Guide | Contents | |---|---| | File Path Handling | File Path Handling | | Platform Detection | Platform Detection | | Line Endings | Line Endings | | Environment Variables | Environment Variables | | Shell Commands | Shell Commands | | File Permissions | File Permissions | | Process Management | Process Management | | Platform-Specific Dependencies | Platform-Specific Dependencies | | Testing Across Platforms | Testing Across Platforms | | Character Encoding | Character Encoding | | Build Configuration | Build Configuration |
development
Implement Zero Trust security model with identity verification, microsegmentation, least privilege access, and continuous monitoring. Use when building secure cloud-native applications.
development
Prevent Cross-Site Scripting (XSS) attacks through input sanitization, output encoding, and Content Security Policy. Use when handling user-generated content in web applications.
tools
Create wireframes and interactive prototypes to visualize user interfaces and gather feedback early. Use tools and techniques to communicate design ideas before development.
development
Implement real-time bidirectional communication with WebSockets including connection management, message routing, and scaling. Use when building real-time features, chat systems, live notifications, or collaborative applications.