compatibility

Reviews Python code for cross-platform and cross-version compatibility issues.

Updated Sep 2, 2026
One-click install
npx skills add https://github.com/Dazlarus/karl-code --skill compatibility-dazlarus
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: compatibility
Source: https://github.com/Dazlarus/karl-code/tree/main/.agents/skills/compatibility
Command: npx skills add https://github.com/Dazlarus/karl-code --skill compatibility-dazlarus

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Code that works on one machine often breaks on another due to hardcoded paths, platform-specific shell commands, line ending differences, or Python version mismatches. This Skill reviews code for these portability pitfalls and suggests concrete fixes. ## Core Features & Use Cases - Cross-Platform Path Review: Detects hardcoded Windows or Unix paths and recommends pathlib-based alternatives. - Version Compatibility Checks: Identifies typing features and imports that need fallbacks like typing_extensions for older Python versions. - Filesystem and Line Ending Handling: Flags assumptions about case sensitivity, permissions, and newline characters across operating systems. - Use Case: Before shipping a CLI tool to users on Windows, Linux, and macOS, run this review to catch platform-specific commands like os.system("ls") and replace them with portable subprocess or pathlib patterns. ## Quick Start Review my Python project for cross-platform compatibility issues and suggest fixes for any platform-specific code you find.

Frequently Asked Questions about compatibility

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write cross-platform file paths in Python?▼

Use pathlib instead of string concatenation for file paths. Path("data") / "files" / "test.txt" works on Windows, Linux, and macOS, while hardcoded separators like backslashes only work on one platform.

How to handle Python version compatibility for typing features?▼

Check sys.version_info and fall back to typing_extensions for newer features like Self or override on older Python versions. Guard imports with try/except blocks so the code degrades gracefully.

Can I use os.system commands in cross-platform Python code?▼

Avoid os.system with platform-specific commands like ls or dir. Use pathlib for filesystem operations or subprocess with sys.platform detection when a shell command is truly required.

Why does my Python script fail on Windows but work on Linux?▼

Common causes include hardcoded forward-slash paths, case-sensitive filename assumptions, line ending differences, and Unix-only shell commands. Test on multiple platforms and use pathlib plus environment variables for configuration.

When should I not apply cross-platform compatibility patterns?▼

Skip them when building platform-specific features intentionally or internal tools that only run on a single platform. Adding abstraction layers there adds complexity without benefit.