context-degradation
Skill by muratcankoylan
Diagnoses and mitigates context degradation in AI agents, including lost-in-middle failures, context poisoning, confusion, and clashing sources. It is aimed at developers debugging agent failures or designing systems that handle large contexts.
Install context-degradation
Built from the published package, never by AI.
git clone --depth 1 https://github.com/muratcankoylan/Agent-Skills-for-Context-Engineering /tmp/Agent-Skills-for-Context-Engineering && mkdir -p ~/.claude/skills && cp -r /tmp/Agent-Skills-for-Context-Engineering/skills/context-degradation ~/.claude/skills/context-degradationRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
git clone --depth 1 https://github.com/muratcankoylan/Agent-Skills-for-Context-Engineering /tmp/Agent-Skills-for-Context-Engineering && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/Agent-Skills-for-Context-Engineering/skills/context-degradation ~/.gemini/antigravity-cli/skills/context-degradationAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Step-by-step: install context-degradation in Antigravity CLI
Skills can run scripts on your machine. Some need an API key: check the README.
About
context-degradation is an agent skill for diagnosing and fixing context failures in AI assistants. It describes five patterns: lost-in-middle, poisoning, distraction, confusion, and clash. For each pattern it lists detection signals and mitigation strategies. It also sets out a four-bucket framework of write, select, compress, and isolate.
The skill treats degradation as an engineering problem with measurable thresholds. It covers placing critical information at the start and end of context, recovering from poisoned context by removing it, isolating task contexts, and resolving conflicts with source priority rules. It is aimed at developers debugging agent failures or designing systems that must handle large contexts. The source says thresholds should be benchmarked against the user's own workload.
Written from the project's SKILL.md and checked against it.
What it can do
- Lost-in-middle diagnosisExplains how placement of critical information in long context affects recall, and how to place it at the start and end.
- Context poisoning recoveryDescribes detecting poisoned context and recovering by truncating or restarting with verified information only.
- Distraction controlAdvises filtering irrelevant documents and preferring tool-call access over pre-loading reference material.
- Task isolationRecommends separate context windows per task to prevent constraints from one task leaking into another.
- Clash resolutionRecommends marking contradictions explicitly and setting source precedence rules before conflicts arise.
- Four-bucket mitigationProvides write, select, compress, and isolate strategies matched to the active degradation pattern.
Try asking
- Why does my agent ignore instructions given early in a long prompt?
- Help me find where a bad fact entered my agent's context.
- Review my retrieval setup for distractors and conflicting sources.
Good to know
- Published thresholds are design guidance, not universal truths.
- Model-specific thresholds go stale with each model update.
- Does not cover basic context mechanics or compression design, which other skills handle.
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: skills/context-degradation/SKILL.md, skills/context-degradation/scripts/degradation_detector.py. This looks for known risky patterns and is not a full audit. How grades work
Inside the skill
-
SKILL.md19 KB -
references/patterns.md10 KB -
scripts/degradation_detector.py22 KB
Alternatives to context-degradation
All alternatives →Aligns a Qwen Code feature with a Codex or Claude Code reference agent. It runs both under the same scenario, captures HTTP and terminal traces, and compares them until behavior matches.
Searches, views, creates, updates, and deletes the user's Google Contacts from an AI assistant. It is for people who want to manage their address book through conversation. A one-time Google connect is required before it returns data.
Guides an AI assistant on error handling choices. It covers when to use Result, Option, ? propagation, unwrap, expect and panic, plus anyhow and thiserror.
Caveman is an agent skill that makes an AI assistant reply in a terse style. It cuts filler and keeps technical facts, code, commands and errors exact. It is built for users who want shorter, cheaper replies.
docs-sync audits or updates English SDK documentation against the requested implementation scope. It is for maintainers who want docs to match main branch features, configuration options, and defaults.
Guides an AI assistant through setting up and running monorepos with pnpm workspaces, Turborepo and Nx. Aimed at developers who need faster builds, shared code and managed dependencies across multiple packages.
Compare with agent-reproduce-align, google_contacts or m06-error-handling
context-degradation: common questions
What context degradation patterns does it cover?
The source names five patterns: lost-in-middle, context poisoning, distraction, confusion, and clash. Each has detection signals and mitigation strategies.
Does it give fixed token limits for when quality drops?
No. The source says degradation onset varies by model and task, and that thresholds should be benchmarked with your own workload rather than relying on published numbers.
Is this skill for reducing token usage?
Not directly. The source says token-efficiency tactics belong to a separate context-optimization skill and should be applied after the failure pattern is known.
How do I install context-degradation?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is context-degradation free?
The code is published under the MIT licence. The service it connects to may have its own pricing.
Is context-degradation safe to use?
It scores 94 of 100. Grades: maintenance A, licence A, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.
What are alternatives to context-degradation?
Similar skills: agent-reproduce-align, google_contacts, m06-error-handling, caveman.
