Skip to content
Sniptide

GEMINI.md template

GEMINI.md is the context file Gemini CLI loads at the start of every session, so the agent knows your commands, layout and rules. Save the example below as GEMINI.md at the root of your repository, replace the commands and rules with your own, and run /memory show to check what Gemini loaded.

Updated

Files

GEMINI.mdRaw
# Project context

This is a FastAPI service with a Postgres database. Python 3.13, dependencies managed with uv.

## Commands

- Install: `uv sync`
- Start the database: `docker compose up -d --wait`
- Run the API: `uv run fastapi dev app/main.py`, then open `http://127.0.0.1:8000/docs`
- Check your work: `uv run ruff check .`, `uv run ruff format --check .` and `uv run pytest`

Run all three checks before you say a task is done, and report any that fail.

## Layout

- `app/routers/` holds one module per resource. Routes stay thin and call services.
- `app/services/` holds business logic. Services take a database session as an argument.
- `app/models.py` holds SQLAlchemy models. Schema changes need an Alembic migration.
- `tests/` mirrors `app/`.

## Rules

- Type every function signature. Use Pydantic models for request and response bodies.
- Read configuration from `app/settings.py`, never from `os.environ` directly.
- Create migrations with `uv run alembic revision --autogenerate -m "<change>"` and read the
  generated file before you keep it.
- Do not edit files in `alembic/versions/` that are already on the main branch.
- Ask before adding a dependency, deleting files or running commands that change the database
  outside the test container.

## Style

@docs/style.md

Save with your agent

Run this command to add Sniptide to Claude Code in the current project. Open /mcp in Claude Code and sign in to Sniptide. Once the server shows as connected, use the prompt below to save a private copy in your library.

Terminal
claude mcp add --scope local --transport http sniptide https://app.sniptide.com/api/mcp
Prompt
Read https://sniptide.com/templates/gemini-md.json and use create_snippet to save its files as a private Sniptide snippet titled "GEMINI.md template". Keep the file names and contents from the JSON.

How Gemini CLI loads it

Gemini CLI combines every context file it finds and sends the result with each prompt. It reads them in this order:

Location
Scope
~/.gemini/GEMINI.md
Your own preferences, in every project.
GEMINI.md in the project root and its parent folders
Rules for the whole repository. Commit it.
GEMINI.md in a subfolder
Rules for that part of the codebase, such as frontend/GEMINI.md.

Start gemini in the repository and run /memory show to print the combined context. After you edit a file, run /memory refresh to reload it. Gemini CLI repository

What each section does

The opening line names the stack and package manager, so the agent doesn't reach for pip in a uv project.

Commands lists the exact commands to install, run and check the project. The line after them asks the agent to run the checks itself and report failures.

Layout says where each kind of code lives, so new code lands in the right module.

Rules covers what the code can't show, such as where configuration comes from and which files never change. The last rule names the actions that need your approval.

@docs/style.md imports another file into the context. Use imports to keep GEMINI.md short and to share one style guide between several files. Paths are relative to the file that imports them.

Variant: share AGENTS.md with other agents

If your repository already has an AGENTS.md for other coding agents, point Gemini CLI at it instead of keeping two copies. Add this to .gemini/settings.json in the project:

.gemini/settings.json
{
  "context": {
    "fileName": ["AGENTS.md", "GEMINI.md"]
  }
}

Gemini CLI then loads both names in every folder it searches. Keep shared rules in AGENTS.md and put Gemini-specific notes in GEMINI.md.

Variant: a personal context file

Put rules that are about you rather than the project in ~/.gemini/GEMINI.md, so they follow you into every repository:

~/.gemini/GEMINI.md
# Personal preferences

- Explain a plan in a few bullet points before editing more than three files.
- Use British English in comments and documentation.
- Never run `git push`. I push myself.
All templates
  • Agent filesAGENTS.md template

    An AGENTS.md template and example with setup, checks, code style, testing and PR rules, plus a monorepo layout. Copy it into your repo.

  • Agent filesCLAUDE.md template

    A CLAUDE.md template for Claude Code with commands, layout, code style and rules, plus monorepo and AGENTS.md variants you can copy.

  • Agent filescopilot-instructions.md template

    A copilot-instructions.md example for GitHub Copilot with build commands, layout, code style and PR rules, plus a path-specific instructions file.

Pick where your library lives.

Use sniptide.com

Save your first pattern in the app, then connect Claude Code, Cursor or Codex with one sign-in in the browser.

Run it on your own server

One image and a database give you the app, the API and the MCP endpoint. Sniptide is open source under AGPL-3.0.

$docker compose up -d