context-preflight
Prevents AI context-overflow by pre-estimating the memory requirements of your task and suggesting compaction if necessary.
Install
mkdir -p .claude/skills/context-preflight && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/14997" && unzip -o skill.zip -d .claude/skills/context-preflight && rm skill.zipInstalls to .claude/skills/context-preflight
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Estimate working-context demand before substantial work, detect context-shortage risk early, and trigger pre-work compaction or a reduced working set before the task becomes unstable. Use when a request spans multiple files, research artifacts, or large documentation rewrites.Key capabilities
- →Estimate working context demand
- →Detect context-shortage risk
- →Trigger pre-work compaction
- →Reduce working set for unstable tasks
- →Record preflight results
How it works
The skill estimates token demand from file sizes, adds buffers for instructions and output, and classifies the request into risk bands to determine if compaction is needed.
Inputs & outputs
When to use context-preflight
- →Checking if a large task fits context
- →Planning multi-file refactors
- →Reducing context pressure before start
- →Managing large documentation updates
- →Preventing mid-task data loss
About this skill
Context Preflight
Use this skill before substantial research, planning, implementation, or documentation rewrites.
Goals
- Estimate whether the upcoming task can fit safely in the agent's working context.
- Prefer pre-work compaction over emergency compaction in the middle of implementation.
- Preserve important constraints and decisions before context pressure becomes risky.
Why This Exists
- Mid-task compaction can drop important implementation details, decisions, or constraints.
- A brief preflight is cheaper than re-deriving lost context after work has already started.
- Prompt-engineering guidance favors clear structure, relevant context only, and explicit separation of instructions versus supporting material.
Capacity Model
- Estimate file-heavy technical material at roughly 1 token per 4 bytes.
- Estimate prose-heavy documentation at roughly 1 token per 3 bytes.
- Reserve working room for instructions, the active user request, interim notes, validation output, and the final response.
- Keep a safety margin of at least 25 percent of the practical working budget.
Risk Bands
- Low risk: projected working set uses less than 55 percent of the practical budget.
- Medium risk: projected working set uses 55 to 75 percent of the practical budget.
- High risk: projected working set uses more than 75 percent of the practical budget or requires many large files plus long artifacts.
Procedure
- Identify the likely working set before deep reading.
- Estimate code and prose token demand from file sizes or search results.
- Add buffers for instructions, user intent, validation output, and planned artifact writing.
- Classify the request as low, medium, or high risk.
- If risk is high, compact before substantive work begins.
- If direct
/compactexecution is unavailable, reduce the working set and refresh request artifacts with a concise summary before continuing. - Re-run the estimate if the scope expands materially during the task.
Compaction Rules
- Prefer compaction before implementation, not during debugging or after multiple edits.
- Preserve active constraints, open questions, selected defaults, target files, and validation status in request artifacts before compaction.
- If a request can be split into phases instead of compacting, phased execution is acceptable.
Fallback When /compact Is Unavailable
- Update the active request artifacts with a concise state summary.
- Narrow the working set to only the currently relevant files.
- Defer non-critical side quests or cleanup to a later request.
Output Template
Use assets/context-risk-decision.template.md when recording the preflight result.
Limitations
- →Mid-task compaction can drop important implementation details
- →Direct /compact execution may be unavailable
- →Requires re-running estimate if scope expands materially
How it compares
This skill proactively assesses context capacity before starting a task, preventing mid-task issues that arise from context overflow or loss of information.
Compared to similar skills
context-preflight side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| context-preflight (this skill) | 0 | 4mo | No flags | Beginner |
| prompt-optimizer | 43 | 6mo | No flags | Beginner |
| context-compression | 13 | 2mo | Review | Advanced |
| learner | 2 | 3mo | No flags | Advanced |
Try saying
Example prompts that trigger this skill in your AI assistant.
You might also like
prompt-optimizer
solatis
Optimize system prompts for Claude Code agents using proven prompt engineering patterns. Use when users request prompt improvement, optimization, or refinement for agent workflows, tool instructions, or system behaviors.
context-compression
muratcankoylan
This skill should be used when the user asks to "compress context", "summarize conversation history", "implement compaction", "reduce token usage", or mentions context compression, structured summarization, tokens-per-task optimization, or long-running agent sessions exceeding context limits.
learner
Yeachan-Heo
Extract a learned skill from the current conversation
sub-agents
parcadei
Create and configure Claude Code sub-agents with custom prompts, tools, and models
skillforge
tripleyak
Intelligent skill router and creator. Analyzes ANY input to recommend existing skills, improve them, or create new ones. Uses deep iterative analysis with 11 thinking models, regression questioning, evolution lens, and multi-agent synthesis panel. Phase 0 triage ensures you never duplicate existing functionality.
reflect
llama-farm
Analyze the current session and propose improvements to skills. **Proactively invoke this skill** when you notice user corrections after skill usage, or at the end of skill-heavy sessions. Also use when user says "reflect", "improve skill", or "learn from this".