advanced-evaluation
This skill should be used for advanced LLM evaluation: LLM-as-judge systems, direct scoring, pairwise comparison, rubric…
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.
Claude Code
$ npx -y skills add muratcankoylan/agent-skills-for-context-engineering --skill context-optimization --agent claude-code
Codex
$ npx skills add muratcankoylan/agent-skills-for-context-engineering --skill context-optimization -a codex -y
Cursor
$ npx skills add muratcankoylan/agent-skills-for-context-engineering --skill context-optimization -a cursor -y
Gemini CLI
$ npx skills add muratcankoylan/agent-skills-for-context-engineering --skill context-optimization -a gemini-cli -y
GitHub Copilot
$ npx skills add muratcankoylan/agent-skills-for-context-engineering --skill context-optimization -a github-copilot -y
OpenCode
$ npx skills add muratcankoylan/agent-skills-for-context-engineering --skill context-optimization -a opencode -y
Windsurf
$ npx skills add muratcankoylan/agent-skills-for-context-engineering --skill context-optimization -a windsurf -y
name: context-optimization description: "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."
Context 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.
Activate this skill when:
Do not activate this skill for adjacent work owned by other skills:
Apply four primary strategies in this priority order:
1. **KV-cache optimization** — Reorder and stabilize prompt structure so the inference engine reuses cached Key/Value tensors. This is the cheapest optimization when the runtime supports prefix caching: low quality risk, immediate cost and latency savings. Apply it first when stable prefixes exist.
2. **Observation masking** — Replace verbose tool outputs with compact references once their purpose has been served. Tool outputs can dominate agent trajectories (claim-context-optimization-tool-output-dominance), so masking often yields the largest capacity gains. The original content remains retrievable if needed downstream.
3. **Compaction** — Summarize accumulated context when utilization exceeds 70%, then reinitialize with the summary. This distills the window's contents while preserving task-critical state. Compaction is lossy — apply it after masking has already removed the low-value bulk.
4. **Context partitioning** — Split work across sub-agents with isolated contexts when a single window cannot hold the full problem. Each sub-agent operates in a clean context focused on its subtask. Reserve this for tasks where estimated context exceeds 60% of the window limit, because coordination overhead is real.
The governing principle: context quality matters more than quantity. Every optimization preserves signal while reducing noise. Measure before optimizing, then measure the optimization's effect.
Trigger compaction when context utilization exceeds 70%: summarize the current context, then reinitialize with the summary. This distills the window's contents in a high-fidelity manner, enabling continuation with minimal performance degradation. Prioritize compressing tool outputs first (they consume 80%+ of tokens), then old conversation turns, then retrieved documents. Never compress the system prompt — it anchors model behavior and its removal causes unpredictable degradation.
Preserve different elements by message type:
Target 50-70% token reduction with less than 5% quality degradation. If compaction exceeds 70% reduction, audit the summary for critical information loss — over-aggressive compaction is the most common failure mode.
Mask observations selectively based on recency and ongoing relevance — not uniformly. Apply these rules:
Masking should achieve 60-80% reduction in masked observations with less than 2% quality impact. The key is maintaining retrievability — store the full content externally and keep the reference ID in context so the agent can request the original if needed.
Maximize prefix cache hits by structuring prompts so that stable content occupies the prefix and dynamic content appears at the end. KV-cache stores Key and Value tensors computed during inference; when consecutive requests share an identical prefix, the cached tensors are reused, saving both cost and latency.
Apply this ordering in every prompt: 1. System prompt (most stable — never changes within a session) 2. Tool definitions (stable across requests) 3. Frequently reused templates and few-shot examples 4. Conversation h
A comprehensive, open collection of Agent Skills focused on context engineering and harness engineering principles for building production-grade AI agent systems.
This skill should be used for advanced LLM evaluation: LLM-as-judge systems, direct scoring, pairwise comparison, rubric…
This skill should be used when modeling agent mental states with BDI concepts: beliefs, desires, intentions, RDF-to-belief…
This skill should be used when long-running agent sessions need context compression, structured summarization, compaction,…
This skill should be used for diagnosing and mitigating context degradation: lost-in-middle failures, context poisoning, context…
This skill should be used to explain or reason about the foundational concepts of context engineering: what context is, the…
This skill should be used when building agent evaluation systems: deterministic checks, regression suites, multi-dimensional…
Behavioral guidelines to reduce common LLM coding mistakes. Use when writing, reviewing, or refactoring code to avoid…
Design and build AI agents for any domain. Use when users: (1) ask to "create an agent", "build an assistant", or "design an AI…