Use the Long Context Window — Paste the Whole Thing, Then Ask
What it is
A technique that plays to Gemini's strength: load a large body of code or documents into its very long context window in one go, then ask questions that require seeing all of it at once.
Why it works
Gemini's headline capability is a huge context window. For questions that span many files — 'where does this data flow break invariants?', 'is this pattern used consistently?' — having everything in context beats retrieval, which only surfaces fragments. The model can reason across the whole thing instead of guessing at the gaps.
When to use it
Cross-cutting questions over a medium codebase, a long spec plus its implementation, or a set of documents you need reconciled. Anywhere the answer depends on relationships between distant parts.
When not to use it
A single-file tweak — loading the whole repo is wasteful and can dilute focus. And don't exceed the window: past the limit, earlier content silently drops out.
Prompt
Paste or attach the full source, then ask a whole-system question:
"Here is the entire service (all files below). Trace how a request flows from the HTTP handler to the database, and list every place the user's tenant ID is checked — and any path where it isn't."Example
Given a 25-file service in one prompt, Gemini finds the single endpoint missing a tenant-ID check — a bug invisible to file-by-file review because the pattern was correct everywhere else.
Advanced version
Structure the pasted context: prefix each file with its path, put the question last, and ask Gemini to cite file and line for each finding. Long context plus a demand for citations turns a vague scan into an auditable review you can act on.
Common mistakes
- Overflowing the context window, so the earliest files are dropped and the answer misses them.
- Pasting everything for a question that only needed one file — noise, not signal.
- Not asking for file/line citations, leaving you unable to verify what it found.