fabioc-aloha/alex_skill_mall/build-script-path-rot

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Hardcoded paths in build scripts break when directory structure changes:

Install

npx vskill@latest install fabioc-aloha/alex_skill_mall/build-script-path-rot

SKILL.md

Build Script Path Rot

The Problem

Hardcoded paths in build scripts break when directory structure changes:

javascript
// Bad: hardcoded path
const srcDir = './src/components';
const outDir = './dist/components';
// After restructure: src/components → packages/ui/src
// Script breaks silently or with confusing errors

The Solution

Option 1: Resolve Relative to Manifest
javascript
const path = require('path');
const pkg = require('./package.json');
// Paths defined in package.json
const srcDir = path.resolve(__dirname, pkg.directories?.src || 'src');
const outDir = path.resolve(__dirname, pkg.directories?.dist || 'dist');
json
// package.json
{
"directories": {
"src": "packages/ui/src",
"dist": "dist"
}
}
Option 2: Config File
javascript
// build.config.js
module.exports = {
srcDir: './packages/ui/src',
outDir: './dist',
assets: './assets'
};
javascript
// build.cjs
const config = require('./build.config.js');
const srcDir = path.resolve(__dirname, config.srcDir);
Option 3: Auto-Discover
javascript
// Find src directory by looking for markers
function findSrcDir() {
const candidates = ['src', 'packages/ui/src', 'lib'];
for (const dir of candidates) {
if (fs.existsSync(path.join(dir, 'index.ts'))) {
return dir;
}
}
throw new Error('Could not find source directory');
}

Red Flags

PatternRisk
'./src/' hardcodedWill break on restructure
process.cwd() + '/src'Breaks if script run from different dir
Relative paths without path.resolvePlatform-specific issues

Safe Patterns

javascript
// Always resolve from script location
const scriptDir = __dirname;
const projectRoot = path.resolve(scriptDir, '..');
const srcDir = path.resolve(projectRoot, 'src');
// Or from package.json location
const pkgPath = require.resolve('./package.json');
const projectRoot = path.dirname(pkgPath);

Verification

  1. Move a directory → script still works (reads from config)
  2. Run script from different working directory → still works
  3. Paths in config match actual structure

When to Apply

  • Any build script with file paths
  • After directory restructure
  • When script "mysteriously" breaks in CI

Tags

build paths configuration portability

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
4
Repository forks
1
7-day trend score
13

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/fabioc-aloha/alex_skill_mall/build-script-path-rot/badge)](https://verified-skill.com/skills/fabioc-aloha/alex_skill_mall/build-script-path-rot)

Something wrong with this skill or its page? Tell us.