.gitignore for AI Tools

One curated block for Claude Code, Cursor, Aider and friends — and the files you should commit instead.

Verified against Claude Code v2.1.205 · 2026-07-09

Paste this into your .gitignore. It covers what today's AI coding tools actually leave behind — nothing speculative, nothing that belongs in git. Every line is explained below.

# ── AI coding tools ──────────────────────────────────────────
# curated at statuslinemaker.com/gitignore · updated 2026-07-08

# Claude Code — local-only files. Everything else in .claude/
# (settings.json, commands/, agents/, skills/) is made to be shared.
.claude/settings.local.json
CLAUDE.local.md

# Aider — chat history, cache, local config
.aider*

# Secrets AI tools read — and will happily paste into a commit
.env
.env.*
!.env.example
*.pem

Why this block is short

Most "AI gitignore" lists you'll find are padded with directories that don't exist, tools that keep their state in your home folder, and files their own vendors tell you to commit. Ignoring a file that never appears costs nothing — but ignoring a file your team needs (CLAUDE.md, shared settings, editor rules) quietly breaks the setup for the next person who clones. So this list is deliberately conservative: it ignores what is personal, local, or secret, and nothing else.

Line by line

Claude Code

EntryWhy
.claude/settings.local.json Your personal overrides — permission grants, local model choices, machine-specific paths. It exists precisely so personal settings stay out of the shared .claude/settings.json; committing it defeats the split.
CLAUDE.local.md Personal project memory — your own notes to Claude that teammates shouldn't inherit (your sandbox URLs, your pet shortcuts). The shared CLAUDE.md stays in git; the .local variant stays home.

Notice what's not ignored: the rest of .claude/. Shared settings, slash commands, subagents, and skills are team assets — see the keep-in-git table.

Aider

EntryWhy
.aider* Aider writes chat history (.aider.chat.history.md), input history, tags cache, and local config into the repo root, all prefixed .aider. The glob catches present and future variants — this is the pattern Aider itself offers to add for you.

Secrets

EntryWhy
.env, .env.* Not AI-specific — but AI tools read your environment files for context and will cheerfully stage them in a bulk git add. If an agent commits for you, this line is the seatbelt.
!.env.example The negation keeps your documented, secret-free example committed while the real ones stay out.
*.pem Private keys and certificates. No agent should ever get the chance.

Tools that need no entries

ToolWhy nothing to ignore
GitHub CopilotKeeps all state in your editor and account — it writes nothing to the repo.
CursorIts repo files (.cursor/rules/, legacy .cursorrules) are shared configuration, meant to be committed.
WindsurfSame story: .windsurfrules is team config, not local state.
OpenAI Codex CLIState lives in ~/.codex/, outside the repo. Its AGENTS.md is shared instructions — commit it.
ContinueConfiguration lives in ~/.continue/, not in your project.

Padding a .gitignore with entries for these isn't harmful, just noise — and noise is how real entries stop getting read.

Files you should not ignore

The most common mistake is the blanket .claude/ ignore. These files are the point of the tooling — they configure the AI the same way for everyone who clones:

FileWhat it does
CLAUDE.mdShared project memory — conventions, commands, architecture notes Claude reads at session start. The highest-leverage file in the repo for AI-assisted work.
.claude/settings.jsonTeam settings: permissions, hooks, environment. The shared counterpart to the .local file above.
.claude/commands/Custom slash commands — team workflows, checked in like any script.
.claude/agents/ and .claude/skills/Subagent and skill definitions. Shareable capability, not local state.
.mcp.jsonProject-scoped MCP servers. Commit it — but reference secrets via environment variable expansion, never inline.
AGENTS.md, .cursor/rules/, .windsurfrulesOther tools' shared instruction files. Same logic, same verdict: commit.

The cleaner alternative: your global ignore

Entries for your tools arguably don't belong in the team's .gitignore at all. Git has a personal, machine-wide ignore file exactly for this:

git config --global core.excludesFile ~/.config/git/ignore

Put .aider* and CLAUDE.local.md there once, and every repo you touch is covered — without a diff, a review, or a debate about whose editor droppings get a line. Keep the repo's .gitignore for things that protect the whole team, like the secrets block.

FAQ

Should CLAUDE.md be committed?

Yes, emphatically. It's documentation with a superpower — every teammate's Claude session starts with the same context. Ignoring it is like ignoring the README. Personal additions go in CLAUDE.local.md, which this block keeps out of git.

Doesn't Claude Code handle this itself?

Partially — current versions offer to keep .claude/settings.local.json out of git for you. The explicit entry costs one line and doesn't depend on which version created the file, or on every contributor's client behaving identically.

What about a monorepo with nested .claude/ folders?

Git applies root .gitignore patterns at every depth only when they're written that way. Use **/.claude/settings.local.json and **/CLAUDE.local.md to cover nested packages.

Where do Claude Code chat transcripts live? Do I need to ignore them?

No — session transcripts and history live under ~/.claude/ in your home directory, never inside the repo. If you see conversation files in your project, some other tool put them there.

Should I ignore AI-generated scratch files, plans, or TODO dumps?

That's a workflow choice, not a tool requirement — which is why they're not in the block. If your agents write scratch files, give them a dedicated directory (scratch/, .scratch/) and ignore that one path. Ignoring broad patterns like *.md variants to catch AI litter always ends in tears.