context-caching
Skill2 starsChanged 28 days agoApache-2.0View on GitHub
Use this skill when managing large-context Gemini operations (1M-2M tokens), architecting prefix-cached repository indexes, optimizing prompt structures for cost and latency, or structuring session memory for long-running agent workflows.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- theketan26/context-cachingtheir own version, first seen Sep 25, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- theketan26/context-caching★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository108 other files it gives its agents.
- AGENTS.mdAGENTS.md
- everything-gemini-maintainerSkill
- adversarial-fuzz-generatorSkill
- agent-evalsSkill
- ai-first-engineeringSkill
- alloydb-omni-vectorSkill
- apache-kafka-streamsSkill
- api-craftsmanSkill
- architecture-designerSkill
- argon-3d-game-engineSkill
- argon-3d-scene-architectSkill
- argon-procedural-asset-generatorSkill
- argon-visual-critique-loopSkill
- argo-workflowsSkill
- autonomous-incident-healerSkill
- axum-web-serviceSkill
- bigquery-vector-searchSkill
- browser-qa-testerSkill
- chromadb-vector-storeSkill
- cilium-ebpf-networkingSkill
- clickhouse-analyticsSkill
- cloud-deploy-canarySkill
- cloudflare-r2-object-storageSkill
- cloudflare-workersSkill
- cloud-run-agentsSkill
- context-distillation-compressorSkill
- context-warmerSkill
- continuous-learningSkill
- cost-oracle-finopsSkill
- cross-repo-swarm-syncSkill
- cve-remediation-orchestratorSkill
- database-architectSkill
- dataproc-spark-analyticsSkill
- dbt-transformationSkill
- debezium-cdcSkill
- devops-pipelineSkill
- distributed-rate-limitingSkill
- docker-compose-orchestratorSkill
- duckdb-local-olapSkill
- dynamic-thinking-allocationSkill
- ebpf-microvm-sandboxSkill
- ebpf-sandbox-enforcerSkill
- elephant-goldfish-modelSkill
- envoy-ai-gatewaySkill
- ephemeral-swarm-orchestratorSkill
- fastapi-productionSkill
- fullstack-nextjsSkill
- game-audio-synthesizerSkill
- game-studioSkill
- gemini-function-callingSkill
- gemini-groundingSkill
- gemini-live-audio-transcriberSkill
- gemini-live-multimodalSkill
- gemini-live-screen-visionSkill
- gemini-multimodalSkill
- genetic-prompt-cross-pollinatorSkill
- git-craftsmanSkill
- github-opsSkill
- google-axSkill
- google-flow-orchestratorSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 2 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 31
Never mutate the prefix: Avoid injecting dynamic timestamps, random IDs, or changing session metadata at the beginning of the context.
- Distinctive: line 32
Cluster Static Assets: Place unchanging documentation, API contracts, and core schemas at the very top of context assemblies.
- Very specific: line 39
Session Compaction: When conversation histories grow long, trigger the Stop or PostInvocation summarizer to compress intermediate thoughts …
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Gemini Context Caching & Large-Context Optimization
Overview
Gemini's 1M-to-2M token context window combined with explicit and implicit Context Caching allows agents to ingest entire codebases, documentation sets, and transaction logs. This skill outlines architectural strategies to maximize caching efficiency, cut API token costs by up to 75%, and minimize time-to-first-token (TTFT).
Context Architecture: Prefix Optimization
Gemini caching relies on deterministic prefix matching. To ensure cache hits across agent invocations:
┌─────────────────────────────────────────────────────────────┐
│ 1. STATIC PREFIX (Cached - High Hit Rate) │
│ - System Instructions & Repository Rules (GEMINI.md) │
│ - Architecture Specs & Database Schemas │
│ - Base Codebase Index / AST Dump │
├─────────────────────────────────────────────────────────────┤
│ 2. DYNAMIC SUFFIX (Uncached - Fast Processing) │
│ - Current User Prompt / Incremental Task Diff │
│ - Recent Terminal Command Output │
│ - Real-Time Conversation Turn │
└─────────────────────────────────────────────────────────────┘Golden Rules for Caching
- Never mutate the prefix: Avoid injecting dynamic timestamps, random IDs, or changing session metadata at the beginning of the context.
- Cluster Static Assets: Place unchanging documentation, API contracts, and core schemas at the very top of context assemblies.
- Chunking Thresholds: Context caching provides optimal return on investment when static context exceeds 32k tokens.
Progressive Ingestion Strategies
- Skeleton First: Ingest file tree maps and interface definitions before pulling full function implementations.
- Selective Hydration: Ingest full source files only for components identified during initial skeleton mapping.
- Session Compaction: When conversation histories grow long, trigger the
StoporPostInvocationsummarizer to compress intermediate thoughts into high-density Knowledge Items (KI).
Cost & Latency Economics
- Cached Input Cost: ~75% cheaper than non-cached input tokens.
- Cache Hit Latency: Reduces initial TTFT from seconds to milliseconds on large contexts.
Verification Checklist
- Static instructions positioned consistently at the head of context
- No variable timestamps or nonces in the static prefix block
- Cache hit rates monitored during multi-turn batch workflows
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

