# Gitignore Generator

> Generates or updates a .gitignore file by analyzing the project's tech stack (Node, Python, Go, Rust, etc.) and directory structure. Use this skill when the user asks to create, generate, write, update, or fix a .gitignore file.

- Skill: `fathriabanoub/gitignore-generator` (Agent Skill, multi-file: 3 files)
- Install (CLI): `npx skillmds@latest add fathriabanoub/gitignore-generator`
- Raw SKILL.md: https://api.skillmd.com/api/skills/fathriabanoub/gitignore-generator/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: fathriAbanoub (https://skillmd.com/u/fathriabanoub)
- Updated: 2026-09-22
- Page: https://skillmd.com/skills/fathriabanoub/gitignore-generator

---


# .gitignore Generator

## Purpose
You are a Senior DevOps Engineer specializing in version control best practices. Your goal is to produce a comprehensive, accurate, and clean `.gitignore` file tailored specifically to the user's current project environment.

## Execution Flow

### Step 1 — Gather Project Context
Before writing anything, execute the context-gathering script to detect technologies and existing directory structures.

Try these paths in order until one succeeds:

```bash
# User scope (most common)
python3 ~/.gemini/skills/gitignore-generator/scripts/gather_context.py

# Workspace scope
python3 .gemini/skills/gitignore-generator/scripts/gather_context.py

# Agents alias — user scope
python3 ~/.agents/skills/gitignore-generator/scripts/gather_context.py

# Agents alias — workspace scope
python3 .agents/skills/gitignore-generator/scripts/gather_context.py

# Dynamic fallback (always works)
find ~/.gemini ~/.agents .gemini .agents -name gather_context.py 2>/dev/null | head -1 | xargs python3
```

If the script fails entirely, manually check for:
- `package.json` (Node)
- `requirements.txt` or `pyproject.toml` (Python)
- `go.mod` (Go)
- `Cargo.toml` (Rust)
- Existing directory names (dist/, build/, venv/)

### Step 2 — Analyze Context (Internal — Do Not Output)
Analyze the data provided in the context cache:
1. Identify all languages and frameworks present.
2. Identify existing directories that should be ignored (e.g., if `node_modules` exists, ensure it is ignored).
3. Check if a `.gitignore` already exists and preserve any custom rules that are specific to the user's workflow (unless they are dangerous or incorrect).

### Step 3 — Generate Output
Write the complete `.gitignore` file.

## Output Template
Structure the file as follows:

```gitignore
# [Language/Framework 1]
[specific_rules]

# [Language/Framework 2]
[specific_rules]

# OS Generated Files
[.DS_Store, Thumbs.db, etc.]

# IDE / Editors
[.vscode/, .idea/, *.swp, etc.]

# User Custom Rules (Preserve if exists)
[existing_custom_rules]
```

## Rules
- **Never hallucinate dependencies.** Only ignore files/folders relevant to the detected technologies.
- **Preserve existing custom rules.** If updating an existing file, do not delete comments or rules that look user-specific.
- **Always include standard OS and IDE ignores**, even if no specific tech stack is detected.
- **Sort sections logically:** Language/Framework specific rules first, then OS, then IDE, then User Custom.
- **Do not ignore the `.git` folder.**

