davila7 avatar

Context Window Management

This covers the practical stuff you need when your LLM app starts bumping into token limits or losing track of what matters in long conversations. It's about strategies like tiered context (different approaches based on size), smart summarization that prioritizes importance over recency, and avoiding the lost-in-the-middle problem where models miss info buried in long contexts. The anti-patterns call out naive truncation and one-size-fits-all approaches, which is helpful. If you're building anything with conversation memory or multi-turn dialogues, you'll hit these problems eventually. Pairs well with RAG and prompt caching skills.

skills.sh installs
587
GitHub stars
33.2K
last updated
Aug 21, 2026

Install

$ npx -y skills add davila7/claude-code-templates --skill context-window-management --agent claude-code

Installs into .claude/skills of the current project.

Files

Context Window Management

You're a context engineering specialist who has optimized LLM applications handling millions of conversations. You've seen systems hit token limits, suffer context rot, and lose critical information mid-dialogue.

You understand that context is a finite resource with diminishing returns. More tokens doesn't mean better results—the art is in curating the right information. You know the serial position effect, the lost-in-the-middle problem, and when to summarize versus when to retrieve.

Your cor

Capabilities

  • context-engineering
  • context-summarization
  • context-trimming
  • context-routing
  • token-counting
  • context-prioritization

Patterns

Tiered Context Strategy

Different strategies based on context size

Serial Position Optimization

Place important content at start and end

Intelligent Summarization

Summarize by importance, not just recency

Anti-Patterns

❌ Naive Truncation

❌ Ignoring Token Costs

❌ One-Size-Fits-All

Related Skills

Works well with: rag-implementation, conversation-memory, prompt-caching, llm-npc-dialogue

Sponsors

Details

Repository
github.com/davila7/claude-code-templates
Category
AI & Agent Building
First seen
Jun 3, 2026

More from davila7/claude-code-templates

All 618
1wuyoscar avatargpt-imagewuyoscar/gpt-image2-skillWraps the GPT Image 2 API with a 162-prompt reference gallery, a prompt-craft checklist, and a CLI that routes text-to-image,...585skills.sh installs
2supermemoryai avatarsupermemorysupermemoryai/supermemorySupermemory is a state-of-the-art memory and context infrastructure for AI agents. Use this skill when building applications that need persistent memory, user p564skills.sh installs
3rkiding avataralphaear-searchrkiding/awesome-finance-skillsPerform finance web searches and local context searches. Use when the user needs general finance info from the web (Jina/DDG/Baidu) or needs to retrieve finance545skills.sh installs
4hkuds avatarcli-anything-chromadbhkuds/cli-anythingCommand-line interface for ChromaDB - A stateless CLI for managing vector database collections, documents, and semantic search. Designed for AI agents and autom540skills.sh installs
5hkuds avatarcli-anything-videocaptionerhkuds/cli-anythingAI-powered video captioning — transcribe speech, optimize/translate subtitles, and burn them into video via the stable VideoCaptioner backend. Free ASR and tran537skills.sh installs
6jezweb avatarbrains-trustjezweb/claude-skillsGet a second opinion from leading AI models on code, architecture, strategy, prompting, or anything. Queries models via OpenRouter, Gemini, or OpenAI APIs. Supp535skills.sh installs