agentsclimarketplace

Canonical worktree path normalization

Skill ychampion/cskill-agents/agents/codex/skills/canonical-worktree-path-normalization

Agent skills for coding CLIs, multi-agent runtimes, context engines, MCP extensions, and terminal tooling. Instead of using claude code's source code, give your agent skills to create your own!

Install
npx -y skills add ychampion/cskill-agents --skill canonical-worktree-path-normalization

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

What its author says it does

Copied from the file, not written here

Resolve repo-relative paths against the canonical checkout root so shared state stays stable across Git worktrees.

SKILL.md

2.2 KB, as published. Nobody here has run it

SKILL: Canonical Worktree Path Normalization

Domain: git-worktree Trigger: Use when repo-relative paths are written into shared or user-global state and the same project may be opened from multiple worktrees. Source Pattern: Distilled from reviewed permission, shell-safety, and worktree-management implementations.

Core Method

Normalize relative paths against the repository’s canonical root rather than the current worktree directory before persisting them into shared state. This prevents each worktree session from rewriting the same logical source to a different absolute path, and it avoids leaving dead install locations behind when a temporary worktree disappears. Keep the normalization local to the persistence boundary so upstream callers can continue using project-relative configuration naturally.

Key Rules

  • Resolve relative project paths at the point where they are compared against or written into shared state.
  • Prefer the canonical Git root over the active worktree path whenever the stored state outlives a single checkout.
  • Preserve already-absolute paths as-is; normalization is for relative project references only.
  • Use the same normalized path for both comparison and write decisions so diff logic stays stable.
  • Treat this as a stability contract for shared metadata, not merely a convenience for path formatting.

Example Application

If plugin sources are declared as marketplace inside repository settings but stored in a global config file as absolute paths, resolve them against the main checkout root. Opening the repo from a feature worktree then compares equal to the existing entry instead of churning the stored path on every session.

Anti-Patterns (What NOT to do)

  • Do not persist worktree-specific absolute paths into user-global registries when the logical source belongs to the repo as a whole.
  • Do not normalize only on writes but compare against raw relative paths on reads; the system will oscillate between equivalent representations.

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.