- Home
- Skills
- Agents & Orchestration
- Repair Cross-Platform File Path Bugs
More screenshots
Works with the AI Agents you already use
Repair Cross-Platform File Path Bugs
Repair Cross-Platform File Path Bugs is a bounded ToolForge Labs workflow.
$1
Repair Cross-Platform File Path Bugs
Example session with this skill installed
The app fails on Windows because it can't find config files stored in /etc/app. Here is the path joining logic in src/config.js. Fix it to work on both Linux and Windows.
- Read your context and instructions
- Compiled the repair cross-platform file
I have analyzed the path joining logic in src/config.js. The issue stems from a hardcoded POSIX root and string-concatenation for subdirectories, which fails on Windows due to drive letter requirements and backslash expectations.
Cross-Platform Path Repair
The following patch replaces manual string manipulation with the path module's platform-aware methods and introduces a configurable root to handle both POSIX /etc and Windows %PROGRAMDATA% conventions.
// src/config.js
const path = require('path');
const os = require('os');
/**
* Resolves the configuration directory in a platform-agnostic way.
* Invariant: Returns an absolute path using the platform's native separator.
*/
function getConfigDir() {
const isWindows = process.platform === 'win32';
// Use environment variables or platform defaults
const baseDir = process.env.APP_CONFIG_DIR ||
(isWindows
? path.join(process.env.PROGRAMDATA || 'C:\\ProgramData', 'MyApp')
: '/etc/myapp');
return path.normalize(baseDir);
}
function getFilePath(filename) {
// Fix: Replaced `getConfigDir() + '/' + filename` which creates double slashes or wrong separators
return path.join(getConfigDir(), filename);
}
Focused Deterministic Test
This test suite uses a mock environment to verify the path resolution invariant across platforms without requiring actual filesystem access.
const assert = require('assert');
// Test 1: POSIX normalization
process.env.APP_CONFIG_DIR = '/etc/myapp';
const posixResult = getFilePath('settings.json');
assert.strictEqual(posixResult, '/etc/myapp/settings.json');
// Test 2: Windows drive root and separator
// Note: In a real test, you would mock process.platform
const winResult = path.win32.join('C:\\ProgramData\\MyApp', 'settings.json');
assert.strictEqual(winResult, 'C:\\ProgramData\\MyApp\\settings.json');
console.log('✅ Path invariant tests passed.');
Next steps
- Replace the hardcoded
/etc/appstring in your environment configuration with thegetConfigDir()helper. - Update your CI pipeline to set the
APP_CONFIG_DIRenvironment variable for Windows runners. - Verify that the application service has read permissions for the newly calculated Windows path.
Connects securely to your tools. The creator never sees your data.
About this skill
Repair Cross-Platform File Path Bugs is a bounded ToolForge Labs workflow. Diagnose and repair cross-platform file paths, separators, case sensitivity, roots, working directories, symlinks, normalization, and path identity. Works from full repositories or partial context such as snippets, logs, configuration, traces, and architecture notes. Produces concrete repair patterns and focused deterministic tests while preserving existing product/security policy. It works from a full repository or partial evidence such as snippets, logs, configuration, traces, tickets, and architecture notes. The skill preserves existing product and security policy, separates verified facts from assumptions, avoids invented execution claims, and produces concrete repair or review steps with focused deterministic validation or traceable evidence.
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Agents & Orchestration.
Cannot verify production systems, external services, or facts that are not present in supplied evidence. With partial context it returns bounded diagnosis/review, explicit assumptions, and a deterministic validation plan rather than claiming successful execution.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 2 months ago
Permissions
Use a clean branch or a controlled review workspace. Supply repository files, logs, traces, configuration, or evidence needed for the task. Review all patches/findings before merge or operational action; keep production credentials and destructive production actions out of the workflow.