Skip to content

fix(cli): preserve existing SKILL.md by default, add skill --force - #618

Open
Adkr1989 wants to merge 2 commits into
Panniantong:mainfrom
Adkr1989:fix/skill-install-preserve-default
Open

fix(cli): preserve existing SKILL.md by default, add skill --force#618
Adkr1989 wants to merge 2 commits into
Panniantong:mainfrom
Adkr1989:fix/skill-install-preserve-default

Conversation

@Adkr1989

Copy link
Copy Markdown

Problem

_install_skill() defaults to force=True, and both callers (the install
flow and agent-reach skill --install) call it bare. Every install run
therefore silently overwrites ~/.claude/skills/agent-reach/SKILL.md (and the
other agent skill roots), destroying any user customization — scoped
descriptions, trimmed tool lists, local routing notes.

The preserve path already exists: _copy_skill_dir returns "preserved" when
not force and a SKILL.md is present, and both callers already print a
"preserving existing files" message for it — it's just unreachable from the CLI.

Fix

  • Default flips to force=False: installs preserve an existing SKILL.md and
    say so.
  • New agent-reach skill --install --force opts into overwrite (e.g. to pick
    up a new packaged skill after upgrading).

Tests

Two new tests: re-install preserves a customized SKILL.md; --force restores
the packaged one. Full suite passes with no new failures (Windows 11,
Python 3.11); manually verified that skill --install now prints
"preserving existing files" and leaves a customized SKILL.md byte-identical.

Preserving the whole skill directory froze the packaged reference docs
alongside the user file, so a customized SKILL.md left references/ stuck
at whatever version first installed it. Split the copy so the user owns
SKILL.md and the reference docs still track the installed version:
extract _resolve_skill_pkg() and _write_references(), and call the latter
on the preserve path. references/ is rebuilt from scratch so docs dropped
upstream do not linger.

The preserve message named neither half of that behaviour nor --force,
leaving users with no way to learn how to take the packaged file back.
Also set installed=True on the fallback preserve branch, matching the
loop above it.
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.

1 participant