trinhhaox/ag-kit/context-engineering

Claude Code and agent skill by trinhhaox/ag-kit

Trust tier 2
  • community
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

LLM context window optimization - budget allocation, compression, progressive loading, RAG retrieval patterns for efficient AI interactions.

Install

npx vskill@latest install trinhhaox/ag-kit/context-engineering

SKILL.md

Context Engineering

Optimize how information is fed to LLMs for maximum output quality.

Context Budget Model

5-Zone Allocation
┌─────────────────────────────┐
│ System Instructions 10-15% │ Role, rules, output format
├─────────────────────────────┤
│ Task Context 20-30% │ Current request, conversation history
├─────────────────────────────┤
│ Reference Material 30-40% │ Code, docs, examples, search results
├─────────────────────────────┤
│ Working Memory 15-25% │ Intermediate reasoning, tool results
├─────────────────────────────┤
│ Output Reserve 10-15% │ Space for the response
└─────────────────────────────┘
Token Budgeting
typescript
const CONTEXT_LIMIT = 200000; // Claude's context window
const budget = {
system: Math.floor(CONTEXT_LIMIT * 0.12),
task: Math.floor(CONTEXT_LIMIT * 0.25),
reference: Math.floor(CONTEXT_LIMIT * 0.35),
working: Math.floor(CONTEXT_LIMIT * 0.18),
output: Math.floor(CONTEXT_LIMIT * 0.10),
};

Compression Techniques

Code Compression
Full file (expensive):
→ Remove comments and blank lines
→ Collapse import blocks to summary
→ Show only changed functions in full
→ Summarize unchanged functions as signatures only
Document Compression
Full document:
→ Extract headings + first sentence per section
→ Keep code examples, remove prose
→ Progressive: summary → relevant sections → full text
Conversation Compression
Turn 1-5 (old): Summarize to 2-3 sentences
Turn 6-8 (recent): Keep key decisions and outcomes
Turn 9-10 (current): Keep verbatim

Progressive Loading Strategy

Level 1: Structural Overview
Read file tree → understand project layout
Read function signatures → understand API surface
Read type definitions → understand data model
Level 2: Targeted Detail
Read specific function bodies relevant to task
Read test files for the module being modified
Read config files affecting behavior
Level 3: Deep Context
Read related modules for side effects
Read git history for recent changes
Read documentation for design decisions
Decision Rule
Load the minimum context needed to make a correct decision.
If uncertain, load one more level, not everything.

RAG (Retrieval-Augmented Generation)

Retrieval Strategy (Priority Order)
  1. Exact match — function name, error message, file path
  2. Semantic search — vector embedding similarity
  3. Keyword search — BM25 / full-text search
  4. Structural search — AST-based code search
Document Ranking
typescript
type SearchResult = {
content: string;
score: number; // Relevance score
source: string; // File path or URL
freshness: number; // How recent (0-1)
authority: number; // Source trustworthiness (0-1)
};
// Composite ranking
const finalScore = (r: SearchResult) =>
r.score * 0.5 + r.freshness * 0.3 + r.authority * 0.2;
Chunking Strategies
StrategyChunk SizeOverlapUse When
Fixed-size500-1000 tokens100 tokensGeneral text
SemanticBy paragraph/sectionNoneStructured docs
Code-awareBy function/classInclude importsSource code
RecursiveSplit by headers, then paragraphsMinimalLong documents

Context Quality Signals

Include (High Value)
  • Type definitions and interfaces
  • Function signatures with JSDoc
  • Error messages and stack traces
  • Test cases (show expected behavior)
  • Recent git diff (shows intent)
Exclude (Low Value)
  • Lock files (package-lock.json)
  • Generated code (dist/, .next/)
  • Binary files
  • Redundant imports across files
  • Unchanged boilerplate

Anti-Patterns

Anti-PatternProblemFix
Dump entire fileWastes context, dilutes signalExtract relevant functions only
No contextHallucination, incorrect assumptionsProvide minimum viable context
Stale contextOutdated info causes wrong decisionsRefresh before each major step
Repeated contextSame info in system + task + referenceDeduplicate across zones
Over-retrievalToo many RAG results overwhelmTop-k=5, re-rank, filter by score threshold

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewNot runA model review is scheduled for the next rescan.

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
1
7-day trend score
0

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/trinhhaox/ag-kit/context-engineering/badge)](https://verified-skill.com/skills/trinhhaox/ag-kit/context-engineering)

Something wrong with this skill or its page? Tell us.