Skip to content

DEV-1181: generalize reflect's copy steps to a <dest> path - #4

Merged
tomaas merged 1 commit into
mainfrom
guillermo/dev-1181-reflect-copy-2
Oct 24, 2026
Merged

tomaas merged 1 commit into
mainfrom
guillermo/dev-1181-reflect-copy-2

Conversation

@tomaas

@tomaas tomaas commented Oct 24, 2026

Copy link
Copy Markdown
Owner

Second follow-up for DEV-1181. Fixes the four findings from the blind review of #3 (APPROVE WITH NITS at b034fd0) in skills/reflect/SKILL.md. Nothing else changes.

Changes

  1. Project destination that doesn't exist yet. When the skill is installed only globally, run steps 1 and 2 against the global link, skip rm so the global link stays, move the copy to the project path, and run the check. The text says to never cp -r the link itself.
  2. tmp=$(mktemp -d) replaces the fixed /tmp/<skill>-copy. Steps 2 to 5 run as one &&-joined shell command, so $tmp stays set even in harnesses that drop shell state between tool calls. If a step fails, the agent stops and tells the user, and never deletes or recreates a folder to make the step pass.
  3. The final check catches a half-finished swap: test -d <dest> && test ! -L <dest> && test -f <dest>/SKILL.md. Step 4 is also test ! -e <dest> && mv "$tmp" <dest>. If the link were still there, a bare mv would drop the copy inside the shared checkout.
  4. A <dest> placeholder (and <link> for the source) covers both ~/.agents/skills/<skill> and the project's .agents/skills/<skill>, with a three-way case list: symlink, missing, plain folder.

There is also one CHANGELOG line. No version or credit changes.

Verification

  • ./scripts/check-skill-names.sh prints ok: 55 skill names match their folders.
  • git diff --check is clean.
  • I ran the exact commands on a scratch copy:
    • Global symlink: the copy is in place, and the checkout's files are intact.
    • Project folder missing: the copy lands at the project path, and the global link is kept.
    • Half-finished swap (rm skipped): the test ! -e guard stops mv, and the checkout is untouched.
    • The final check fails while <dest> is still a link.
  • $(mktemp -d) and $tmp are not tokens Claude Code rewrites in skill text: reflect declares no arguments: in its frontmatter, and neither is $ARGUMENTS, a $N or a ${CLAUDE_*} token. No bang-backtick sequences.

🤖 Generated with Claude Code

Second review follow-up to #3. The copy steps take a <dest>
placeholder for the global or project path, cover a project that has
no copy yet (copy from the global link and keep it), use mktemp -d
instead of a fixed temp path, refuse to mv onto an existing path, and
verify test -d, test ! -L and SKILL.md before editing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tomaas
tomaas merged commit 8beb473 into main Oct 24, 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.

1 participant