cross-platform-development

Construct host and container paths with filepath.Join and path.Join for cross-platform tests.

10|14|Updated Feb 26, 2026
One-click install
npx skills add https://github.com/openkaiden/kdn --skill cross-platform-development
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cross-platform-development
Source: https://github.com/openkaiden/kdn/tree/main/.agents/skills/cross-platform-development
Command: npx skills add https://github.com/openkaiden/kdn --skill cross-platform-development

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Cross-platform development often breaks due to inconsistent path handling and tests that fail on Windows. This skill provides patterns to ensure code runs reliably across Linux, macOS, and Windows.

Core Features & Use Cases

  • Host path construction: use filepath.Join for host paths to ensure OS compatibility.
  • Container path construction: use path.Join for container paths (always Unix-like).
  • Test patterns: rely on t.TempDir and filepath.Join for cross-platform tests to avoid hard-coded paths.

Quick Start

Follow the patterns in this skill to refactor a project for cross-platform path handling and testing.

Frequently Asked Questions about cross-platform-development

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

FAQPage Schema
How do I handle cross-platform file paths in Go so tests pass on Windows, Linux, and macOS?

Use filepath.Join for host paths to ensure OS compatibility, and path.Join for container paths which always use Unix-like conventions. Convert to absolute paths to avoid hard-coded path failures across Linux, macOS, and Windows.

Why do my Go tests fail on Windows when using hard-coded paths?

Go tests fail on Windows due to inconsistent path handling from hard-coded paths. Use t.TempDir and filepath.Join in your cross-platform tests to construct portable paths that pass reliably in CI and local development.

What is the best way to build container paths for cross-platform development?

Use path.Join for container paths to maintain consistent Unix-like conventions regardless of the host OS. This ensures portable host path construction and robust cross-platform tests across Linux, macOS, and Windows.

Does cross-platform development in Go require different path handling for host and container environments?

Yes, cross-platform development requires filepath.Join for host paths to ensure OS compatibility, and path.Join for container paths. Converting to absolute paths and using t.TempDir in tests ensures robust cross-platform consistency.

How do I refactor a project for cross-platform path handling and testing?

Refactor by using filepath.Join for host paths, path.Join for container paths, and t.TempDir for test directories. Apply these mandatory practices to ensure software projects run reliably across Linux, macOS, and Windows.