[FEATURE] Skill tool should deduplicate - loading same skill multiple times fills context
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
The Skill tool appends full skill content to the Messages context every time it's invoked, even for the same skill. There's no deduplication, causing rapid context exhaustion.
You can easily reproduce this by
- Getting a token-rich skill (~5k+ tokens)
- Check your current context
- Ask Claude to load it 10+ times.
Proposed Solution
Track loaded skill IDs per session. Before appending content, check if skill ID already exists. If so, skip the load and optionally log "Skill X already loaded."
Alternative Solutions
Compaction seems to de-duplicate it properly. This is decent but not ideal at all, especially if trying to implement context-based skill loading.
Priority
High - Significant impact on productivity
Feature Category
Performance and speed
Use Case Example
I wanted to implement directory-based skill loading so that it loads relevant skills based on which directory Claude explores. The reason for this is that Claude is really bad at invoking skills on its own. So I thought, why not force it based on context?
- Set up a hook that triggers Skill("my-skill") on file reads
- Read multiple files that match the hook pattern
- Issue occurs
Additional Context
I've been using skills for weeks, and I didn't even know it didn't de-duplicate until I tried to make my hook implementation. I'm sure many people are manually invoking the same skills over and over to "remind" Claude to use them, and accidentally are wasting their context.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗