Gemini Context Master
This skill implements senior-level context engineering to maximize token efficiency and maintain long-term project memory.
1. Strategic Compaction
Do not wait for auto-compaction. Manually trigger or suggest compaction at logical task boundaries to prune old exploration data while keeping the "Final Plan" and "Current Progress".
When to Compact:
- After a long research phase and before starting execution.
- After successfully completing a major milestone.
- When the context feels "sluggish" or token count is high (>50k).
Compaction Workflow:
- Summarize the Current State (what has been done).
- Carry over the Pending Tasks (what is next).
- Carry over any Crucial Findings (API keys locations, architectural decisions).
- Run
/compact.
2. Surgical Context Pruning
Avoid reading entire large files. Use targeted tools to keep the context clean.
- Prefer
grep_search: Find specific lines instead of reading 1000+ lines. - Use
read_filewith line ranges: Only read the relevant function or class. - Prune Output: If a command produces massive output, only carry over the error or the relevant success message.
3. Persistent Project Memory (GEMINI.md)
Every project should have a GEMINI.md file in the root. This acts as a "Source of Truth" that saves tokens by preventing repetitive questions.
GEMINI.md Structure:
- Tech Stack: Languages, frameworks, versions.
- Conventions: Naming styles, directory structure.
- Manual Overrides: Specific instructions for this project only.
4. Token-Saving Guidelines
- No Chitchat: Keep responses technical and direct.
- Aggregated Tool Calls: Run independent tasks in parallel within one turn.
- Contextual Precedence: Always check
GEMINI.mdbefore asking for project details.