When your agent starts hallucinating facts it just read or ignoring critical instructions buried in a long prompt, you're hitting context degradation. This skill walks through five failure patterns: lost-in-middle (that U-curve attention problem where middle content gets ignored), poisoning (bad tool outputs contaminating everything downstream), distraction (irrelevant docs tanking performance even when correct info is present), confusion (mixing up constraints from different tasks), and clash (contradictory but valid sources). It's built around the insight that these aren't random failures but predictable engineering problems with specific detection signals. The placement strategies and filtering rules are directly applicable if you're building anything that needs to handle contexts over 4K tokens reliably.

skills.sh installs
280
GitHub stars
18.3K
last updated
May 26, 2026

Install

$ npx -y skills add muratcankoylan/agent-skills-for-context-engineering --skill context-degradation --agent claude-code

Installs into .claude/skills of the current project.

Files

Context Degradation Patterns

Diagnose and fix context failures before they cascade. Context degradation is not binary — it is a continuum that manifests through five distinct, predictable patterns: lost-in-middle, poisoning, distraction, confusion, and clash. Each pattern has specific detection signals and mitigation strategies. Treat degradation as an engineering problem with measurable thresholds, not an unpredictable failure mode.

When to Activate

Activate this skill when:

  • Agent performance degrades unexpectedly during long conversations
  • Debugging cases where agents produce incorrect or irrelevant outputs
  • Designing systems that must handle large contexts reliably
  • Evaluating context engineering choices for production systems
  • Investigating "lost in middle" phenomena in agent outputs
  • Analyzing context-related failures in agent behavior

Sponsors

Details

Repository
github.com/muratcankoylan/agent-skills-for-context-engineering
Category
AI & Agent Building
License
MIT
First seen
Jun 11, 2026

More from muratcankoylan/agent-skills-for-context-engineering

All 17
1trustwallet avatartrust-wallet-clitrustwallet/tw-agent-skillsTrust Wallet CLI (`twak`) — install, create wallets, check balances, send tokens, swap, view history, set price alerts, DCA automations, limit orders, manage ER277skills.sh installs
2itechmeat avatarsocial-writeritechmeat/llm-codeCreate engaging content for social media platforms: X posts and threads, LinkedIn, Threads, Instagram, Facebook. Includes writing styles, AI-avoidance patterns,269skills.sh installs
3pskoett avatarcontext-surfingpskoett/pskoett-ai-skillsMonitors context window health throughout a session and rides peak context quality for maximum output fidelity. Activates automatically after plan-interview and269skills.sh installs
4muratcankoylan avatarevaluationmuratcankoylan/agent-skills-for-context-engineeringThis handles the full lifecycle of testing agent systems: deterministic checks before you burn tokens on LLM judges, multi-dimensional...262skills.sh installs
5tech-leads-club avatarjira-assistanttech-leads-club/agent-skillsManage Jira issues via Atlassian MCP — search, create, update, transition status, and handle sprint tasks. Auto-detects workspace configuration. Use when user s261skills.sh installs
6prompt-security avatarsoul-guardianprompt-security/clawsecDrift detection + baseline integrity guard for agent workspace files with automatic alerting support257skills.sh installs