Gitignore
Create or update a .gitignore file from a curated, conservative template
library — OS metadata, language build artifacts, or entries the user names
directly — without duplicating what the file already covers and without
disturbing what the user already wrote.
Routing
Step 1: Resolve the request into targets
A request like "create me a gitignore for a macOS Python project" or
"gitignore for Go on Linux, and also ignore scratch/" names three kinds
of target. Extract all of them from the user's wording:
Operating systems — ../../templates/macos.gitignore,
../../templates/windows.gitignore, ../../templates/linux.gitignore.
Recognize: macOS, mac, OSX, Darwin, Apple; Windows, win; Linux, Ubuntu,
Debian, Fedora, WSL.
Languages — ../../templates/node.gitignore, and likewise
python.gitignore, java.gitignore, kotlin.gitignore, c.gitignore,
go.gitignore, elixir.gitignore.
Recognize: Node, Node.js, npm, yarn, pnpm, JavaScript, JS, TypeScript, TS;
Python, py, Django, Flask, FastAPI, Jupyter; Java, Maven, Gradle; Kotlin,
KT; C; Go, Golang; Elixir, Mix, Phoenix.
Literal entries — specific paths, directories, or globs the user
names (scratch/, *.bak, data/raw/).
A framework name implies its language (Phoenix → Elixir, Django →
Python, Next.js → Node.js), but framework-specific outputs are not in
the language templates — see the opt-in section of
../../references/curation-notes.md.
Step 2: Fill the gaps by detection
If the request names no OS, detect the host:
uname -s
Darwin → macOS, Linux → Linux, MINGW*/MSYS*/CYGWIN* → Windows.
If it names no language, detect from manifests at the repository root — resolve the root first, since the skill may be invoked from a subdirectory:
root=$(git rev-parse --show-toplevel) && ls "$root"/{package.json,pyproject.toml,setup.py,requirements.txt,pom.xml,build.gradle,build.gradle.kts,go.mod,mix.exs,Makefile,CMakeLists.txt} 2>/dev/null
package.json → Node.js; pyproject.toml/setup.py/requirements.txt →
Python; pom.xml/build.gradle* → Java (Kotlin if *.kt sources or
build.gradle.kts dominate); go.mod → Go; mix.exs → Elixir;
Makefile/CMakeLists.txt with *.c/*.h sources → C.
State what you detected in one line. Do not add a template for a language the repository shows no sign of.
Step 3: Route
Dispatch in this order so sections land in a predictable order and deduplication works on a stable sequence:
- OS targets — follow the
gitignore:osworkflow. - Language targets — follow the
gitignore:languageworkflow. - Literal entries — follow the
gitignore:addworkflow.
Skip any step with no targets. When only literal entries were named —
"add scratch/ to my gitignore" — go straight to gitignore:add and do
no detection at all.
All three subskills share ../../references/merge-procedure.md, so
running them in sequence cannot produce duplicate entries or a second
copy of a section header.
Invoke the appropriate subskills. Do not duplicate their logic here.
