Instructions
1. Scan the project
Read the existing .gitignore (if any). Then inspect the project files to detect:
- •Language — look for
*.py,*.js,*.ts,package.json,pyproject.toml,requirements.txt,Cargo.toml, etc. - •Tools — look for
mise.toml,.tool-versions,docker-compose.yml,.claude/,.idea/,.vscode/,Makefile - •Package managers —
uv,pip,npm,yarn,pnpm,cargo,go.sum - •Generated outputs —
dist/,build/,*.egg-info/, any runtime data files (e.g.graph.json,*.db) - •Credentials —
.env,*.pem,secrets.*,config.local.*
2. Build the .gitignore
Write only the groups that are relevant. Use this structure:
code
# <Group name> <entries> # <Group name> <entries>
Rules:
- •One
# Commentheader per group - •One blank line between groups
- •No blank line between a header and its entries
- •No redundant or catch-all entries — only what the project actually needs
- •Preserve any existing custom entries when updating
3. Standard groups (include only what applies)
Credentials
Always include if .env or secret files are present or likely.
code
# Credentials .env .env.* !.env.example
Generated data
Runtime-produced files that should not be committed.
code
# Generated graph.json
Adapt the filenames to the project (e.g. *.db, output/, dist/).
Dependencies
Installed package directories.
code
# Dependencies .venv/ node_modules/
Tools
Local developer tooling that is machine-specific and should not be shared.
code
# Tools .claude/ mise.toml .idea/ .vscode/
Python
code
# Python __pycache__/ *.pyc *.pyo .pytest_cache/ .mypy_cache/ .ruff_cache/ *.egg-info/ dist/ build/
Node / JavaScript
code
# Node dist/ *.log npm-debug.log*
OS artefacts
Only include for cross-platform or open-source projects.
code
# OS .DS_Store Thumbs.db
4. Write and explain
Write the final .gitignore, then give a one-line explanation for each group you included.