$npx -y skills add DevelopersGlobal/ai-agent-skills --skill context-loadingLoad minimum necessary context into agent context windows. Prevents token bloat, reduces cost, and improves focus. Only load what the current task needs.
| 1 | ## Overview |
| 2 | |
| 3 | More context is not better context. Irrelevant context dilutes attention, increases cost, and slows inference. This skill enforces disciplined context loading: only the files, docs, and history that the current task requires. |
| 4 | |
| 5 | ## When to Use |
| 6 | |
| 7 | - Before starting any complex agent task |
| 8 | - When designing system prompts for production agents |
| 9 | - When context windows are filling up |
| 10 | |
| 11 | ## Process |
| 12 | |
| 13 | ### Step 1: Identify Required Context |
| 14 | |
| 15 | 1. List the files/docs the agent needs to read to complete THIS specific task. |
| 16 | 2. For each item, ask: *"Can the agent complete the task without this?"* If yes, don't include it. |
| 17 | 3. Prioritize: system prompt → task definition → directly relevant code → supporting references. |
| 18 | |
| 19 | **Verify:** Every item in context is directly necessary for the current task. |
| 20 | |
| 21 | ### Step 2: Summarize, Don't Dump |
| 22 | |
| 23 | 4. Long conversation history → summarize to key decisions and current state. |
| 24 | 5. Large files → extract only the relevant functions/sections. |
| 25 | 6. Entire docs → extract only the relevant sections. |
| 26 | 7. Previous agent output → extract only the conclusions and next steps. |
| 27 | |
| 28 | **Verify:** No item in context exceeds what's needed from that source. |
| 29 | |
| 30 | ### Step 3: Set Context Budgets |
| 31 | |
| 32 | 8. Define token allocation for each context section: |
| 33 | - System prompt: ≤ 2,000 tokens |
| 34 | - Task definition: ≤ 500 tokens |
| 35 | - Code context: ≤ 4,000 tokens |
| 36 | - Conversation history (summarized): ≤ 1,000 tokens |
| 37 | 9. Stay well within model context limits (leave 30% buffer for output). |
| 38 | |
| 39 | **Verify:** Total prompt fits within 70% of model context limit. |
| 40 | |
| 41 | ### Step 4: Refresh Context for New Tasks |
| 42 | |
| 43 | 10. Don't carry over context from a completed task to a new task. |
| 44 | 11. Start each distinct task with a fresh, minimal context. |
| 45 | 12. Re-introduce only what the new task genuinely needs. |
| 46 | |
| 47 | ## Verification |
| 48 | |
| 49 | - [ ] Context items limited to task-required items only |
| 50 | - [ ] Long content summarized before inclusion |
| 51 | - [ ] Token budget defined and respected |
| 52 | - [ ] Context window at ≤70% capacity |
| 53 | |
| 54 | ## References |
| 55 | |
| 56 | - [rag-and-memory skill](../rag-and-memory/SKILL.md) |
| 57 | - [multi-agent-orchestration skill](../multi-agent-orchestration/SKILL.md) |