Skip to content

fix(scripts): remove only diffity-dev skills, never the whole global dir - #1

Merged
fiddur merged 3 commits into
developfrom
fix-build-skills-wipe
Aug 21, 2026
Merged

fix(scripts): remove only diffity-dev skills, never the whole global dir#1
fiddur merged 3 commits into
developfrom
fix-build-skills-wipe

Conversation

@fiddur

@fiddur fiddur commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

scripts/build-skills.ts ran cleanDir(~/.claude/skills) — a recursive rmSync of the whole
directory — before writing its diffity-dev-* skills, and scripts/dev.ts did the same on
SIGINT/SIGTERM and on dev exit. Anyone running npm run build or npm run dev lost every other
Claude Code skill installed globally. It happened here: two unrelated skills, one of them
multi-file, were deleted with no backup.

Upstream #30 by @kleinjm fixes the build-skills.ts
half. This branch merges it and adopts its cleanManagedSkills name and dash-anchored prefix match
rather than carrying a competing implementation, then adds what nilbuild#30 does not cover:

  • the identical wipe in dev.ts's SIGINT/SIGTERM and exit cleanup
  • DIFFITY_SKIP_DEV_SKILLS=1 to skip the global sync entirely (CI, or anyone who doesn't want a build writing to $HOME)
  • DEV_SKILL_PREFIX shared between the writer and the cleanup paths so the name and the cleanup can't drift
  • a regression test — including that an empty prefix doesn't degenerate into "remove everything"; vitest wired at root as test:scripts

Verified by planting an unrelated skill, running npm run build, and confirming it survived while
the seven dev skills still synced.

The dev.ts fix and the test are worth sending upstream as a follow-up to nilbuild#30.

🤖 Generated with Claude Code

https://claude.ai/code/session_018PkYQzbsnMihHesafWvXKs

kleinjm and others added 2 commits July 17, 2026 21:43
build:skills called cleanDir on ~/.claude/skills, deleting the entire
directory before reinstalling diffity's dev skills. That destroys any
other skills the user keeps there — their own skills, or skills from
other tools — which is especially harmful when ~/.claude/skills is a
symlink into a version-controlled dotfiles repo.

Replace the blanket cleanDir with cleanManagedSkills, which removes only
the directories diffity manages (those named `diffity-dev-*`) and leaves
everything else in place.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
build-skills.ts cleaned ~/.claude/skills with a recursive rmSync before writing
the dev skills, and dev.ts did the same on SIGINT/SIGTERM and on dev exit. Both
deleted every unrelated Claude Code skill the user had installed there.

Both now remove only the immediate diffity-dev-* subdirectories, and the sync
can be skipped entirely with DIFFITY_SKIP_DEV_SKILLS=1.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018PkYQzbsnMihHesafWvXKs
Upstream nilbuild#30 by @kleinjm fixes the same destructive rmSync in
build-skills.ts. Adopt its cleanManagedSkills name and dash-anchored prefix
match so this fork does not carry a competing implementation, and keep what nilbuild#30
does not cover: the identical wipe in dev.ts's SIGINT/SIGTERM cleanup, the
DIFFITY_SKIP_DEV_SKILLS opt-out, a shared DEV_SKILL_PREFIX, and a regression
test.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018PkYQzbsnMihHesafWvXKs
@fiddur
fiddur changed the base branch from main to develop August 21, 2026 13:33
@fiddur
fiddur marked this pull request as ready for review August 21, 2026 13:33
@fiddur
fiddur merged commit 821daaf into develop Aug 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants