claude-code - 💡(How to fix) Fix Duplicate skills in /context when multiple CLAUDE.md files resolve to the same .claude/skills/ directory [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#46833Fetched 2026-04-12 13:31:52
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Author
Timeline (top)
labeled ×3commented ×1

When a project uses @ imports in CLAUDE.md to create a multi-file instruction chain, and multiple files in that chain cause the skill scanner to walk the same .claude/skills/ directory, the skill appears multiple times in /context output.

Root Cause

When a project uses @ imports in CLAUDE.md to create a multi-file instruction chain, and multiple files in that chain cause the skill scanner to walk the same .claude/skills/ directory, the skill appears multiple times in /context output.

Code Example

C:\Projects\
├── CLAUDE.md                          # root — imports both children
├── BawrLabs\
│   ├── CLAUDE.md                      # studio instructions
│   └── .claude\skills\startup\SKILL.md  # one physical skill file
└── Homestead\
    ├── CLAUDE.md                      # imports Home_Dev + BawrLabs
    └── Home_Dev\
        └── CLAUDE.md                  # project-level dev instructions

---

C:\Projects\CLAUDE.md
├── @./BawrLabs/CLAUDE.md          ← first time BawrLabs is in scope
└── @./Homestead/CLAUDE.md
    ├── @Home_Dev/CLAUDE.md
    └── @../BawrLabs/CLAUDE.md     ← second time BawrLabs is in scope

---

Skills · /skills

Project
└ wow-addon-dev: 91 tokens
└ end-session: 7 tokens
└ startup: 6 tokens      ← duplicate
└ startup: 6 tokens      ← duplicate
└ gate2-prep: 6 tokens
RAW_BUFFERClick to expand / collapse

Description

When a project uses @ imports in CLAUDE.md to create a multi-file instruction chain, and multiple files in that chain cause the skill scanner to walk the same .claude/skills/ directory, the skill appears multiple times in /context output.

Reproduction

Directory structure

C:\Projects\
├── CLAUDE.md                          # root — imports both children
├── BawrLabs\
│   ├── CLAUDE.md                      # studio instructions
│   └── .claude\skills\startup\SKILL.md  # one physical skill file
└── Homestead\
    ├── CLAUDE.md                      # imports Home_Dev + BawrLabs
    └── Home_Dev\
        └── CLAUDE.md                  # project-level dev instructions

Import chain

C:\Projects\CLAUDE.md
├── @./BawrLabs/CLAUDE.md          ← first time BawrLabs is in scope
└── @./Homestead/CLAUDE.md
    ├── @Home_Dev/CLAUDE.md
    └── @../BawrLabs/CLAUDE.md     ← second time BawrLabs is in scope

Steps

  1. Open Claude Code with the working directory set to C:\Projects\BawrLabs
  2. Run /context
  3. Observe the Skills section:
Skills · /skills

Project
└ wow-addon-dev: 91 tokens
└ end-session: 7 tokens
└ startup: 6 tokens      ← duplicate
└ startup: 6 tokens      ← duplicate
└ gate2-prep: 6 tokens

There is only one physical startup/SKILL.md on disk (in BawrLabs/.claude/skills/startup/). There is no .claude/skills/ directory in the Homestead repo at all.

Expected behavior

The skill scanner should deduplicate by resolved file path (or skill directory path). Each unique SKILL.md should appear exactly once in /context, regardless of how many times its parent directory is reachable through @ import chains.

Actual behavior

The same skill appears twice — once for each CLAUDE.md file that brings BawrLabs/ into scope.

Environment

  • Claude Code CLI on Windows 11 (10.0.26200)
  • Shell: bash
  • Model: claude-opus-4-6 (1M context)

Notes

  • The duplicate is cosmetic — invoking the skill works fine and runs the single physical file
  • Both entries show identical token counts (6 tokens) and identical descriptions ("Studio Startup")
  • The same issue could affect any skill in a .claude/skills/ directory that is reachable through multiple @ import paths

extent analysis

TL;DR

The issue can be resolved by modifying the skill scanner to deduplicate skills based on their resolved file paths.

Guidance

  • The likely cause of the issue is that the skill scanner is not properly handling multiple @ import chains that reference the same .claude/skills/ directory.
  • To verify the issue, check the /context output for duplicate skills and confirm that the duplicate skills have the same token count and description.
  • To mitigate the issue, consider modifying the skill scanner to keep track of the skills it has already encountered and skip duplicates based on their resolved file paths.
  • The fix may involve updating the skill scanner to use a data structure such as a set or map to store the skills it has encountered, using the resolved file path as the key.

Example

No code example is provided as the issue does not include specific code snippets.

Notes

The issue is cosmetic and does not affect the functionality of the skills, but it may still cause confusion for users. The fix should ensure that each unique skill appears only once in the /context output, regardless of how many times its parent directory is reachable through @ import chains.

Recommendation

Apply a workaround by modifying the skill scanner to deduplicate skills based on their resolved file paths, as this will resolve the issue without requiring any changes to the existing codebase or dependencies.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

The skill scanner should deduplicate by resolved file path (or skill directory path). Each unique SKILL.md should appear exactly once in /context, regardless of how many times its parent directory is reachable through @ import chains.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING