[BUG] Project-local skills interfere with global slash command fuzzy matching

Status Fixed / completed
Reported on v2.1.29
Maintainer reply None cached
Activity 4 comments · opened Jan 31, 2026 · closed Feb 3, 2026

Bug Report

Issue: Skills fuzzy matching cache not cleared after removing project-local skills

Version: 2.1.29

Description:
After defining project-local skills in .claude/skills/ and then removing them:

  1. Claude Code prompts to install the removed skills
  2. The fuzzy matching still finds the old skill names (case-insensitive matching appears broken)

Root Cause: Found a skill file that was not UTF-8 encoded. After deleting this specific skill file, the issue was resolved.

Steps to Reproduce:

  1. Create a .claude/skills/ directory with custom skills
  2. Use the skills in a session
  3. Remove the skills directory
  4. Claude still prompts for the removed skills

Expected Behavior: Skills should be fully cleared from memory when removed

Workaround: Delete any non-UTF-8 encoded skill files

View original on GitHub ↗

4 Comments

github-actions[bot] · 8 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/21924
  2. https://github.com/anthropics/claude-code/issues/19107
  3. https://github.com/anthropics/claude-code/issues/18898

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

jaried · 8 months ago

This issue should NOT be closed as a duplicate. While the symptoms overlap with #21924, #19107, and #18898, my report provides critical new information that helps identify the ROOT CAUSE:

Key Differences

  1. Identified Trigger: I discovered the bug is triggered by creating project-local skills in .claude/skills/. The other reports do not identify this trigger.
  1. State Pollution: The bug persists even after deleting the skills folder. This reveals a deeper caching/state management issue - not just "fuzzy matching is broken" but "project skills permanently corrupt global command state."
  1. Reproduction Value: My 7-step reproduction clearly demonstrates:
  • Before adding skills: works fine
  • After adding skills: broken
  • After removing skills: STILL broken

This suggests the bug is in how project-local skills are merged with global commands, and how that state is cached/persisted. This is valuable information for fixing the actual root cause, not just the symptom.

Please keep this issue open as it provides unique diagnostic value that the other issues do not.

jaried · 8 months ago

Root Cause Found & Workaround

I was able to reproduce this issue and discovered the root cause:

The Hidden Problem: File Encoding Corruption

My folder is shared between Claude Code and another tool (Codex). When Codex modifies skill files, it writes them using incorrect encoding (likely GBK/ANSI instead of UTF-8), causing the files to become corrupted with garbled characters.

How This Triggers the Slash Command Bug

  1. When a skill file contains corrupted/mojibake characters, Claude Code's parser fails silently
  2. The failure corrupts the internal command registry state
  3. This broken state persists even after deleting the skills folder - suggesting the state is cached somewhere
  4. Result: fuzzy matching for global slash commands stops working

Solution

Fix the file encoding:

  • Open corrupted files in a text editor (VS Code, Notepad++, etc.)
  • Re-save with UTF-8 encoding (with BOM or without, both work)

After fixing the encoding, the slash commands work correctly again.

Suggestion for Developers

Consider adding:

  1. Encoding validation when parsing skill files - fail gracefully with a clear error message if encoding is wrong
  2. State isolation - project-local skills should not permanently corrupt global command state
  3. Cache invalidation - provide a way to clear/reset command state (e.g., /reload-commands)

Hope this helps others facing the same issue!

github-actions[bot] · 8 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.