home / skills / sounder25 / google-antigravity-skills-library / 15_generate_gitignore

15_generate_gitignore skill

/15_generate_gitignore

This skill creates or updates a .gitignore by fetching templates from GitHub/gitignore and merging them to exclude binaries and secrets.

npx playbooks add skill sounder25/google-antigravity-skills-library --skill 15_generate_gitignore

Review the files below or copy the command above to add this skill to your agents.

Files (3)
SKILL.md
1.5 KB
---
name: Generate .gitignore
description: Create or update .gitignore files by fetching standard templates from the GitHub/gitignore repository.
version: 1.0.0
author: Antigravity Skills Library
created: 2026-01-16
leverage_score: 3/5
---

# SKILL-015: Generate .gitignore

## Overview

Ensures the workspace has a proper `.gitignore` file by fetching industry-standard templates (e.g., Python, Node, VisualStudio, macOS) and merging them. Prevents binary artifacts and secrets from being committed.

## Trigger Phrases

- `create gitignore`
- `update gitignore`
- `ignore build files`
- `add python to gitignore`

## Inputs

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| `--workspace-path` | string | No | Current directory | Root to check |
| `--templates` | string[] | Yes | - | List of templates (e.g. `Python`, `Node`, `VisualStudio`) |
| `--append` | switch | No | false | If file exists, append instead of overwrite |

## Outputs

### 1. .gitignore

The resulting ignore file at the workspace root.

## Implementation

### Script: generate_gitignore.ps1

1. Validates input templates against GitHub/gitignore API or raw URLs.
2. Fetches content for each requested template.
3. Merges them.
4. Writes to `.gitignore`.

## Use Cases

1. **New Project:** Setting up a fresh repo for a combined C#/React project (`VisualStudio` + `Node`).
2. **Maintenance:** Realizing your Python project is committing `__pycache__` and fixing it instantly.

Overview

This skill generates or updates a .gitignore file for a workspace by fetching and merging standard templates from the GitHub/gitignore repository. It prevents accidental commits of binaries, build artifacts, and common secrets by producing a vetted ignore file tailored to the specified technologies. Use it to quickly bootstrap new projects or remediate missing ignores in existing repos.

How this skill works

You provide one or more template names (for example: Python, Node, VisualStudio). The skill validates template names, fetches the raw template contents from the GitHub/gitignore source, merges duplicates and comments, and writes a consolidated .gitignore at the workspace root. If a .gitignore already exists, the tool can append to it or produce a merged replacement depending on the append flag.

When to use it

  • Bootstrapping a new repository that combines multiple technologies (e.g., VisualStudio + Node).
  • Fixing an existing repo that is accidentally committing compiled files or ephemeral caches.
  • Onboarding new team members to ensure consistent ignores across environments.
  • Creating project templates or scaffolding where standard ignores are required.
  • Quickly adding OS-specific or tool-specific ignores like macOS or JetBrains.

Best practices

  • Specify only the templates you need to avoid overly broad ignore rules.
  • Review merged output before committing to ensure no necessary files are ignored.
  • Use append mode when you have a hand-maintained .gitignore to preserve custom rules.
  • Periodically re-run or review templates after major tooling upgrades to capture new patterns.
  • Keep secrets and credentials out of the repo; .gitignore is a safety, not a security control.

Example use cases

  • New C# + React project: fetch and merge VisualStudio and Node templates into a single .gitignore.
  • Python maintenance: add the Python template to stop committing __pycache__ and .pyc files.
  • Mac developer: append macOS and JetBrains templates to an existing .gitignore to ignore IDE and OS files.
  • Monorepo setup: generate a comprehensive .gitignore by combining multiple language templates.
  • CI cleanup: ensure build artifacts and coverage outputs are ignored before enabling CI commits.

FAQ

What happens if a requested template name is invalid?

The skill validates templates and returns an error listing invalid names; valid templates are fetched and merged only after you correct the list.

Will this overwrite my existing .gitignore?

By default it writes a new .gitignore; use the append flag to add merged rules without replacing existing content.