Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
A comprehensive collection of Agent Skills for context engineering, multi-agent architectures, and production agent systems.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
examples/llm-as-judge-skills/skills/context-fundamentals/context-fundamentals.md
1# Context Fundamentals Skill23## Overview45Context engineering is the systematic approach to managing what information an LLM receives and how it processes that information. Effective context management directly impacts output quality, consistency, and task success rates.67## Core Principles89### 1. Context Window Management1011The context window is finite. Every token counts. Prioritize information by relevance and recency.1213**Strategies:**14- Summarize historical conversation turns15- Use retrieval to inject only relevant context16- Implement context compression for long documents1718### 2. Information Hierarchy1920Structure context to guide model attention:2122```231. System Instructions (highest priority)24└── Role definition25└── Task constraints26└── Output format requirements27282. Relevant Context (dynamic)29└── Retrieved documents30└── User-specific data31└── Recent conversation history32333. User Input (current request)34└── Query or instruction35└── Any inline context36```3738### 3. Context Relevance3940Not all context is equally useful. Apply relevance filtering:4142- **Temporal Relevance**: Recent information often outweighs older data43- **Semantic Relevance**: Use embeddings to surface related content44- **Task Relevance**: Only include information needed for current task4546## Context Types4748### Static Context49- System prompts50- Role definitions51- Tool descriptions52- Format specifications5354### Dynamic Context55- Retrieved documents (RAG)56- Conversation history57- User preferences58- Session state5960### Ephemeral Context61- Current tool outputs62- Intermediate reasoning steps63- Scratchpad content6465## Best Practices66671. **Explicit Over Implicit**: State requirements clearly rather than relying on inference682. **Structured Formatting**: Use consistent delimiters and sections693. **Redundancy Removal**: Avoid repeating information across context sections704. **Source Attribution**: Mark where context comes from for traceability715. **Freshness Signals**: Indicate when information was last updated7273## Context Patterns7475### RAG Integration Pattern76```77[System Instructions]78You are a helpful assistant. Use the provided context to answer questions.79Only use information from the context. If unsure, say so.8081[Retrieved Context]82<document source="doc1.pdf" date="2024-01-15">83Content here...84</document>8586[User Query]87{user_input}88```8990### Multi-Turn Context Pattern91```92[System Instructions]93...9495[Conversation History]96Summary of earlier turns: {summary}9798Recent exchanges:99User: {recent_user_1}100Assistant: {recent_assistant_1}101User: {recent_user_2}102Assistant: {recent_assistant_2}103104[Current Turn]105User: {current_input}106```107108## Metrics109110- **Context Utilization Rate**: How much of provided context is used in response111- **Context Relevance Score**: Semantic similarity between context and response112- **Context Compression Ratio**: Original size vs. compressed size113- **Information Retention**: Key facts preserved after summarization114115