Context Window Optimizer
Maximize AI context usage for complex tasks by structuring information for optimal token efficiency.
The Problem
Every AI model has a finite context window. When working on large codebases, lengthy documents, or multi-file analysis, you hit token limits fast. Poorly structured prompts waste tokens on irrelevant context, leaving the model without enough room to reason about what actually matters. The result: truncated analysis, missed connections, and shallow answers.
The Prompt
I need you to work within a limited context window efficiently. Here is how we will structure this:
PRIORITY CONTEXT (must retain):
[Insert the most critical information — key code, core requirements, constraints]
REFERENCE CONTEXT (summarize if needed):
[Insert supporting information — documentation, background, related code]
TASK:
[Your specific question or task]
RULES:
- Focus analysis on PRIORITY CONTEXT first
- Reference supporting context only when directly relevant
- If you need information not provided, state what is missing rather than guessing
- Structure your response to be reusable as context in follow-up prompts
- Use bullet points and code blocks over prose to minimize token usage
Example Output
ANALYSIS OF PRIORITY CONTEXT:
Key findings:
- The authentication middleware (line 42-58) checks JWT tokens but does not validate token expiry
- The user model references a deprecated session table (line 15)
From reference context:
- Migration docs confirm session table was replaced in v3.2
Missing information:
- Current JWT library version (needed to confirm expiry validation API)
Recommended fix:
// Add expiry check in auth middleware
if (decoded.exp < Date.now() / 1000) {
throw new TokenExpiredError();
}
When to Use
Use this skill when working with large codebases that exceed a single context window, when you need to analyze multiple files simultaneously, or when follow-up conversations need to build on prior analysis. It is essential for architecture reviews, security audits, and any task spanning more than a few hundred lines of code.
Pro Tips
- Front-load critical context — models pay most attention to the beginning of the prompt and the end; bury low-priority info in the middle.
- Summarize, do not paste — for background context, write a 3-line summary instead of pasting 200 lines of documentation.
- Ask for structured responses — bullet points and code blocks compress better as follow-up context than paragraphs of prose.
- Chain conversations — split large tasks across multiple prompts, carrying forward only the conclusions from each step.