Index of every page on this site: llms.txt
All skills
zenstudiolab avatar

/monorepo-worktree-safety

@032d25b
Run it yourself

Prevents dependency resolution failures and test discovery disasters when using git worktrees inside monorepos or submodules. Use this skill whenever: (1) creating a git worktree anywhere inside a monorepo or submodule directory, (2) you see errors like 'vitest: not found', unresolved @org/* or workspace:* packages from a worktree path, (3) test suites are running unexpectedly duplicate or foreign tests, (4) someone asks to run coverage or CI checks from a branch worktree, (5) setting up parallel feature development in a monorepo using worktrees. If the user mentions worktrees AND a monorepo, always apply this skill — don't assume the environment is already safe.

Use this Skill: https://skilld.dev/gh/zenstudiolab/skills/monorepo-worktree-safety

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

README.md

≈486 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Monorepo Worktree Safety

Prevents dependency resolution failures and test discovery disasters when using git worktrees inside monorepos or submodules.

Overview

Git worktrees are a powerful workflow tool — they give you an isolated checkout of a different branch without needing to stash or clone again. But in monorepos with workspace-relative packages, a worktree created inside a submodule can silently inherit the wrong (or no) node_modules, causing test failures that look like code regressions.

This skill provides:

  • A verification script that audits the current worktree context
  • A decision tree for choosing the correct execution context
  • Concrete remediation steps for each failure class
  • An output report contract so the agent always communicates what it found and fixed

Common Failure Modes

Symptom Root Cause
vitest: not found Worktree has no node_modules, no PATH resolution
Cannot find module '@org/utils' Workspace package not resolvable from registry
Tests running from wrong branch .worktrees/** not excluded from test discovery
Duplicate React / store node_modules symlink creates two singleton instances
Untracked files everywhere .worktrees/ not in .gitignore

Installation

npx skills add ZenStudioLab/skills --skill monorepo-worktree-safety

Or manually copy skills/monorepo-worktree-safety/ to ~/.agents/skills/.

The verification script lives in your agents workflows directory:

~/.agents/workflows/scripts/verify-monorepo-worktree.sh

Requirements

  • Git worktree (git worktree add ...)
  • Node.js monorepo (pnpm, npm, yarn workspaces)
  • rg (ripgrep) for the verification script's pattern checks

Related Skills

  • playwright-extension-testing — when the worktree is being used to run extension E2E tests
  • lesson-decision-records — if you discover a recurring pattern worth recording

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts7mo3 checks · Risk SAFE
  • Gen Agent Trust Hub7mo

    The skill provides automated diagnostics and remediation steps for Node.js monorepo environments using git worktrees. It uses standard shell commands and diagnostic scripts to identify and fix common dependency resolution and test discovery issues. No security risks were detected.

  • Socket7mo

    No alerts

  • Snyk7mo

    Risk: LOW · No issues

Signed by skilld at 032d25b. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 months ago.

Steadyupdated 8 months ago

README badge

README badge for zenstudiolab/skills/monorepo-worktree-safety