AgentSkillsCN

gitignore

为任意项目创建或更新.gitignore文件。扫描项目以识别所用语言、工具与生成的文件,随后生成分类清晰且注释详尽的.gitignore文件。在启动新项目、新增工具或依赖项之后,或当用户提出创建或更新.gitignore文件的请求时使用。

SKILL.md
--- frontmatter
name: gitignore
description: Create or update a .gitignore file for any project. Scans the project to detect languages, tools, and generated files, then produces a grouped and commented .gitignore. Use when starting a new project, after adding new tools or dependencies, or when the user asks to create or update a .gitignore.
compatibility: Requires Read and Write file access. Works with any language or stack.
metadata:
  author: Cedric L'homme
  version: "1.0"

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 managersuv, pip, npm, yarn, pnpm, cargo, go.sum
  • Generated outputsdist/, 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 # Comment header 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.