path-resolution

Selects script path resolution strategies for Python, Node.js, and Bash in varied environments.

1|Updated Jan 13, 2023
One-click install
npx skills add https://github.com/theodrosyimer/.dotfiles --skill path-resolution
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: path-resolution
Source: https://github.com/theodrosyimer/.dotfiles/tree/main/claude/skills/dev__path-resolution
Command: npx skills add https://github.com/theodrosyimer/.dotfiles --skill path-resolution

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Scripts often fail because they rely on relative paths that resolve from the process's current working directory, which can differ across environments such as Docker, CI/CD pipelines, cron jobs, or monorepos.

Core Features & Use Cases

  • Provides a decision matrix that compares script‑anchored paths, environment variables, and os.chdir() strategies.
  • Lists language‑specific patterns for Python, Node.js (CommonJS and ES Modules), and Bash to anchor paths safely.
  • Offers quick rules to prevent path bugs when creating new scripts, updating existing ones, or configuring applications that run in varied contexts.

Quick Start

Ask the path‑resolution skill to display the decision matrix for Python scripts.

Frequently Asked Questions about path-resolution

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

FAQPage Schema
Why do my Python and Node.js scripts fail with file path errors in Docker and CI/CD?

Scripts fail because relative paths resolve from the process's current working directory, which shifts across Docker, CI/CD, cron, and monorepo environments. A path resolution decision matrix helps anchor file paths to the script location for consistent execution.

How do I anchor file paths in Node.js ES Modules and CommonJS scripts?

To anchor file paths in Node.js scripts, apply language-specific script-anchoring patterns for CommonJS and ES Modules. Consulting a path resolution decision matrix ensures you select the correct strategy to resolve paths safely relative to the script.

What is the best way to resolve file paths in Bash scripts running as cron jobs?

The best way to resolve file paths in Bash cron jobs is consulting a decision matrix comparing script-anchored paths, environment variables, and os.chdir(). Bash-specific anchoring patterns prevent path bugs when the working directory differs.

Can I use environment variables instead of script-anchored paths for path resolution in monorepos?

Yes, you can use environment variables for path resolution in monorepos. A decision matrix compares environment variables against script-anchored paths and os.chdir() strategies to determine the safest approach for your specific deployment context.

When should I not use os.chdir() to fix relative path issues in my scripts?

You should avoid os.chdir() when running scripts across Docker, CI/CD, or monorepos if it conflicts with other processes. The path resolution decision matrix identifies when script-anchored paths or environment variables are safer alternatives.

How do I choose a safe file path strategy for a new Python script?

To choose a safe file path strategy for a new Python script, review a decision matrix comparing script-anchored paths, environment variables, and os.chdir(). Python-specific anchoring patterns provide quick rules to prevent path bugs.