Individual skill
context-optimization
Use when optimizing token usage, KV cache efficiency, or context window management for LLM agents. Keywords: context optimization, KV cache, prompt caching, token budget, semantic pruning, lost-in-the-middle.
skills/engineering/context-optimization/SKILL.md
Source commit 1c04afc2a760ed58cea1308851e7626f76c4ff44
What was checked
- Matches the observed repository HEAD
- Yes
- Scanner rules are current
- No
- Repository scan complete
- No
- Skill scan complete
- Yes
- Observed behavior
- Not checked yet
- Last checked
- Nov 6, 2026
These are observations at the recorded commit, not a guarantee of safety. Review the source before running it.
Install this skill
Choose an agent in your Stack or copy a command below. Commands fetch the pinned commit and copy only this skill directory. Existing destinations are refused. Copying a command does not install anything.
An install command is unavailable: current rules, complete repository and skill scans, an eligible behavior level and a permitted license are required.
Repository context
- Repository stars (not skill ratings)
- 27
- Repository last updated
- Oct 24, 2026
- License
- Apache-2.0
Observed agent integration: No specific integration evidence. Standard SKILL.md installation does not imply verified compatibility.
- claude-code Repository topic
- agent-skills Repository topic
- agentic-workflow Repository topic
- skill-md Repository topic
- ai-agent Repository topic
- ai-workflows Repository topic
- codex Repository topic
- coding-agent Repository topic
- developer-tools Repository topic
- gemini-cli Repository topic
- finance Derived category
Files and excerpt
File metadata and permitted, redacted excerpts come from the recorded scan. Source links are pinned to that commit.
Browse files
SKILL.mdcore · 4,039 bytes
Read excerpt
# Context Optimization Skill
This skill provides methodologies and best practices for maximizing context window efficiency, reducing token costs, and improving the performance of LLM-based agentic workflows.
## 1. Prompt Cache Alignment
To maximize Key-Value (KV) cache hits, prioritize stability in the early parts of the prompt.
- **Static Prefixes**: Design system prompts to remain identical across agent turns.
- **Tool Order**: Sort tool definitions alphabetically or by frequency of use. Keep this ordering constant.
- **Prefix Consistency**: Reserve the top 70% of the KV cache for global system instructions and tool definitions.
- **Avoid Dynamic Data**: Move dynamic session-specific data (dates, current file list) to the end of the context window.
## 2. Semantic Pruning & AST Compaction