cross-platform-paths

Provides cross-platform path handling rules for VS Code extensions using path.resolve() and URI objects.

10|2|Updated Mar 8, 2026
One-click install
npx skills add https://github.com/mahmoud20138/Claude-Skills-Collection --skill cross-platform-paths
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cross-platform-paths
Source: https://github.com/mahmoud20138/Claude-Skills-Collection/tree/main/05-VSCode-Extension-Skills/cross-platform-paths
Command: npx skills add https://github.com/mahmoud20138/Claude-Skills-Collection --skill cross-platform-paths

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses the critical and common bugs arising from incorrect path handling across different operating systems (Windows, macOS, Linux) in software development.

Core Features & Use Cases

  • Path Concatenation Safety: Enforces the use of path.join() to prevent OS-specific path separator issues.
  • Path Comparison Best Practices: Guides on using path.resolve() for accurate path comparisons, especially on Windows.
  • VS Code Path Handling: Recommends Uri.file().fsPath for consistent path management within the VS Code environment.
  • Platform-Specific Gotchas: Details common pitfalls and solutions for Windows, macOS, and Linux.
  • Use Case: When developing a VS Code extension that needs to access user files or configuration directories, use this Skill to ensure your code works flawlessly on any operating system.

Quick Start

Use the cross-platform-paths skill to review path handling in the file src/utils/fileUtils.ts.

Frequently Asked Questions about cross-platform-paths

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

FAQPage Schema
Why does path handling break when moving my VS Code extension from Windows to macOS?

Path handling breaks due to OS-specific separator differences. Use `path.join()` for concatenation and `path.resolve()` for comparisons to ensure cross-platform compatibility across Windows, macOS, and Linux.

What is the best way to compare file paths in TypeScript across different operating systems?

The best way to compare file paths is using `path.resolve()`. It normalizes separators and resolves relative segments, preventing common bugs when comparing paths on Windows versus POSIX systems.

How do I handle file system paths in a VS Code extension without hitting OS compatibility bugs?

Use `Uri.file().fsPath` for consistent file system path management within VS Code. This approach mitigates platform-specific gotchas for Windows, macOS, and Linux environments.

Can I use string concatenation for path construction in cross-platform TypeScript projects?

Avoid string concatenation for path construction. Instead, use `path.join()` to prevent OS-specific path separator issues and ensure your code works flawlessly across platforms.

How do I escape shell paths for platform-specific executables in VS Code extensions?

Handle platform-specific executables and shell path escaping by following OS-specific gotchas for Windows, macOS, and Linux, ensuring correct execution within your VS Code extension environment.