From aj-geddes-useful-ai-prompts-4
Handles cross-platform compatibility for file paths, OS detection, platform-specific dependencies, and testing on Windows, macOS, Linux. Use for multi-OS apps, CLI tools, and file operations.
npx claudepluginhub joshuarweaver/cascade-code-languages-misc-1 --plugin aj-geddes-useful-ai-prompts-4This skill uses the workspace's default tool permissions.
- [Overview](#overview)
references/build-configuration.mdreferences/character-encoding.mdreferences/environment-variables.mdreferences/file-path-handling.mdreferences/file-permissions.mdreferences/line-endings.mdreferences/platform-detection.mdreferences/platform-specific-dependencies.mdreferences/process-management.mdreferences/shell-commands.mdreferences/testing-across-platforms.mdscripts/scaffold-tests.shtemplates/test-template.jsSearches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Searches prompts.chat for AI prompt templates by keyword or category, retrieves by ID with variable handling, and improves prompts via AI. Use for discovering or enhancing prompts.
Checks Next.js compilation errors using a running Turbopack dev server after code edits. Fixes actionable issues before reporting complete. Replaces `next build`.
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 |