context-fundamentals

Teaches context engineering principles for designing and optimizing LLM agent context windows.

Updated Mar 26, 2026
One-click install
npx skills add https://github.com/LGJ-Jonathan/Jonathan_Global_Claude_Skills --skill context-fundamentals-lgj-jonathan
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: context-fundamentals
Source: https://github.com/LGJ-Jonathan/Jonathan_Global_Claude_Skills/tree/main/context-engineering/skills/context-fundamentals
Command: npx skills add https://github.com/LGJ-Jonathan/Jonathan_Global_Claude_Skills --skill context-fundamentals-lgj-jonathan

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve? LLM agents degrade unpredictably as context grows: critical instructions get lost in the middle of long prompts, tool outputs balloon to dominate the window, and nominal token limits mask a much lower effective capacity. This Skill provides the foundational mental models, thresholds, and techniques needed to design, debug, and optimize context for agent systems. ## Core Features & Use Cases - Context anatomy guidance: Covers system prompts, tool definitions, retrieved documents, message history, and tool outputs, with concrete thresholds such as the 60-70% effective-capacity rule and the lost-in-the-middle effect. - Progressive disclosure and budgeting patterns: Explains three-level progressive disclosure, compaction triggers at 70-80% utilization, and sub-agent compression ratios of 1,000-2,000 tokens. - Executable utilities: Includes a Python module for token estimation, priority-aware context assembly, message truncation, structure validation, and lazy file loading. - Use Case: When an agent's reasoning quality collapses after 20-30 tool calls, use this Skill to diagnose that message history is consuming 70-80% of the window and implement observation masking plus compaction triggers. ## Quick Start Ask the agent to explain why my agent's performance degrades in long conversations and how to fix it using context budgeting and progressive disclosure.

Frequently Asked Questions about context-fundamentals

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent LLM agent performance from degrading in long conversations?

Monitor message history growth and trigger compaction at 70-80% context utilization rather than waiting for the window to fill. Replace stale tool outputs with compact summaries or references, and preserve architectural decisions and unresolved issues when compacting.

What is the effective capacity of a 200K token context window?

Effective capacity is typically 60-70% of the advertised window, so a 200K-token model begins degrading around 120-140K tokens. Complex retrieval accuracy can drop as low as 15% at extreme lengths, so budget against the effective ceiling, not the nominal limit.

How does progressive disclosure reduce token usage in agents?

Progressive disclosure loads only skill names and summaries at startup, fetching full content when a task explicitly matches activation conditions. Apply it at three levels: skill selection, document loading, and tool result retention, keeping recent results in full while compressing older ones.

Why do instructions in the middle of a system prompt get ignored?

The U-shaped attention curve gives the middle of context 10-40% lower recall accuracy than the beginning and end. Place safety constraints, output format requirements, and behavioral guardrails at the top or bottom of the prompt, never in the middle.

Can I rely on the 4 characters per token estimate for budgeting?

The 4-characters-per-token heuristic works only for rough English prose estimates. Code tokenizes at 2-3 characters per token and URLs or paths consume even more, so use a real tokenizer like tiktoken or the provider's token-counting API for budget-critical calculations.

When should I not pre-load context into an agent session?

Avoid pre-loading high-volatility content such as code state, external data, or user-specific information, since it goes stale quickly. Pre-load only low-volatility material like project conventions and team standards, and retrieve everything else just-in-time.