optimize-worktrees

Reduces duplicate Rust build outputs when opening local Fedi git worktrees.

78|27|Updated May 4, 2024
One-click install
npx skills add https://github.com/fedixyz/fedi --skill optimize-worktrees-fedixyz
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: optimize-worktrees
Source: https://github.com/fedixyz/fedi/tree/main/.agents/skills/optimize-worktrees
Command: npx skills add https://github.com/fedixyz/fedi --skill optimize-worktrees-fedixyz

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Opening a new git worktree in the Fedi monorepo normally means rebuilding all Rust dependencies from scratch, wasting disk space and compile time. This Skill routes builds through the Nix worktree shell so compatible host debug dependencies are cloned into a private target directory automatically. ## Core Features & Use Cases - Worktree Shell Builds: Runs cargo and just commands through nix develop .#worktree so builds reuse prepared dependency outputs. - Automatic Dependency Cloning: On macOS/APFS, shell entry clones compatible host debug dependencies from an idle worktree into a private target-nix directory using shared disk blocks. - Safe Cache Controls: Supports FEDI_WORKTREE_CACHE=0 to disable preparation and documents guardrails against symlinking target directories or misusing cargo clean. - Use Case: A developer opens a new worktree to fix an issue and runs nix develop .#worktree --command cargo check, getting a fast first build without duplicating gigabytes of Rust artifacts. ## Quick Start Ask the assistant to open a Fedi worktree and run your cargo or just command through the nix worktree shell so dependency builds are reused.

Frequently Asked Questions about optimize-worktrees

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

FAQPage Schema
How do I avoid rebuilding Rust dependencies in a new git worktree?

Run builds through the Nix worktree shell with `nix develop .#worktree --command cargo check`, replacing the command as needed. On macOS/APFS, entering the shell automatically clones compatible host debug dependencies into a private target-nix directory.

How do I run cargo commands inside the Fedi worktree shell?

Prefix any cargo or just command with `nix develop .#worktree --command`, or enter `nix develop .#worktree` once for an interactive session and run commands inside it. The shell supplies Python through Nix, so do not run the preparation script with host Python.

Does worktree build caching work on CI or mobile targets?

No. The preparation does not apply to CI workflows, and mobile targets and other platforms do not benefit from it. Leave CI shell selection unchanged and let cargo build normally when reuse is unavailable.

How do I disable the Fedi worktree cache preparation?

Set the environment variable `FEDI_WORKTREE_CACHE=0` to disable preparation. No manual seeding or reset is otherwise needed, and existing debug directories are left untouched.

Can I symlink target directories between worktrees to save space?

No. Keep writable target directories separate and never symlink them together or copy runtime databases between worktrees. Also avoid using `cargo clean` to force reuse without first inspecting the target directory for runtime data.