Project-level markdown files that provide persistent context to Gemini CLI (similar to Claude's CLAUDE.md). Stores: project structure, coding conventions, architecture decisions, common commands, API patterns. Gemini automatically reads GEMINI.md from project root. Reduces repetitive prompts, improves code generation accuracy.
Gemini Md Context Files FAQ & Answers
9 expert Gemini Md Context Files answers researched from official documentation. Every answer cites authoritative sources you can verify.
unknown
9 questionsRecommended sections: (1) Project Overview (purpose, tech stack), (2) Architecture (folder structure, module organization), (3) Coding Standards (formatting, naming, patterns), (4) Development Workflow (build, test, deploy commands), (5) API Conventions (REST patterns, error handling), (6) Dependencies (key libraries, versions). Keep <5KB for fast loading.
Gemini automatically prepends GEMINI.md content to prompts. Example: gemini 'add user authentication' reads GEMINI.md, applies project-specific patterns (JWT vs OAuth, error handling format, etc.). Effective for: code generation, refactoring, test creation. Token cost: GEMINI.md counted once per session (context caching).
Include concrete examples, not just rules. Example: 'Error Handling: All API routes use AppError class with statusCode and message properties. Example: if (!user) throw new AppError(404, "User not found")'. Specific patterns: async/await vs callbacks, import style (named vs default), comment format. Avoid vague 'follow best practices'.
Strategies: (1) Root GEMINI.md with shared conventions + package-specific GEMINI.md in each package, (2) Single root GEMINI.md with package sections (## Package: api, ## Package: web), (3) .gemini/context/ folder with module-specific markdown files. Gemini CLI uses closest GEMINI.md in directory hierarchy.
Context caching (Gemini 1.5+): GEMINI.md content cached for 1 hour, reduces token costs 90% for repeated queries. First query: full GEMINI.md tokens charged. Subsequent queries within 1h: only incremental tokens charged. Optimization: keep GEMINI.md stable, use versioning for major changes. Cost: $0.0001/1K cached tokens vs $0.001/1K input tokens.
Versioning strategies: (1) Commit GEMINI.md to Git (track changes like code), (2) Use branches for experimental changes, (3) Add version header (# GEMINI.md v2.0 - Updated 2025-01-15), (4) Archive old versions in .gemini/archive/, (5) Document breaking changes in CHANGELOG.md. Review quarterly for accuracy.
Mistakes: (1) Too long (>10KB, slows every query), (2) Outdated info (stale patterns, old dependencies), (3) Vague guidelines ('write clean code'), (4) Missing examples (rules without concrete code), (5) Duplicate info from docs (reference docs instead). Keep concise, specific, current.
GEMINI.md (Gemini CLI): project context for command-line tool, supports context caching, markdown format, CLI-focused. .cursorrules (Cursor IDE): IDE-specific rules, JSON/YAML format, editor integration, autocomplete context. Both: project-specific AI context. Use both if using multiple tools. GEMINI.md more portable (works anywhere).