context-degradation
Detect Context Degradation in LLMs
Also available from: muratcankoylan,ChakshuGautam,Asmayaseen
Language models exhibit predictable performance degradation as context length increases. This skill helps diagnose lost-in-middle, poisoning, distraction, and clash patterns to build more reliable AI systems.
Download the skill ZIP
Upload in Claude
Go to Settings → Capabilities → Skills → Upload skill
Toggle on and start using
Test it
Using "context-degradation". Conversation has 60000 tokens. Agent started producing incorrect summaries after turn 20.
Expected outcome:
Analysis: Context degradation detected. The lost-in-middle phenomenon is likely causing the agent to miss key information from the middle of context. Recommendation: Apply compaction to summarize earlier context, or restructure to place critical info at edges.
Using "context-degradation". User asks about code from turn 1, but agent refers to wrong implementation from turn 15.
Expected outcome:
Analysis: Context clash detected. Multiple implementations exist in context with conflicting details. Recommendation: Use explicit versioning and mark conflicts for clarification before proceeding.
Security Audit
SafeStatic analysis flagged 20 potential issues including external_commands, network, and weak cryptographic algorithms. All findings are FALSE POSITIVES: the 'external_commands' detections are YAML token count examples with backtick formatting; 'network' is a legitimate GitHub URL in metadata; 'weak cryptographic algorithm' is a pattern matching error triggered by the word 'degradation'; 'system reconnaissance' falsely triggers on 'multi-source retrieval'. This skill is pure educational documentation about LLM context degradation with no executable code.
High Risk Issues (4)
Quality Score
What You Can Build
Debug Agent Failures
When an AI agent produces incorrect or irrelevant outputs during long conversations, use this skill to identify whether context degradation is the root cause
Design Resilient Systems
Architect systems that handle large contexts reliably by applying the Four-Bucket Approach and architectural patterns described in this skill
Evaluate Context Choices
Make informed decisions about context engineering for production systems by understanding degradation thresholds and mitigation strategies
Try These Prompts
Analyze this conversation for context degradation patterns. The conversation has grown to over 50000 tokens. Look for signs of lost-in-middle, poisoning, distraction, or clash.
Review the attached context and identify if critical information is buried in the middle. The task requires information from the middle section but outputs are incorrect.
Analyze this context for signs of poisoning. Symptoms include degraded output quality, tool misalignment, and persistent hallucinations despite corrections. What steps can recover?
Given a system that processes 200K+ token contexts with multiple independent tasks, recommend which Four-Bucket strategies (Write, Select, Compress, Isolate) to apply and why.
Best Practices
- Place critical information at the beginning or end of context where attention is highest
- Monitor context length and performance correlation during development
- Implement compaction triggers before degradation becomes severe
Avoid
- Assuming longer context always improves performance
- Loading all retrieved documents without relevance filtering
- Allowing context to grow indefinitely without segmentation
Frequently Asked Questions
What is the lost-in-middle phenomenon?
How does context poisoning occur?
What is the Four-Bucket Approach?
Do larger context windows always help?
How do I know if my context is poisoned?
Which models handle long context best?
Developer Details
Author
sickn33License
MIT
Repository
https://github.com/sickn33/antigravity-awesome-skills/tree/main/skills/context-degradationRef
main
File structure
📄 SKILL.md