context-optimization
Agent skill frommuratcankoylan/Agent-Skills-for-Context-Engineering
This skill should be used for improving context efficiency: context budgeting, observation masking, prefix or KV-cache strategy, partitioning, token-cost reduction, retrieval scoping, and extending effective context capacity without lowering answer quality.
How to install context-optimization
install context-optimization
# install the Agent-Skills-for-Context-Engineering pack with the skills CLI
npx skills add muratcankoylan/Agent-Skills-for-Context-Engineering# or add only this skill to Claude Code: copy the folder
skills/context-optimization/
# into
~/.claude/skills/context-optimization/ (all projects)
.claude/skills/context-optimization/ (one project)
1# Context Optimization Techniques23Context optimization extends the effective capacity of limited context windows through strategic compression, masking, caching, and partitioning. Effective optimization increases useful capacity without requiring larger models or longer windows — but only when applied with measurement discipline. The techniques below are ordered by impact and risk.45## When to Activate67Activate this skill when:8- Context budgets or token costs constrain task complexity9- Observation masking can replace verbose tool outputs with retrievable references10- Prefix or KV-cache hit rate needs improvement11- Retrieval scoping can reduce irrelevant loaded context12- Context partitioning can extend effective capacity across agents13- Budget triggers are needed for masking, compaction, or partitioning1415Do not activate this skill for adjacent work owned by other skills:16- Explaining why attention or context windows behave this way: `context-fundamentals`.17- Diagnosing active lost-in-middle, poisoning, distraction, confusion, or clash: `context-degradation`.18- Designing a structured handoff summary for a long conversation: `context-compression`.19- Storing large outputs, plans, or logs as files: `filesystem-context`.20- Model-initiated rewrites of its own context and their re-prefill cost: `self-managed-context`.2122## Core Concepts2324Apply four primary strategies in this priority order:25…
Excerpt shown under the repository's MIT license.
