- Home
- Skills
- Agents & Orchestration
- Repair Cross-Platform File Path Bugs
More screenshots
Works with the AI tools you already use
Repair Cross-Platform File Path Bugs
Repair Cross-Platform File Path Bugs is a bounded ToolForge Labs workflow.
$8.99
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.
What you get
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.
How to install
Works the same in every agent - Claude, Cursor, Codex, Copilot and 20+ more.
- 1
Download the ZIP
Free skills download straight away. Paid skills unlock right after purchase.
- 2
Unzip into your skills folder
Every agent reads skills from one folder on your machine. Drop the unzipped folder in there.
- 3
Ask your agent to use it
Restart the agent if it was already running. It picks the skill up automatically - no config needed.
Skills folder by agent
Click the path to copy it. Create the folder if it does not exist yet.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill passes our trust checks below.
Security scanned
Passed our 8-point scan before listing
Fresh listing
Recently published to Agensi
30-day refund
Not a fit? Get your money back
Trust & safety
Security scanned
Verified clean 27 days ago
- Passed all security checks, Safe to install